use of com.android.tools.idea.run.AndroidRunConfigContext in project android by JetBrains.
the class InstantRunBuilderTest method setUp.
@Before
public void setUp() throws Exception {
myDevice = mock(IDevice.class);
when(myDevice.getSerialNumber()).thenReturn("device1-serial");
myInstalledPatchCache = new InstalledPatchCache();
myInstantRunContext = mock(InstantRunContext.class);
when(myInstantRunContext.getInstantRunBuildInfo()).thenReturn(InstantRunBuildInfo.get(BUILD_INFO)).thenReturn(InstantRunBuildInfo.get(BUILD_INFO_RELOAD_DEX));
when(myInstantRunContext.getApplicationId()).thenReturn(APPLICATION_ID);
when(myInstantRunContext.getInstalledPatchCache()).thenReturn(myInstalledPatchCache);
myRunConfigContext = new AndroidRunConfigContext();
myRunConfigContext.setTargetDevices(DeviceFutures.forDevices(Collections.singletonList(myDevice)));
myTasksProvider = mock(InstantRunTasksProvider.class);
when(myTasksProvider.getFullBuildTasks()).thenReturn(ASSEMBLE_TASKS);
when(myTasksProvider.getCleanAndGenerateSourcesTasks()).thenReturn(CLEAN_TASKS);
myInstalledApkCache = new InstalledApkCache() {
@Override
protected String executeShellCommand(@NotNull IDevice device, @NotNull String cmd, long timeout, @NotNull TimeUnit timeUnit) throws TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, IOException, InterruptedException {
return myDumpsysPackageOutput;
}
};
myApk = FileUtil.createTempFile("foo", "apk");
myTaskRunner = new RecordingTaskRunner();
myInstantRunClientDelegate = createInstantRunClientDelegate();
myBuilder = new InstantRunBuilder(myDevice, myInstantRunContext, myRunConfigContext, myTasksProvider, false, myInstalledApkCache, myInstantRunClientDelegate);
}
Aggregations