27 lines
1.3 KiB
Dart
27 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:jj_mkvmaker/app/web_view_proxy_target.dart';
|
|
import 'package:jj_mkvmaker/services/platform_info.dart';
|
|
|
|
/// M1 약속: 기기 판단은 PlatformInfo 한곳 - 이 기기는 그대로 읽고, 메모리 아끼기 처음 값은 Android,
|
|
/// 앱 전체 웹 뷰 프록시는 Android 에서만 (Windows 는 웹 뷰마다 따로)
|
|
void main() {
|
|
test('host 는 이 기기 그대로', () {
|
|
expect([PlatformInfo.host.isAndroid, PlatformInfo.host.isWindows], [Platform.isAndroid, Platform.isWindows]);
|
|
});
|
|
|
|
test('lowMemory 처음 값 = Android, 준 값은 그대로', () {
|
|
expect([PlatformInfo.android.lowMemory, PlatformInfo.windows.lowMemory], [true, false]);
|
|
expect(const PlatformInfo(isAndroid: false, isWindows: true, lowMemory: true).lowMemory, isTrue);
|
|
expect(const PlatformInfo(isAndroid: true, isWindows: false, lowMemory: false).lowMemory, isFalse);
|
|
});
|
|
|
|
test('웹 뷰 프록시: Android 만 쓰고, 아닌 기기는 걸어도 아무 일 없음', () async {
|
|
expect(WebViewProxyTarget.forPlatform(PlatformInfo.android), isA<AndroidWebViewProxy>());
|
|
final none = WebViewProxyTarget.forPlatform(PlatformInfo.windows);
|
|
expect(none.active, isFalse);
|
|
await none.set('http://127.0.0.1:9', removeImplicitRules: true);
|
|
});
|
|
}
|