use of com.android.sdklib.internal.androidTarget.MockAddonTarget in project android by JetBrains.
the class AndroidVersionsInfoTest method withPlatformAndroidTarget.
/**
* For platform Android target versions, the Build API should be the same as the platform target
*/
@Test
public void withPlatformAndroidTarget() {
final MockPlatformTarget baseTarget = new MockPlatformTarget(DEFAULT_VERSION, 0);
MockAddonTarget projectTarget = new MockAddonTarget("google", baseTarget, 1);
AndroidVersionsInfo.VersionItem versionItem = myMockAndroidVersionsInfo.new VersionItem(projectTarget);
assertEquals(DEFAULT_VERSION, versionItem.getApiLevel());
assertEquals(DEFAULT_VERSION, versionItem.getBuildApiLevel());
}
use of com.android.sdklib.internal.androidTarget.MockAddonTarget in project android by JetBrains.
the class LaunchCompatibilityTest method testRequiredAddons.
public void testRequiredAddons() {
final AndroidVersion minSdkVersion = new AndroidVersion(8, null);
final EnumSet<IDevice.HardwareFeature> requiredFeatures = EnumSet.noneOf(IDevice.HardwareFeature.class);
// add-on target shouldn't affect anything if it doesn't have optional libraries
final MockPlatformTarget baseTarget = new MockPlatformTarget(14, 0);
MockAddonTarget projectTarget = new MockAddonTarget("google", baseTarget, 1);
LaunchCompatibility compatibility = LaunchCompatibility.canRunOnDevice(minSdkVersion, projectTarget, requiredFeatures, null, createMockDevice(8, null, false));
assertEquals(new LaunchCompatibility(ThreeState.YES, null), compatibility);
IAndroidTarget.OptionalLibrary optionalLibrary = mock(IAndroidTarget.OptionalLibrary.class);
projectTarget.setOptionalLibraries(ImmutableList.of(optionalLibrary));
// add-on targets with optional libraries should still be allowed to run on real devices (no avdinfo)
compatibility = LaunchCompatibility.canRunOnDevice(minSdkVersion, projectTarget, requiredFeatures, null, createMockDevice(8, null, false));
assertEquals(new LaunchCompatibility(ThreeState.UNSURE, "unsure if device supports addon: google"), compatibility);
// Google APIs add on should be treated as a special case and should always be allowed to run on a real device
MockAddonTarget googleApiTarget = new MockAddonTarget("Google APIs", baseTarget, 1);
googleApiTarget.setOptionalLibraries(ImmutableList.of(optionalLibrary));
compatibility = LaunchCompatibility.canRunOnDevice(minSdkVersion, googleApiTarget, requiredFeatures, null, createMockDevice(8, null, false));
assertEquals(new LaunchCompatibility(ThreeState.YES, null), compatibility);
}
Aggregations