import 'package:flutter_test/flutter_test.dart'; import 'package:jj_mkvmaker/app/app_controller.dart'; import 'package:jj_mkvmaker/core/shizuku.dart'; import 'package:jj_mkvmaker/platform/windows/desktop_storage_service.dart'; import 'package:jj_mkvmaker/platform/windows/process_media_tool.dart'; import 'package:jj_mkvmaker/services/platform_services.dart'; class _Back implements ShizukuBackend { _Back(this.name); final String name; @override dynamic noSuchMethod(Invocation i) => super.noSuchMethod(i); } /// 약속 (M3 PrivilegedFs): 앱 조립이 privileged 를 넘기면 AppController 가 켤 때 건다 · 넘기지 않으면 지금 것을 그대로 둔다 (시험의 가짜를 덮지 않음) · /// ShizukuRemote 는 지금 건 뒤쪽 (시스템 · 루트) 을 쓴다 void main() { final was = PrivilegedFs.current; tearDown(() => PrivilegedFs.use(was)); test('privileged 를 넘기면 켤 때 걸고, 안 넘기면 그대로', () { final a = PrivilegedFs(shizuku: _Back('a'), root: _Back('ar'), tempDir: () async => 'A'); PrivilegedFs.use(a); AppController(PlatformServices(mediaTool: ProcessMediaTool('x', 'y'), storage: DesktopStorageService())); expect(identical(PrivilegedFs.current, a), isTrue, reason: '안 넘기면 그대로'); final b = PrivilegedFs(shizuku: _Back('b'), root: _Back('br'), tempDir: () async => 'B'); AppController(PlatformServices(mediaTool: ProcessMediaTool('x', 'y'), storage: DesktopStorageService(), privileged: b)); expect(identical(PrivilegedFs.current, b), isTrue, reason: '넘기면 건다'); }); test('device: Shizuku 는 AndroidShizuku, 루트는 SuRoot (실제 Process.start), 임시는 넘긴 폴더', () async { final d = PrivilegedFs.device(() async => 'T'); expect([d.shizuku is AndroidShizuku, d.root is SuRoot, await d.tempDir()], [true, true, 'T']); }); }