@@ -43,13 +43,14 @@ void main() {
4343 });
4444
4545 testWithoutContext ('WindowsUwpDevice defaults' , () async {
46- final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice ();
46+ final FakeUwpTool uwptool = FakeUwpTool ();
47+ final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice (uwptool: uwptool);
4748 final FakeBuildableUwpApp package = FakeBuildableUwpApp ();
4849
4950 expect (await windowsDevice.targetPlatform, TargetPlatform .windows_uwp_x64);
5051 expect (windowsDevice.name, 'Windows (UWP)' );
5152 expect (await windowsDevice.installApp (package), true );
52- expect (await windowsDevice.uninstallApp (package), false );
53+ expect (await windowsDevice.uninstallApp (package), true );
5354 expect (await windowsDevice.isLatestBuildInstalled (package), false );
5455 expect (await windowsDevice.isAppInstalled (package), false );
5556 expect (windowsDevice.category, Category .desktop);
@@ -170,15 +171,8 @@ void main() {
170171 Cache .flutterRoot = '' ;
171172 final FakeUwpTool uwptool = FakeUwpTool ();
172173 final FileSystem fileSystem = MemoryFileSystem .test ();
173- final FakeProcessManager processManager = FakeProcessManager .list (< FakeCommand > [
174- const FakeCommand (command: < String > [
175- 'powershell.exe' ,
176- 'build/winuwp/runner_uwp/AppPackages/testapp/testapp_1.2.3.4_Debug_Test/install.ps1' ,
177- ]),
178- ]);
179174 final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice (
180175 fileSystem: fileSystem,
181- processManager: processManager,
182176 uwptool: uwptool,
183177 );
184178 final FakeBuildableUwpApp package = FakeBuildableUwpApp ();
@@ -191,7 +185,7 @@ void main() {
191185 );
192186
193187 expect (result.started, true );
194- expect (uwptool.launchRequests.single.appId , 'PACKAGE-ID_asdfghjkl ' );
188+ expect (uwptool.launchRequests.single.packageFamily , 'PACKAGE-ID_publisher ' );
195189 expect (uwptool.launchRequests.single.args, < String > [
196190 '--observatory-port=12345' ,
197191 '--disable-service-auth-codes' ,
@@ -205,15 +199,8 @@ void main() {
205199 Cache .flutterRoot = '' ;
206200 final FakeUwpTool uwptool = FakeUwpTool ();
207201 final FileSystem fileSystem = MemoryFileSystem .test ();
208- final FakeProcessManager processManager = FakeProcessManager .list (< FakeCommand > [
209- const FakeCommand (command: < String > [
210- 'powershell.exe' ,
211- 'build/winuwp/runner_uwp/AppPackages/testapp/testapp_1.2.3.4_Release_Test/install.ps1' ,
212- ]),
213- ]);
214202 final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice (
215203 fileSystem: fileSystem,
216- processManager: processManager,
217204 uwptool: uwptool,
218205 );
219206 final FakeBuildableUwpApp package = FakeBuildableUwpApp ();
@@ -226,7 +213,7 @@ void main() {
226213 );
227214
228215 expect (result.started, true );
229- expect (uwptool.launchRequests.single.appId , 'PACKAGE-ID_asdfghjkl ' );
216+ expect (uwptool.launchRequests.single.packageFamily , 'PACKAGE-ID_publisher ' );
230217 expect (uwptool.launchRequests.single.args, < String > []);
231218 });
232219}
@@ -279,44 +266,71 @@ class FakeBuildableUwpApp extends Fake implements BuildableUwpApp {
279266 String get name => 'testapp' ;
280267 @override
281268 String get projectVersion => '1.2.3.4' ;
269+
270+ // Test helper to get the expected package family.
271+ static const String packageFamily = 'PACKAGE-ID_publisher' ;
282272}
283273
284274class FakeUwpTool implements UwpTool {
275+ bool isInstalled = false ;
276+ final List <_GetPackageFamilyRequest > getPackageFamilyRequests = < _GetPackageFamilyRequest > [];
285277 final List <_LaunchRequest > launchRequests = < _LaunchRequest > [];
286- final List <_LookupAppIdRequest > lookupAppIdRequests = < _LookupAppIdRequest > [];
278+ final List <_InstallRequest > installRequests = < _InstallRequest > [];
279+ final List <_UninstallRequest > uninstallRequests = < _UninstallRequest > [];
287280
288281 @override
289282 Future <List <String >> listApps () async {
290- return < String > [
291- 'fb89bf4f-55db-4bcd-8f0b-d8139953e08b' ,
292- '3e556a66-cb7f-4335-9569-35d5f5e37219' ,
293- 'dfe5d409-a524-4635-b2f8-78a5e9551994' ,
294- '51e8a06b-02e8-4f76-9131-f20ce114fc34' ,
295- ];
283+ return isInstalled ? < String > [FakeBuildableUwpApp .packageFamily] : < String > [];
296284 }
297285
298286 @override
299- Future <String > getAppIdFromPackageId (String packageId ) async {
300- lookupAppIdRequests .add (_LookupAppIdRequest (packageId ));
301- return '${ packageId }_asdfghjkl' ;
287+ Future <String /*?*/ > getPackageFamilyName (String packageName ) async {
288+ getPackageFamilyRequests .add (_GetPackageFamilyRequest (packageName ));
289+ return isInstalled ? FakeBuildableUwpApp .packageFamily : null ;
302290 }
303291
304292 @override
305- Future <int > launchApp (String appId , List <String > args) async {
306- launchRequests.add (_LaunchRequest (appId , args));
293+ Future <int /*?*/ > launchApp (String packageFamily , List <String > args) async {
294+ launchRequests.add (_LaunchRequest (packageFamily , args));
307295 return 42 ;
308296 }
297+
298+ @override
299+ Future <bool > installApp (String buildDirectory) async {
300+ installRequests.add (_InstallRequest (buildDirectory));
301+ isInstalled = true ;
302+ return true ;
303+ }
304+
305+ @override
306+ Future <bool > uninstallApp (String packageFamily) async {
307+ uninstallRequests.add (_UninstallRequest (packageFamily));
308+ isInstalled = false ;
309+ return true ;
310+ }
309311}
310312
311- class _LookupAppIdRequest {
312- const _LookupAppIdRequest (this .packageId);
313+ class _GetPackageFamilyRequest {
314+ const _GetPackageFamilyRequest (this .packageId);
313315
314316 final String packageId;
315317}
316318
317319class _LaunchRequest {
318- const _LaunchRequest (this .appId , this .args);
320+ const _LaunchRequest (this .packageFamily , this .args);
319321
320- final String appId ;
322+ final String packageFamily ;
321323 final List <String > args;
322324}
325+
326+ class _InstallRequest {
327+ const _InstallRequest (this .buildDirectory);
328+
329+ final String buildDirectory;
330+ }
331+
332+ class _UninstallRequest {
333+ const _UninstallRequest (this .packageFamily);
334+
335+ final String packageFamily;
336+ }
0 commit comments