IOSSimulator implementation.
Also fixes some minor bugs with iOS and Android interactions.
This commit is contained in:
@@ -26,6 +26,10 @@ defineTests() {
|
||||
when(ios.isConnected()).thenReturn(false);
|
||||
when(ios.installApp(any)).thenReturn(false);
|
||||
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
when(iosSim.installApp(any)).thenReturn(false);
|
||||
|
||||
InstallCommand command = new InstallCommand(android: android, ios: ios);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
@@ -44,7 +48,12 @@ defineTests() {
|
||||
when(ios.isConnected()).thenReturn(true);
|
||||
when(ios.installApp(any)).thenReturn(true);
|
||||
|
||||
InstallCommand command = new InstallCommand(android: android, ios: ios);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
when(iosSim.installApp(any)).thenReturn(false);
|
||||
|
||||
InstallCommand command =
|
||||
new InstallCommand(android: android, ios: ios, iosSim: iosSim);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
|
||||
@@ -30,7 +30,13 @@ defineTests() {
|
||||
when(ios.installerPath).thenReturn('echo');
|
||||
when(ios.listerPath).thenReturn('echo');
|
||||
|
||||
ListCommand command = new ListCommand(android: android, ios: ios);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
// Avoid relying on xcrun being installed on the test system.
|
||||
// Instead, cause the test to run the echo command.
|
||||
when(iosSim.xcrunPath).thenReturn('echo');
|
||||
|
||||
ListCommand command =
|
||||
new ListCommand(android: android, ios: ios, iosSim: iosSim);
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
runner.run(['list']).then((int code) => expect(code, equals(0)));
|
||||
|
||||
@@ -22,8 +22,10 @@ defineTests() {
|
||||
when(android.isConnected()).thenReturn(false);
|
||||
MockIOSDevice ios = new MockIOSDevice();
|
||||
when(ios.isConnected()).thenReturn(false);
|
||||
ListenCommand command =
|
||||
new ListenCommand(android: android, ios: ios, singleRun: true);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
ListenCommand command = new ListenCommand(
|
||||
android: android, ios: ios, iosSim: iosSim, singleRun: true);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
|
||||
@@ -22,8 +22,11 @@ defineTests() {
|
||||
when(android.isConnected()).thenReturn(false);
|
||||
MockIOSDevice ios = new MockIOSDevice();
|
||||
when(ios.isConnected()).thenReturn(false);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
|
||||
LogsCommand command = new LogsCommand(android: android, ios: ios);
|
||||
LogsCommand command =
|
||||
new LogsCommand(android: android, ios: ios, iosSim: iosSim);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
|
||||
@@ -16,10 +16,17 @@ class MockIOSDevice extends Mock implements IOSDevice {
|
||||
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
||||
}
|
||||
|
||||
class MockIOSSimulator extends Mock implements IOSSimulator {
|
||||
@override
|
||||
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
||||
}
|
||||
|
||||
void applicationPackageSetup() {
|
||||
ApplicationPackageFactory.srcPath = './';
|
||||
ApplicationPackageFactory.setBuildPath(
|
||||
BuildType.prebuilt, BuildPlatform.android, './');
|
||||
ApplicationPackageFactory.setBuildPath(
|
||||
BuildType.prebuilt, BuildPlatform.iOS, './');
|
||||
ApplicationPackageFactory.setBuildPath(
|
||||
BuildType.prebuilt, BuildPlatform.iOSSimulator, './');
|
||||
}
|
||||
|
||||
@@ -28,9 +28,16 @@ defineTests() {
|
||||
when(ios.isConnected()).thenReturn(false);
|
||||
when(ios.installApp(any)).thenReturn(false);
|
||||
when(ios.startApp(any)).thenReturn(false);
|
||||
when(ios.startApp(any)).thenReturn(false);
|
||||
when(ios.stopApp(any)).thenReturn(false);
|
||||
|
||||
StartCommand command = new StartCommand(android: android, ios: ios);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
when(iosSim.installApp(any)).thenReturn(false);
|
||||
when(iosSim.startApp(any)).thenReturn(false);
|
||||
when(iosSim.stopApp(any)).thenReturn(false);
|
||||
|
||||
StartCommand command =
|
||||
new StartCommand(android: android, ios: ios, iosSim: iosSim);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
@@ -52,7 +59,14 @@ defineTests() {
|
||||
when(ios.startApp(any)).thenReturn(true);
|
||||
when(ios.stopApp(any)).thenReturn(false);
|
||||
|
||||
StartCommand command = new StartCommand(android: android, ios: ios);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
when(iosSim.installApp(any)).thenReturn(false);
|
||||
when(iosSim.startApp(any)).thenReturn(false);
|
||||
when(iosSim.stopApp(any)).thenReturn(false);
|
||||
|
||||
StartCommand command =
|
||||
new StartCommand(android: android, ios: ios, iosSim: iosSim);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
|
||||
@@ -26,7 +26,12 @@ defineTests() {
|
||||
when(ios.isConnected()).thenReturn(false);
|
||||
when(ios.stopApp(any)).thenReturn(false);
|
||||
|
||||
StopCommand command = new StopCommand(android: android, ios: ios);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
when(iosSim.stopApp(any)).thenReturn(false);
|
||||
|
||||
StopCommand command =
|
||||
new StopCommand(android: android, ios: ios, iosSim: iosSim);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
@@ -44,7 +49,12 @@ defineTests() {
|
||||
when(ios.isConnected()).thenReturn(true);
|
||||
when(ios.stopApp(any)).thenReturn(true);
|
||||
|
||||
StopCommand command = new StopCommand(android: android, ios: ios);
|
||||
MockIOSSimulator iosSim = new MockIOSSimulator();
|
||||
when(iosSim.isConnected()).thenReturn(false);
|
||||
when(iosSim.stopApp(any)).thenReturn(false);
|
||||
|
||||
StopCommand command =
|
||||
new StopCommand(android: android, ios: ios, iosSim: iosSim);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
|
||||
Reference in New Issue
Block a user