Search in sources :

Example 1 with AndroidRunConfigContext

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);
}
Also used : AndroidRunConfigContext(com.android.tools.idea.run.AndroidRunConfigContext) IDevice(com.android.ddmlib.IDevice) IOException(java.io.IOException) InstalledPatchCache(com.android.tools.idea.run.InstalledPatchCache) InstalledApkCache(com.android.tools.idea.run.InstalledApkCache) ShellCommandUnresponsiveException(com.android.ddmlib.ShellCommandUnresponsiveException) AdbCommandRejectedException(com.android.ddmlib.AdbCommandRejectedException) TimeUnit(java.util.concurrent.TimeUnit) TimeoutException(com.android.ddmlib.TimeoutException) Before(org.junit.Before)

Aggregations

AdbCommandRejectedException (com.android.ddmlib.AdbCommandRejectedException)1 IDevice (com.android.ddmlib.IDevice)1 ShellCommandUnresponsiveException (com.android.ddmlib.ShellCommandUnresponsiveException)1 TimeoutException (com.android.ddmlib.TimeoutException)1 AndroidRunConfigContext (com.android.tools.idea.run.AndroidRunConfigContext)1 InstalledApkCache (com.android.tools.idea.run.InstalledApkCache)1 InstalledPatchCache (com.android.tools.idea.run.InstalledPatchCache)1 IOException (java.io.IOException)1 TimeUnit (java.util.concurrent.TimeUnit)1 Before (org.junit.Before)1