Fix type errors in iOS simulator discovery. (#18960)
This commit is contained in:
committed by
Devon Carew
parent
7f7ea2d500
commit
af5d4c6882
@@ -329,4 +329,80 @@ void main() {
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
});
|
||||
|
||||
group('SimControl', () {
|
||||
const int mockPid = 123;
|
||||
const String validSimControlOutput = '''
|
||||
{
|
||||
"devices" : {
|
||||
"watchOS 4.3" : [
|
||||
{
|
||||
"state" : "Shutdown",
|
||||
"availability" : "(available)",
|
||||
"name" : "Apple Watch - 38mm",
|
||||
"udid" : "TEST-WATCH-UDID"
|
||||
}
|
||||
],
|
||||
"iOS 11.4" : [
|
||||
{
|
||||
"state" : "Booted",
|
||||
"availability" : "(available)",
|
||||
"name" : "iPhone 5s",
|
||||
"udid" : "TEST-PHONE-UDID"
|
||||
}
|
||||
],
|
||||
"tvOS 11.4" : [
|
||||
{
|
||||
"state" : "Shutdown",
|
||||
"availability" : "(available)",
|
||||
"name" : "Apple TV",
|
||||
"udid" : "TEST-TV-UDID"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
MockProcessManager mockProcessManager;
|
||||
SimControl simControl;
|
||||
|
||||
setUp(() {
|
||||
mockProcessManager = new MockProcessManager();
|
||||
when(mockProcessManager.runSync(any))
|
||||
.thenReturn(new ProcessResult(mockPid, 0, validSimControlOutput, ''));
|
||||
|
||||
simControl = new SimControl();
|
||||
});
|
||||
|
||||
testUsingContext('getDevices succeeds', () {
|
||||
final List<SimDevice> devices = simControl.getDevices();
|
||||
|
||||
final SimDevice watch = devices[0];
|
||||
expect(watch.category, 'watchOS 4.3');
|
||||
expect(watch.state, 'Shutdown');
|
||||
expect(watch.availability, '(available)');
|
||||
expect(watch.name, 'Apple Watch - 38mm');
|
||||
expect(watch.udid, 'TEST-WATCH-UDID');
|
||||
expect(watch.isBooted, isFalse);
|
||||
|
||||
final SimDevice phone = devices[1];
|
||||
expect(phone.category, 'iOS 11.4');
|
||||
expect(phone.state, 'Booted');
|
||||
expect(phone.availability, '(available)');
|
||||
expect(phone.name, 'iPhone 5s');
|
||||
expect(phone.udid, 'TEST-PHONE-UDID');
|
||||
expect(phone.isBooted, isTrue);
|
||||
|
||||
final SimDevice tv = devices[2];
|
||||
expect(tv.category, 'tvOS 11.4');
|
||||
expect(tv.state, 'Shutdown');
|
||||
expect(tv.availability, '(available)');
|
||||
expect(tv.name, 'Apple TV');
|
||||
expect(tv.udid, 'TEST-TV-UDID');
|
||||
expect(tv.isBooted, isFalse);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
SimControl: () => simControl,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user