Search in sources :

Example 6 with ApkBuildStep

use of com.google.idea.blaze.android.run.runner.ApkBuildStep in project intellij by bazelbuild.

the class BlazeAndroidBinaryApplicationIdProviderTest method getApplicationId.

@Test
public void getApplicationId() throws Exception {
    ParsedManifest manifest = new ParsedManifest("package.name", ImmutableList.of(), null);
    BlazeAndroidDeployInfo deployInfo = new BlazeAndroidDeployInfo(manifest, null, ImmutableList.of());
    ApkBuildStep mockBuildStep = mock(ApkBuildStep.class);
    when(mockBuildStep.getDeployInfo()).thenReturn(deployInfo);
    BlazeAndroidBinaryApplicationIdProvider provider = new BlazeAndroidBinaryApplicationIdProvider(mockBuildStep);
    assertThat(provider.getPackageName()).isEqualTo("package.name");
}
Also used : ParsedManifest(com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest) ApkBuildStep(com.google.idea.blaze.android.run.runner.ApkBuildStep) BlazeAndroidDeployInfo(com.google.idea.blaze.android.run.deployinfo.BlazeAndroidDeployInfo) Test(org.junit.Test)

Example 7 with ApkBuildStep

use of com.google.idea.blaze.android.run.runner.ApkBuildStep in project intellij by bazelbuild.

the class BlazeAndroidBinaryApplicationIdProviderTest method getApplicationId_noPackageNameInMergedManifest.

@Test
public void getApplicationId_noPackageNameInMergedManifest() throws Exception {
    ParsedManifest manifest = new ParsedManifest(null, ImmutableList.of(), null);
    BlazeAndroidDeployInfo deployInfo = new BlazeAndroidDeployInfo(manifest, null, ImmutableList.of());
    ApkBuildStep mockBuildStep = mock(ApkBuildStep.class);
    when(mockBuildStep.getDeployInfo()).thenReturn(deployInfo);
    BlazeAndroidBinaryApplicationIdProvider provider = new BlazeAndroidBinaryApplicationIdProvider(mockBuildStep);
    try {
        provider.getPackageName();
        fail();
    } catch (ApkProvisionException ex) {
    // An exception should be thrown if the package name is not available because it's a
    // serious error and should not fail silently.
    }
}
Also used : ParsedManifest(com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest) ApkBuildStep(com.google.idea.blaze.android.run.runner.ApkBuildStep) ApkProvisionException(com.android.tools.idea.run.ApkProvisionException) BlazeAndroidDeployInfo(com.google.idea.blaze.android.run.deployinfo.BlazeAndroidDeployInfo) Test(org.junit.Test)

Example 8 with ApkBuildStep

use of com.google.idea.blaze.android.run.runner.ApkBuildStep in project intellij by bazelbuild.

the class BlazeAndroidTestApplicationIdProviderTest method getPackageName.

@Test
public void getPackageName() throws Exception {
    BlazeAndroidDeployInfo deployInfo = new BlazeAndroidDeployInfo(stubManifest("test.package.name"), stubManifest("package.name"), ImmutableList.of());
    ApkBuildStep mockBuildStep = mock(ApkBuildStep.class);
    when(mockBuildStep.getDeployInfo()).thenReturn(deployInfo);
    BlazeAndroidTestApplicationIdProvider provider = new BlazeAndroidTestApplicationIdProvider(mockBuildStep);
    assertThat(provider.getPackageName()).isEqualTo("package.name");
}
Also used : ApkBuildStep(com.google.idea.blaze.android.run.runner.ApkBuildStep) BlazeAndroidDeployInfo(com.google.idea.blaze.android.run.deployinfo.BlazeAndroidDeployInfo) Test(org.junit.Test)

Aggregations

ApkBuildStep (com.google.idea.blaze.android.run.runner.ApkBuildStep)8 BlazeAndroidDeployInfo (com.google.idea.blaze.android.run.deployinfo.BlazeAndroidDeployInfo)7 Test (org.junit.Test)7 ApkProvisionException (com.android.tools.idea.run.ApkProvisionException)3 ParsedManifest (com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest)2 BlazeAndroidBinaryMobileInstallRunContext (com.google.idea.blaze.android.run.binary.mobileinstall.BlazeAndroidBinaryMobileInstallRunContext)1 BlazeAndroidRunConfigurationRunner (com.google.idea.blaze.android.run.runner.BlazeAndroidRunConfigurationRunner)1 BlazeAndroidRunContext (com.google.idea.blaze.android.run.runner.BlazeAndroidRunContext)1 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)1 BlazeCommandRunConfiguration (com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)1 ExecutionException (com.intellij.execution.ExecutionException)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1