use of com.facebook.buck.util.FakeProcessExecutor in project buck by facebook.
the class AppleSimulatorControllerTest method canStartSimulatorWhenNoSimulatorBooted.
@Test
public void canStartSimulatorWhenNoSimulatorBooted() throws IOException, InterruptedException {
ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(SIMCTL_LIST_PARAMS, new FakeProcess(0, " iPhone 5 (45BD7164-686C-474F-8C68-3730432BC5F2) (Shutdown)\n" + " iPhone 5s (70200ED8-EEF1-4BDB-BCCF-3595B137D67D) (Shutdown)\n", "")));
FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
AppleSimulatorController appleSimulatorController = new AppleSimulatorController(fakeProcessExecutor, SIMCTL_PATH, IOS_SIMULATOR_PATH);
assertThat(appleSimulatorController.canStartSimulator("45BD7164-686C-474F-8C68-3730432BC5F2"), is(true));
}
use of com.facebook.buck.util.FakeProcessExecutor in project buck by facebook.
the class AppleSimulatorControllerTest method canStartSimulatorWhenSimulatorAlreadyBooted.
@Test
public void canStartSimulatorWhenSimulatorAlreadyBooted() throws IOException, InterruptedException {
ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(SIMCTL_LIST_PARAMS, new FakeProcess(0, " iPhone 5 (45BD7164-686C-474F-8C68-3730432BC5F2) (Booted)\n" + " iPhone 5s (70200ED8-EEF1-4BDB-BCCF-3595B137D67D) (Shutdown)\n", "")));
FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
AppleSimulatorController appleSimulatorController = new AppleSimulatorController(fakeProcessExecutor, SIMCTL_PATH, IOS_SIMULATOR_PATH);
assertThat(appleSimulatorController.canStartSimulator("45BD7164-686C-474F-8C68-3730432BC5F2"), is(true));
}
use of com.facebook.buck.util.FakeProcessExecutor in project buck by facebook.
the class AppleSimulatorControllerTest method installingBundleInSimulatorWorks.
@Test
public void installingBundleInSimulatorWorks() throws IOException, InterruptedException {
FakeProcess fakeSimctlInstallProcess = new FakeProcess(0);
ProcessExecutorParams fakeSimctlInstallParams = ProcessExecutorParams.builder().setCommand(ImmutableList.of("path/to/simctl", "install", "70200ED8-EEF1-4BDB-BCCF-3595B137D67D", "Path/To/MyNeatApp.app")).build();
FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(ImmutableMap.of(fakeSimctlInstallParams, fakeSimctlInstallProcess));
AppleSimulatorController appleSimulatorController = new AppleSimulatorController(fakeProcessExecutor, SIMCTL_PATH, IOS_SIMULATOR_PATH);
boolean installed = appleSimulatorController.installBundleInSimulator("70200ED8-EEF1-4BDB-BCCF-3595B137D67D", Paths.get("Path/To/MyNeatApp.app"));
assertThat(installed, is(true));
}
use of com.facebook.buck.util.FakeProcessExecutor in project buck by facebook.
the class AppleSimulatorControllerTest method cannotStartSimulatorWhenSimulatorWithDifferentUdidExists.
@Test
public void cannotStartSimulatorWhenSimulatorWithDifferentUdidExists() throws IOException, InterruptedException {
ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(SIMCTL_LIST_PARAMS, new FakeProcess(0, " iPhone 5 (45BD7164-686C-474F-8C68-3730432BC5F2) (Booted)\n" + " iPhone 5s (70200ED8-EEF1-4BDB-BCCF-3595B137D67D) (Shutdown)\n", "")));
FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
AppleSimulatorController appleSimulatorController = new AppleSimulatorController(fakeProcessExecutor, SIMCTL_PATH, IOS_SIMULATOR_PATH);
assertThat(appleSimulatorController.canStartSimulator("70200ED8-EEF1-4BDB-BCCF-3595B137D67D"), is(false));
}
use of com.facebook.buck.util.FakeProcessExecutor in project buck by facebook.
the class AppleSimulatorControllerTest method startingSimulatorWorksWhenSimulatorNotRunning.
@Test
public void startingSimulatorWorksWhenSimulatorNotRunning() throws IOException, InterruptedException {
ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(SIMCTL_LIST_PARAMS, new FakeProcess(0)));
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(ProcessExecutorParams.builder().setCommand(ImmutableList.of("open", "-a", IOS_SIMULATOR_PATH.toString(), "--args", "-CurrentDeviceUDID", "70200ED8-EEF1-4BDB-BCCF-3595B137D67D")).build(), new FakeProcess(0)));
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(SIMCTL_LIST_PARAMS, new FakeProcess(0, " iPhone 5 (45BD7164-686C-474F-8C68-3730432BC5F2) (Shutdown)\n" + " iPhone 5s (70200ED8-EEF1-4BDB-BCCF-3595B137D67D) (Booted)\n", "")));
FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
AppleSimulatorController appleSimulatorController = new AppleSimulatorController(fakeProcessExecutor, SIMCTL_PATH, IOS_SIMULATOR_PATH);
Optional<Long> result = appleSimulatorController.startSimulator("70200ED8-EEF1-4BDB-BCCF-3595B137D67D", 1000);
assertThat(result, is(Optional.of(0L)));
}
Aggregations