@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/base/platform.dart';
14
14
import 'package:flutter_tools/src/base/process.dart' ;
15
15
import 'package:flutter_tools/src/cache.dart' ;
16
16
import 'package:flutter_tools/src/globals.dart' as globals;
17
+ import 'package:flutter_tools/src/ios/devices.dart' ;
17
18
import 'package:flutter_tools/src/ios/mac.dart' ;
18
19
import 'package:flutter_tools/src/ios/xcodeproj.dart' ;
19
20
import 'package:flutter_tools/src/project.dart' ;
@@ -85,10 +86,14 @@ void main() {
85
86
logger: logger,
86
87
);
87
88
88
- expect (() async => await iMobileDevice.takeScreenshot (mockOutputFile, '1234' ), throwsA (anything));
89
+ expect (() async => await iMobileDevice.takeScreenshot (
90
+ mockOutputFile,
91
+ '1234' ,
92
+ IOSDeviceInterface .usb,
93
+ ), throwsA (anything));
89
94
});
90
95
91
- testWithoutContext ('idevicescreenshot captures and returns screenshot' , () async {
96
+ testWithoutContext ('idevicescreenshot captures and returns USB screenshot' , () async {
92
97
when (mockOutputFile.path).thenReturn (outputPath);
93
98
when (mockProcessManager.run (any, environment: anyNamed ('environment' ), workingDirectory: null )).thenAnswer (
94
99
(Invocation invocation) => Future <ProcessResult >.value (ProcessResult (4 , 0 , '' , '' )));
@@ -100,12 +105,39 @@ void main() {
100
105
logger: logger,
101
106
);
102
107
103
- await iMobileDevice.takeScreenshot (mockOutputFile, '1234' );
108
+ await iMobileDevice.takeScreenshot (
109
+ mockOutputFile,
110
+ '1234' ,
111
+ IOSDeviceInterface .usb,
112
+ );
104
113
verify (mockProcessManager.run (< String > [idevicescreenshotPath, outputPath, '--udid' , '1234' ],
105
114
environment: < String , String > {'DYLD_LIBRARY_PATH' : libimobiledevicePath},
106
115
workingDirectory: null ,
107
116
));
108
117
});
118
+
119
+ testWithoutContext ('idevicescreenshot captures and returns network screenshot' , () async {
120
+ when (mockOutputFile.path).thenReturn (outputPath);
121
+ when (mockProcessManager.run (any, environment: anyNamed ('environment' ), workingDirectory: null )).thenAnswer (
122
+ (Invocation invocation) => Future <ProcessResult >.value (ProcessResult (4 , 0 , '' , '' )));
123
+
124
+ final IMobileDevice iMobileDevice = IMobileDevice (
125
+ artifacts: mockArtifacts,
126
+ cache: mockCache,
127
+ processManager: mockProcessManager,
128
+ logger: logger,
129
+ );
130
+
131
+ await iMobileDevice.takeScreenshot (
132
+ mockOutputFile,
133
+ '1234' ,
134
+ IOSDeviceInterface .network,
135
+ );
136
+ verify (mockProcessManager.run (< String > [idevicescreenshotPath, outputPath, '--udid' , '1234' , '--network' ],
137
+ environment: < String , String > {'DYLD_LIBRARY_PATH' : libimobiledevicePath},
138
+ workingDirectory: null ,
139
+ ));
140
+ });
109
141
});
110
142
});
111
143
0 commit comments