Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d85ea513
Unverified
Commit
d85ea513
authored
Jan 29, 2020
by
Jenn Magder
Committed by
GitHub
Jan 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move iMobileDevice to globals (#49724)
parent
a52de68b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
35 deletions
+34
-35
globals.dart
packages/flutter_tools/lib/src/globals.dart
+2
-0
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+8
-8
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+0
-3
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+14
-14
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+10
-10
No files found.
packages/flutter_tools/lib/src/globals.dart
View file @
d85ea513
...
@@ -14,6 +14,7 @@ import 'base/io.dart';
...
@@ -14,6 +14,7 @@ import 'base/io.dart';
import
'base/logger.dart'
;
import
'base/logger.dart'
;
import
'base/terminal.dart'
;
import
'base/terminal.dart'
;
import
'cache.dart'
;
import
'cache.dart'
;
import
'ios/mac.dart'
;
import
'macos/xcode.dart'
;
import
'macos/xcode.dart'
;
import
'version.dart'
;
import
'version.dart'
;
...
@@ -44,6 +45,7 @@ Platform get platform => context.get<Platform>() ?? _kLocalPlatform;
...
@@ -44,6 +45,7 @@ Platform get platform => context.get<Platform>() ?? _kLocalPlatform;
Xcode
get
xcode
=>
context
.
get
<
Xcode
>();
Xcode
get
xcode
=>
context
.
get
<
Xcode
>();
FlutterVersion
get
flutterVersion
=>
context
.
get
<
FlutterVersion
>();
FlutterVersion
get
flutterVersion
=>
context
.
get
<
FlutterVersion
>();
IMobileDevice
get
iMobileDevice
=>
context
.
get
<
IMobileDevice
>();
/// Display an error level message to the user. Commands should use this if they
/// Display an error level message to the user. Commands should use this if they
/// fail in some way.
/// fail in some way.
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
d85ea513
...
@@ -174,20 +174,20 @@ class IOSDevice extends Device {
...
@@ -174,20 +174,20 @@ class IOSDevice extends Device {
if
(!
globals
.
platform
.
isMacOS
)
{
if
(!
globals
.
platform
.
isMacOS
)
{
throw
UnsupportedError
(
'Control of iOS devices or simulators only supported on Mac OS.'
);
throw
UnsupportedError
(
'Control of iOS devices or simulators only supported on Mac OS.'
);
}
}
if
(!
iMobileDevice
.
isInstalled
)
{
if
(!
globals
.
iMobileDevice
.
isInstalled
)
{
return
<
IOSDevice
>[];
return
<
IOSDevice
>[];
}
}
final
List
<
IOSDevice
>
devices
=
<
IOSDevice
>[];
final
List
<
IOSDevice
>
devices
=
<
IOSDevice
>[];
for
(
String
id
in
(
await
iMobileDevice
.
getAvailableDeviceIDs
()).
split
(
'
\n
'
))
{
for
(
String
id
in
(
await
globals
.
iMobileDevice
.
getAvailableDeviceIDs
()).
split
(
'
\n
'
))
{
id
=
id
.
trim
();
id
=
id
.
trim
();
if
(
id
.
isEmpty
)
{
if
(
id
.
isEmpty
)
{
continue
;
continue
;
}
}
try
{
try
{
final
String
deviceName
=
await
iMobileDevice
.
getInfoForDevice
(
id
,
'DeviceName'
);
final
String
deviceName
=
await
globals
.
iMobileDevice
.
getInfoForDevice
(
id
,
'DeviceName'
);
final
String
sdkVersion
=
await
iMobileDevice
.
getInfoForDevice
(
id
,
'ProductVersion'
);
final
String
sdkVersion
=
await
globals
.
iMobileDevice
.
getInfoForDevice
(
id
,
'ProductVersion'
);
devices
.
add
(
IOSDevice
(
id
,
name:
deviceName
,
sdkVersion:
sdkVersion
));
devices
.
add
(
IOSDevice
(
id
,
name:
deviceName
,
sdkVersion:
sdkVersion
));
}
on
IOSDeviceNotFoundError
catch
(
error
)
{
}
on
IOSDeviceNotFoundError
catch
(
error
)
{
// Unable to find device with given udid. Possibly a network device.
// Unable to find device with given udid. Possibly a network device.
...
@@ -283,7 +283,7 @@ class IOSDevice extends Device {
...
@@ -283,7 +283,7 @@ class IOSDevice extends Device {
String
cpuArchitecture
;
String
cpuArchitecture
;
try
{
try
{
cpuArchitecture
=
await
iMobileDevice
.
getInfoForDevice
(
id
,
'CPUArchitecture'
);
cpuArchitecture
=
await
globals
.
iMobileDevice
.
getInfoForDevice
(
id
,
'CPUArchitecture'
);
}
on
IOSDeviceNotFoundError
catch
(
e
)
{
}
on
IOSDeviceNotFoundError
catch
(
e
)
{
globals
.
printError
(
e
.
message
);
globals
.
printError
(
e
.
message
);
return
LaunchResult
.
failed
();
return
LaunchResult
.
failed
();
...
@@ -460,11 +460,11 @@ class IOSDevice extends Device {
...
@@ -460,11 +460,11 @@ class IOSDevice extends Device {
void
clearLogs
()
{
}
void
clearLogs
()
{
}
@override
@override
bool
get
supportsScreenshot
=>
iMobileDevice
.
isInstalled
;
bool
get
supportsScreenshot
=>
globals
.
iMobileDevice
.
isInstalled
;
@override
@override
Future
<
void
>
takeScreenshot
(
File
outputFile
)
async
{
Future
<
void
>
takeScreenshot
(
File
outputFile
)
async
{
await
iMobileDevice
.
takeScreenshot
(
outputFile
);
await
globals
.
iMobileDevice
.
takeScreenshot
(
outputFile
);
}
}
@override
@override
...
@@ -610,7 +610,7 @@ class IOSDeviceLogReader extends DeviceLogReader {
...
@@ -610,7 +610,7 @@ class IOSDeviceLogReader extends DeviceLogReader {
if
(
device
.
majorSdkVersion
>=
_minimumUniversalLoggingSdkVersion
)
{
if
(
device
.
majorSdkVersion
>=
_minimumUniversalLoggingSdkVersion
)
{
return
;
return
;
}
}
iMobileDevice
.
startLogger
(
device
.
id
).
then
<
void
>((
Process
process
)
{
globals
.
iMobileDevice
.
startLogger
(
device
.
id
).
then
<
void
>((
Process
process
)
{
process
.
stdout
.
transform
<
String
>(
utf8
.
decoder
).
transform
<
String
>(
const
LineSplitter
()).
listen
(
_newSyslogLineHandler
());
process
.
stdout
.
transform
<
String
>(
utf8
.
decoder
).
transform
<
String
>(
const
LineSplitter
()).
listen
(
_newSyslogLineHandler
());
process
.
stderr
.
transform
<
String
>(
utf8
.
decoder
).
transform
<
String
>(
const
LineSplitter
()).
listen
(
_newSyslogLineHandler
());
process
.
stderr
.
transform
<
String
>(
utf8
.
decoder
).
transform
<
String
>(
const
LineSplitter
()).
listen
(
_newSyslogLineHandler
());
process
.
exitCode
.
whenComplete
(()
{
process
.
exitCode
.
whenComplete
(()
{
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
d85ea513
...
@@ -9,7 +9,6 @@ import 'package:meta/meta.dart';
...
@@ -9,7 +9,6 @@ import 'package:meta/meta.dart';
import
'../application_package.dart'
;
import
'../application_package.dart'
;
import
'../artifacts.dart'
;
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
...
@@ -26,8 +25,6 @@ import '../reporting/reporting.dart';
...
@@ -26,8 +25,6 @@ import '../reporting/reporting.dart';
import
'code_signing.dart'
;
import
'code_signing.dart'
;
import
'xcodeproj.dart'
;
import
'xcodeproj.dart'
;
IMobileDevice
get
iMobileDevice
=>
context
.
get
<
IMobileDevice
>();
/// Specialized exception for expected situations where the ideviceinfo
/// Specialized exception for expected situations where the ideviceinfo
/// tool responds with exit code 255 / 'No device found' message
/// tool responds with exit code 255 / 'No device found' message
class
IOSDeviceNotFoundError
implements
Exception
{
class
IOSDeviceNotFoundError
implements
Exception
{
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
d85ea513
...
@@ -770,8 +770,8 @@ void main() {
...
@@ -770,8 +770,8 @@ void main() {
});
});
testUsingContext
(
'returns no devices if none are attached'
,
()
async
{
testUsingContext
(
'returns no devices if none are attached'
,
()
async
{
when
(
iMobileDevice
.
isInstalled
).
thenReturn
(
true
);
when
(
globals
.
iMobileDevice
.
isInstalled
).
thenReturn
(
true
);
when
(
iMobileDevice
.
getAvailableDeviceIDs
())
when
(
globals
.
iMobileDevice
.
getAvailableDeviceIDs
())
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
''
));
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
''
));
final
List
<
IOSDevice
>
devices
=
await
IOSDevice
.
getAttachedDevices
();
final
List
<
IOSDevice
>
devices
=
await
IOSDevice
.
getAttachedDevices
();
expect
(
devices
,
isEmpty
);
expect
(
devices
,
isEmpty
);
...
@@ -783,8 +783,8 @@ void main() {
...
@@ -783,8 +783,8 @@ void main() {
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
for
(
final
Platform
platform
in
unsupportedPlatforms
)
{
for
(
final
Platform
platform
in
unsupportedPlatforms
)
{
testUsingContext
(
'throws Unsupported Operation exception on
${platform.operatingSystem}
'
,
()
async
{
testUsingContext
(
'throws Unsupported Operation exception on
${platform.operatingSystem}
'
,
()
async
{
when
(
iMobileDevice
.
isInstalled
).
thenReturn
(
false
);
when
(
globals
.
iMobileDevice
.
isInstalled
).
thenReturn
(
false
);
when
(
iMobileDevice
.
getAvailableDeviceIDs
())
when
(
globals
.
iMobileDevice
.
getAvailableDeviceIDs
())
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
''
));
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
''
));
expect
(
expect
(
()
async
{
await
IOSDevice
.
getAttachedDevices
();
},
()
async
{
await
IOSDevice
.
getAttachedDevices
();
},
...
@@ -797,19 +797,19 @@ void main() {
...
@@ -797,19 +797,19 @@ void main() {
}
}
testUsingContext
(
'returns attached devices'
,
()
async
{
testUsingContext
(
'returns attached devices'
,
()
async
{
when
(
iMobileDevice
.
isInstalled
).
thenReturn
(
true
);
when
(
globals
.
iMobileDevice
.
isInstalled
).
thenReturn
(
true
);
when
(
iMobileDevice
.
getAvailableDeviceIDs
())
when
(
globals
.
iMobileDevice
.
getAvailableDeviceIDs
())
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
'''
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
'''
98206e7a4afd4aedaff06e687594e089dede3c44
98206e7a4afd4aedaff06e687594e089dede3c44
f577a7903cc54959be2e34bc4f7f80b7009efcf4
f577a7903cc54959be2e34bc4f7f80b7009efcf4
'''
));
'''
));
when
(
iMobileDevice
.
getInfoForDevice
(
'98206e7a4afd4aedaff06e687594e089dede3c44'
,
'DeviceName'
))
when
(
globals
.
iMobileDevice
.
getInfoForDevice
(
'98206e7a4afd4aedaff06e687594e089dede3c44'
,
'DeviceName'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'La tele me regarde'
));
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'La tele me regarde'
));
when
(
iMobileDevice
.
getInfoForDevice
(
'98206e7a4afd4aedaff06e687594e089dede3c44'
,
'ProductVersion'
))
when
(
globals
.
iMobileDevice
.
getInfoForDevice
(
'98206e7a4afd4aedaff06e687594e089dede3c44'
,
'ProductVersion'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'10.3.2'
));
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'10.3.2'
));
when
(
iMobileDevice
.
getInfoForDevice
(
'f577a7903cc54959be2e34bc4f7f80b7009efcf4'
,
'DeviceName'
))
when
(
globals
.
iMobileDevice
.
getInfoForDevice
(
'f577a7903cc54959be2e34bc4f7f80b7009efcf4'
,
'DeviceName'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'Puits sans fond'
));
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'Puits sans fond'
));
when
(
iMobileDevice
.
getInfoForDevice
(
'f577a7903cc54959be2e34bc4f7f80b7009efcf4'
,
'ProductVersion'
))
when
(
globals
.
iMobileDevice
.
getInfoForDevice
(
'f577a7903cc54959be2e34bc4f7f80b7009efcf4'
,
'ProductVersion'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'11.0'
));
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'11.0'
));
final
List
<
IOSDevice
>
devices
=
await
IOSDevice
.
getAttachedDevices
();
final
List
<
IOSDevice
>
devices
=
await
IOSDevice
.
getAttachedDevices
();
expect
(
devices
,
hasLength
(
2
));
expect
(
devices
,
hasLength
(
2
));
...
@@ -823,15 +823,15 @@ f577a7903cc54959be2e34bc4f7f80b7009efcf4
...
@@ -823,15 +823,15 @@ f577a7903cc54959be2e34bc4f7f80b7009efcf4
});
});
testUsingContext
(
'returns attached devices and ignores devices that cannot be found by ideviceinfo'
,
()
async
{
testUsingContext
(
'returns attached devices and ignores devices that cannot be found by ideviceinfo'
,
()
async
{
when
(
iMobileDevice
.
isInstalled
).
thenReturn
(
true
);
when
(
globals
.
iMobileDevice
.
isInstalled
).
thenReturn
(
true
);
when
(
iMobileDevice
.
getAvailableDeviceIDs
())
when
(
globals
.
iMobileDevice
.
getAvailableDeviceIDs
())
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
'''
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
'''
98206e7a4afd4aedaff06e687594e089dede3c44
98206e7a4afd4aedaff06e687594e089dede3c44
f577a7903cc54959be2e34bc4f7f80b7009efcf4
f577a7903cc54959be2e34bc4f7f80b7009efcf4
'''
));
'''
));
when
(
iMobileDevice
.
getInfoForDevice
(
'98206e7a4afd4aedaff06e687594e089dede3c44'
,
'DeviceName'
))
when
(
globals
.
iMobileDevice
.
getInfoForDevice
(
'98206e7a4afd4aedaff06e687594e089dede3c44'
,
'DeviceName'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'La tele me regarde'
));
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'La tele me regarde'
));
when
(
iMobileDevice
.
getInfoForDevice
(
'f577a7903cc54959be2e34bc4f7f80b7009efcf4'
,
'DeviceName'
))
when
(
globals
.
iMobileDevice
.
getInfoForDevice
(
'f577a7903cc54959be2e34bc4f7f80b7009efcf4'
,
'DeviceName'
))
.
thenThrow
(
const
IOSDeviceNotFoundError
(
'Device not found'
));
.
thenThrow
(
const
IOSDeviceNotFoundError
(
'Device not found'
));
final
List
<
IOSDevice
>
devices
=
await
IOSDevice
.
getAttachedDevices
();
final
List
<
IOSDevice
>
devices
=
await
IOSDevice
.
getAttachedDevices
();
expect
(
devices
,
hasLength
(
1
));
expect
(
devices
,
hasLength
(
1
));
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
d85ea513
...
@@ -60,7 +60,7 @@ void main() {
...
@@ -60,7 +60,7 @@ void main() {
when
(
mockProcessManager
.
runSync
(
when
(
mockProcessManager
.
runSync
(
<
String
>[
ideviceIdPath
,
'-h'
],
environment:
anyNamed
(
'environment'
),
<
String
>[
ideviceIdPath
,
'-h'
],
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
ProcessResult
(
123
,
1
,
''
,
''
));
)).
thenReturn
(
ProcessResult
(
123
,
1
,
''
,
''
));
expect
(
await
iMobileDevice
.
isWorking
,
false
);
expect
(
await
globals
.
iMobileDevice
.
isWorking
,
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Artifacts:
()
=>
mockArtifacts
,
Artifacts:
()
=>
mockArtifacts
,
...
@@ -71,7 +71,7 @@ void main() {
...
@@ -71,7 +71,7 @@ void main() {
<
String
>[
ideviceIdPath
,
'-l'
],
<
String
>[
ideviceIdPath
,
'-l'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenThrow
(
ProcessException
(
ideviceIdPath
,
<
String
>[
'-l'
]));
)).
thenThrow
(
ProcessException
(
ideviceIdPath
,
<
String
>[
'-l'
]));
expect
(()
async
=>
await
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
expect
(()
async
=>
await
globals
.
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Cache:
()
=>
mockCache
,
...
@@ -83,7 +83,7 @@ void main() {
...
@@ -83,7 +83,7 @@ void main() {
<
String
>[
ideviceIdPath
,
'-l'
],
<
String
>[
ideviceIdPath
,
'-l'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
1
,
''
,
'Sad today'
)));
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
1
,
''
,
'Sad today'
)));
expect
(()
async
=>
await
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
expect
(()
async
=>
await
globals
.
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Cache:
()
=>
mockCache
,
...
@@ -95,7 +95,7 @@ void main() {
...
@@ -95,7 +95,7 @@ void main() {
<
String
>[
ideviceIdPath
,
'-l'
],
<
String
>[
ideviceIdPath
,
'-l'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
'foo'
,
''
)));
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
'foo'
,
''
)));
expect
(
await
iMobileDevice
.
getAvailableDeviceIDs
(),
'foo'
);
expect
(
await
globals
.
iMobileDevice
.
getAvailableDeviceIDs
(),
'foo'
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Cache:
()
=>
mockCache
,
...
@@ -108,7 +108,7 @@ void main() {
...
@@ -108,7 +108,7 @@ void main() {
<
String
>[
ideviceInfoPath
,
'-u'
,
'foo'
,
'-k'
,
'bar'
],
<
String
>[
ideviceInfoPath
,
'-u'
,
'foo'
,
'-k'
,
'bar'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
255
,
'No device found with udid foo, is it plugged in?'
,
''
)));
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
255
,
'No device found with udid foo, is it plugged in?'
,
''
)));
expect
(()
async
=>
await
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isA
<
IOSDeviceNotFoundError
>()));
expect
(()
async
=>
await
globals
.
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isA
<
IOSDeviceNotFoundError
>()));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Cache:
()
=>
mockCache
,
...
@@ -129,7 +129,7 @@ void main() {
...
@@ -129,7 +129,7 @@ void main() {
);
);
return
Future
<
ProcessResult
>.
value
(
result
);
return
Future
<
ProcessResult
>.
value
(
result
);
});
});
expect
(()
async
=>
await
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isA
<
IOSDeviceNotTrustedError
>()));
expect
(()
async
=>
await
globals
.
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isA
<
IOSDeviceNotTrustedError
>()));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Cache:
()
=>
mockCache
,
...
@@ -150,7 +150,7 @@ void main() {
...
@@ -150,7 +150,7 @@ void main() {
);
);
return
Future
<
ProcessResult
>.
value
(
result
);
return
Future
<
ProcessResult
>.
value
(
result
);
});
});
expect
(()
async
=>
await
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsToolExit
());
expect
(()
async
=>
await
globals
.
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Cache:
()
=>
mockCache
,
...
@@ -171,7 +171,7 @@ void main() {
...
@@ -171,7 +171,7 @@ void main() {
);
);
return
Future
<
ProcessResult
>.
value
(
result
);
return
Future
<
ProcessResult
>.
value
(
result
);
});
});
expect
(()
async
=>
await
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isA
<
IOSDeviceNotTrustedError
>()));
expect
(()
async
=>
await
globals
.
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isA
<
IOSDeviceNotTrustedError
>()));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Cache:
()
=>
mockCache
,
...
@@ -198,7 +198,7 @@ void main() {
...
@@ -198,7 +198,7 @@ void main() {
workingDirectory:
null
,
workingDirectory:
null
,
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
1
,
''
,
''
)));
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
1
,
''
,
''
)));
expect
(()
async
=>
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
),
throwsA
(
anything
));
expect
(()
async
=>
await
globals
.
iMobileDevice
.
takeScreenshot
(
mockOutputFile
),
throwsA
(
anything
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Platform:
()
=>
osx
,
Platform:
()
=>
osx
,
...
@@ -210,7 +210,7 @@ void main() {
...
@@ -210,7 +210,7 @@ void main() {
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
),
workingDirectory:
null
)).
thenAnswer
(
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
),
workingDirectory:
null
)).
thenAnswer
(
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
);
await
globals
.
iMobileDevice
.
takeScreenshot
(
mockOutputFile
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputPath
],
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputPath
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
workingDirectory:
null
,
workingDirectory:
null
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment