1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.appsecurity.cts; 18 19 import static org.junit.Assert.assertNotNull; 20 21 import android.platform.test.annotations.AppModeFull; 22 import android.platform.test.annotations.AppModeInstant; 23 import android.platform.test.annotations.Presubmit; 24 25 import com.android.compatibility.common.util.CpuFeatures; 26 import com.android.tradefed.device.DeviceNotAvailableException; 27 import com.android.tradefed.testtype.Abi; 28 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; 29 import com.android.tradefed.testtype.IAbi; 30 import com.android.tradefed.util.AbiUtils; 31 32 import org.junit.After; 33 import org.junit.Assume; 34 import org.junit.Before; 35 import org.junit.Test; 36 import org.junit.runner.RunWith; 37 38 import java.io.FileNotFoundException; 39 import java.util.HashMap; 40 import java.util.Set; 41 42 /** 43 * Tests that verify installing of various split APKs from host side. 44 */ 45 @Presubmit 46 @RunWith(DeviceJUnit4ClassRunner.class) 47 public class SplitTests extends BaseAppSecurityTest { 48 static final String PKG_NO_RESTART = "com.android.cts.norestart"; 49 static final String APK_NO_RESTART_BASE = "CtsNoRestartBase.apk"; 50 static final String APK_NO_RESTART_FEATURE = "CtsNoRestartFeature.apk"; 51 52 static final String APK_NEED_SPLIT_BASE = "CtsNeedSplitApp.apk"; 53 static final String APK_NEED_SPLIT_FEATURE_WARM = "CtsNeedSplitFeatureWarm.apk"; 54 static final String APK_NEED_SPLIT_CONFIG = "CtsNeedSplitApp_xxhdpi-v4.apk"; 55 56 static final String APK_REQUIRED_SPLIT_TYPE_BASE = "CtsRequiredSplitTypeSplitApp.apk"; 57 static final String APK_REQUIRED_SPLIT_TYPE_BASE_UPDATED = 58 "CtsRequiredSplitTypeSplitAppUpdated.apk"; 59 static final String APK_REQUIRED_SPLIT_TYPE_DENSITY = "CtsSplitAppTypeDensity.apk"; 60 static final String APK_REQUIRED_SPLIT_TYPE_LOCALE = "CtsSplitAppTypeLocale.apk"; 61 static final String APK_REQUIRED_SPLIT_TYPE_FOO = "CtsSplitAppTypeFoo.apk"; 62 static final String APK_REQUIRED_SPLIT_TYPE_MULTIPLE = "CtsSplitAppTypeMultiple.apk"; 63 static final String APK_REQUIRED_SPLIT_TYPE_FEATURE = "CtsSplitAppTypeFeature.apk"; 64 static final String APK_REQUIRED_SPLIT_TYPE_FEATURE_DATA = "CtsSplitAppTypeFeatureData.apk"; 65 static final String APK_REQUIRED_SPLIT_TYPE_FEATURE_FOO = "CtsSplitAppTypeFeatureFoo.apk"; 66 static final String APK_INVALID_REQUIRED_SPLIT_TYPE_BASE = 67 "CtsInvalidRequiredSplitTypeSplitApp.apk"; 68 69 static final String PKG = "com.android.cts.splitapp"; 70 static final String CLASS = PKG + ".SplitAppTest"; 71 72 static final String APK = "CtsSplitApp.apk"; 73 74 static final String APK_mdpi = "CtsSplitApp_mdpi-v4.apk"; 75 static final String APK_hdpi = "CtsSplitApp_hdpi-v4.apk"; 76 static final String APK_xhdpi = "CtsSplitApp_xhdpi-v4.apk"; 77 static final String APK_xxhdpi = "CtsSplitApp_xxhdpi-v4.apk"; 78 79 private static final String APK_v7 = "CtsSplitApp_v7.apk"; 80 private static final String APK_v23 = "CtsSplitApp_v23.apk"; 81 private static final String APK_fr = "CtsSplitApp_fr.apk"; 82 private static final String APK_de = "CtsSplitApp_de.apk"; 83 84 private static final String APK_x86 = "CtsSplitApp_x86.apk"; 85 private static final String APK_x86_64 = "CtsSplitApp_x86_64.apk"; 86 private static final String APK_armeabi_v7a = "CtsSplitApp_armeabi-v7a.apk"; 87 private static final String APK_armeabi = "CtsSplitApp_armeabi.apk"; 88 private static final String APK_arm64_v8a = "CtsSplitApp_arm64-v8a.apk"; 89 private static final String APK_mips64 = "CtsSplitApp_mips64.apk"; 90 private static final String APK_mips = "CtsSplitApp_mips.apk"; 91 92 private static final String APK_NUMBER_PROVIDER_A = "CtsSplitApp_number_provider_a.apk"; 93 private static final String APK_NUMBER_PROVIDER_B = "CtsSplitApp_number_provider_b.apk"; 94 private static final String APK_NUMBER_PROXY = "CtsSplitApp_number_proxy.apk"; 95 96 private static final String APK_DIFF_REVISION = "CtsSplitAppDiffRevision.apk"; 97 private static final String APK_DIFF_REVISION_v7 = "CtsSplitAppDiffRevision_v7.apk"; 98 99 private static final String APK_DIFF_VERSION = "CtsSplitAppDiffVersion.apk"; 100 private static final String APK_DIFF_VERSION_v7 = "CtsSplitAppDiffVersion_v7.apk"; 101 102 private static final String APK_DIFF_CERT = "CtsSplitAppDiffCert.apk"; 103 private static final String APK_DIFF_CERT_v7 = "CtsSplitAppDiffCert_v7.apk"; 104 105 private static final String APK_FEATURE_WARM = "CtsSplitAppFeatureWarm.apk"; 106 private static final String APK_FEATURE_WARM_v7 = "CtsSplitAppFeatureWarm_v7.apk"; 107 private static final String APK_FEATURE_WARM_v23 = "CtsSplitAppFeatureWarm_v23.apk"; 108 109 private static final String APK_FEATURE_ROSE = "CtsSplitAppFeatureRose.apk"; 110 private static final String APK_FEATURE_ROSE_v23 = "CtsSplitAppFeatureRose_v23.apk"; 111 112 private static final String APK_REVISION_A = "CtsSplitAppRevisionA.apk"; 113 private static final String APK_FEATURE_WARM_REVISION_A = "CtsSplitAppFeatureWarmRevisionA.apk"; 114 115 // Apk includes a provider and service declared in other split apk. And only could be tested in 116 // instant app mode. 117 static final String APK_INSTANT = "CtsSplitInstantApp.apk"; 118 119 static final HashMap<String, String> ABI_TO_APK = new HashMap<>(); 120 static final HashMap<String, String> ABI_TO_REVISION_APK = new HashMap<>(); 121 122 static { 123 ABI_TO_APK.put("x86", APK_x86); 124 ABI_TO_APK.put("x86_64", APK_x86_64); 125 ABI_TO_APK.put("armeabi-v7a", APK_armeabi_v7a); 126 ABI_TO_APK.put("armeabi", APK_armeabi); 127 ABI_TO_APK.put("arm64-v8a", APK_arm64_v8a); 128 ABI_TO_APK.put("mips64", APK_mips64); 129 ABI_TO_APK.put("mips", APK_mips); 130 131 ABI_TO_REVISION_APK.put("x86", "CtsSplitApp_revision12_x86.apk"); 132 ABI_TO_REVISION_APK.put("x86_64", "CtsSplitApp_revision12_x86_64.apk"); 133 ABI_TO_REVISION_APK.put("armeabi-v7a", "CtsSplitApp_revision12_armeabi-v7a.apk"); 134 ABI_TO_REVISION_APK.put("armeabi", "CtsSplitApp_revision12_armeabi.apk"); 135 ABI_TO_REVISION_APK.put("arm64-v8a", "CtsSplitApp_revision12_arm64-v8a.apk"); 136 ABI_TO_REVISION_APK.put("mips64", "CtsSplitApp_revision12_mips64.apk"); 137 ABI_TO_REVISION_APK.put("mips", "CtsSplitApp_revision12_mips.apk"); 138 } 139 140 @Before setUp()141 public void setUp() throws Exception { 142 Utils.prepareSingleUser(getDevice()); 143 getDevice().uninstallPackage(PKG); 144 getDevice().uninstallPackage(PKG_NO_RESTART); 145 } 146 147 @After tearDown()148 public void tearDown() throws Exception { 149 getDevice().uninstallPackage(PKG); 150 getDevice().uninstallPackage(PKG_NO_RESTART); 151 } 152 153 @Test 154 @AppModeFull(reason = "'full' portion of the hostside test") testSingleBase_full()155 public void testSingleBase_full() throws Exception { 156 testSingleBase(false); 157 } 158 @Test 159 @AppModeInstant(reason = "'instant' portion of the hostside test") testSingleBase_instant()160 public void testSingleBase_instant() throws Exception { 161 testSingleBase(true); 162 } testSingleBase(boolean instant)163 private void testSingleBase(boolean instant) throws Exception { 164 new InstallMultiple(instant).addFile(APK).run(); 165 runDeviceTests(PKG, CLASS, "testSingleBase"); 166 } 167 168 @Test 169 @AppModeFull(reason = "'full' portion of the hostside test") testDensitySingle_full()170 public void testDensitySingle_full() throws Exception { 171 testDensitySingle(false); 172 } 173 @Test 174 @AppModeInstant(reason = "'instant' portion of the hostside test") testDensitySingle_instant()175 public void testDensitySingle_instant() throws Exception { 176 testDensitySingle(true); 177 } testDensitySingle(boolean instant)178 private void testDensitySingle(boolean instant) throws Exception { 179 new InstallMultiple(instant).addFile(APK).addFile(APK_mdpi).run(); 180 runDeviceTests(PKG, CLASS, "testDensitySingle"); 181 } 182 183 @Test 184 @AppModeFull(reason = "'full' portion of the hostside test") testDensityAll_full()185 public void testDensityAll_full() throws Exception { 186 testDensityAll(false); 187 } 188 @Test 189 @AppModeInstant(reason = "'instant' portion of the hostside test") testDensityAll_instant()190 public void testDensityAll_instant() throws Exception { 191 testDensityAll(true); 192 } testDensityAll(boolean instant)193 private void testDensityAll(boolean instant) throws Exception { 194 new InstallMultiple(instant).addFile(APK).addFile(APK_mdpi).addFile(APK_hdpi).addFile(APK_xhdpi) 195 .addFile(APK_xxhdpi).run(); 196 runDeviceTests(PKG, CLASS, "testDensityAll"); 197 } 198 199 /** 200 * Install first with low-resolution resources, then add a split that offers 201 * higher-resolution resources. 202 */ 203 @Test 204 @AppModeFull(reason = "'full' portion of the hostside test") testDensityBest_full()205 public void testDensityBest_full() throws Exception { 206 testDensityBest(false); 207 } 208 @Test 209 @AppModeInstant(reason = "'instant' portion of the hostside test") testDensityBest_instant()210 public void testDensityBest_instant() throws Exception { 211 testDensityBest(true); 212 } testDensityBest(boolean instant)213 private void testDensityBest(boolean instant) throws Exception { 214 new InstallMultiple(instant).addFile(APK).addFile(APK_mdpi).run(); 215 runDeviceTests(PKG, CLASS, "testDensityBest1"); 216 217 // Now splice in an additional split which offers better resources 218 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_xxhdpi).run(); 219 runDeviceTests(PKG, CLASS, "testDensityBest2"); 220 } 221 222 /** 223 * Verify that an API-based split can change enabled/disabled state of 224 * manifest elements. 225 */ 226 @Test 227 @AppModeFull(reason = "'full' portion of the hostside test") testApi_full()228 public void testApi_full() throws Exception { 229 testApi(false); 230 } 231 @Test 232 @AppModeInstant(reason = "'instant' portion of the hostside test") testApi_instant()233 public void testApi_instant() throws Exception { 234 testApi(true); 235 } testApi(boolean instant)236 private void testApi(boolean instant) throws Exception { 237 new InstallMultiple(instant).addFile(APK).addFile(APK_v7).run(); 238 runDeviceTests(PKG, CLASS, "testApi"); 239 } 240 241 @Test 242 @AppModeFull(reason = "'full' portion of the hostside test") testLocale_full()243 public void testLocale_full() throws Exception { 244 testLocale(false); 245 } 246 @Test 247 @AppModeInstant(reason = "'instant' portion of the hostside test") testLocale_instant()248 public void testLocale_instant() throws Exception { 249 testLocale(true); 250 } testLocale(boolean instant)251 private void testLocale(boolean instant) throws Exception { 252 new InstallMultiple(instant).addFile(APK).addFile(APK_de).addFile(APK_fr).run(); 253 runDeviceTests(PKG, CLASS, "testLocale"); 254 } 255 256 /** 257 * Install test app with <em>single</em> split that exactly matches the 258 * currently active ABI. This also explicitly forces ABI when installing. 259 */ 260 @Test 261 @AppModeFull(reason = "'full' portion of the hostside test") testNativeSingle_full()262 public void testNativeSingle_full() throws Exception { 263 testNativeSingle(false, false); 264 } 265 @Test 266 @AppModeInstant(reason = "'instant' portion of the hostside test") testNativeSingle_instant()267 public void testNativeSingle_instant() throws Exception { 268 testNativeSingle(true, false); 269 } 270 getInstallMultiple(boolean instant, boolean useNaturalAbi)271 private InstallMultiple getInstallMultiple(boolean instant, boolean useNaturalAbi) { 272 final InstallMultiple installMultiple = new InstallMultiple(instant); 273 if (useNaturalAbi) { 274 return installMultiple.useNaturalAbi(); 275 } 276 return installMultiple; 277 } 278 testNativeSingle(boolean instant, boolean useNaturalAbi)279 private void testNativeSingle(boolean instant, boolean useNaturalAbi) throws Exception { 280 final String abi = getAbi().getName(); 281 final String apk = ABI_TO_APK.get(abi); 282 final String revisionApk = ABI_TO_REVISION_APK.get(abi); 283 assertNotNull("Failed to find APK for ABI " + abi, apk); 284 285 getInstallMultiple(instant, useNaturalAbi).addFile(APK).addFile(apk).run(); 286 runDeviceTests(PKG, CLASS, "testNative"); 287 runDeviceTests(PKG, CLASS, "testNativeRevision_sub_shouldImplementBadly"); 288 getInstallMultiple(instant, useNaturalAbi).inheritFrom(PKG).addFile(revisionApk).run(); 289 runDeviceTests(PKG, CLASS, "testNativeRevision_sub_shouldImplementWell"); 290 291 getInstallMultiple(instant, useNaturalAbi).inheritFrom(PKG) 292 .addFile(APK_NUMBER_PROVIDER_A) 293 .addFile(APK_NUMBER_PROVIDER_B) 294 .addFile(APK_NUMBER_PROXY).run(); 295 runDeviceTests(PKG, CLASS, "testNative_getNumberADirectly_shouldBeSeven"); 296 runDeviceTests(PKG, CLASS, "testNative_getNumberAViaProxy_shouldBeSeven"); 297 runDeviceTests(PKG, CLASS, "testNative_getNumberBDirectly_shouldBeEleven"); 298 runDeviceTests(PKG, CLASS, "testNative_getNumberBViaProxy_shouldBeEleven"); 299 } 300 301 @Test 302 @AppModeFull(reason = "'full' portion of the hostside test") testNativeSplitForEachSupportedAbi_full()303 public void testNativeSplitForEachSupportedAbi_full() throws Exception { 304 testNativeForEachSupportedAbi(false); 305 } 306 307 @Test 308 @AppModeInstant(reason = "'instant' portion of the hostside test") testNativeSplitForEachSupportedAbi_instant()309 public void testNativeSplitForEachSupportedAbi_instant() throws Exception { 310 testNativeForEachSupportedAbi(true); 311 } 312 313 specifyAbiToTest(boolean instant, String abiListProperty, String testMethodName)314 private void specifyAbiToTest(boolean instant, String abiListProperty, String testMethodName) 315 throws FileNotFoundException, DeviceNotAvailableException { 316 final String propertyAbiListValue = getDevice().getProperty(abiListProperty); 317 final Set<String> supportedAbiSet = 318 AbiUtils.parseAbiListFromProperty(propertyAbiListValue); 319 for (String abi : supportedAbiSet) { 320 String apk = ABI_TO_APK.get(abi); 321 new InstallMultiple(instant, true).inheritFrom(PKG).addFile(apk).run(); 322 323 // Without specifying abi for executing "adb shell am", 324 // a UnsatisfiedLinkError will happen. 325 IAbi iAbi = new Abi(abi, AbiUtils.getBitness(abi)); 326 setAbi(iAbi); 327 runDeviceTests(PKG, CLASS, testMethodName); 328 } 329 } 330 testNativeForEachSupportedAbi(boolean instant)331 private void testNativeForEachSupportedAbi(boolean instant) 332 throws DeviceNotAvailableException, FileNotFoundException { 333 new InstallMultiple(instant, true).addFile(APK).run(); 334 335 // make sure this device can run both 32 bit and 64 bit 336 specifyAbiToTest(instant, "ro.product.cpu.abilist64", "testNative64Bit"); 337 specifyAbiToTest(instant, "ro.product.cpu.abilist32", "testNative32Bit"); 338 } 339 340 /** 341 * Install test app with <em>single</em> split that exactly matches the 342 * currently active ABI. This variant <em>does not</em> force the ABI when 343 * installing, instead exercising the system's ability to choose the ABI 344 * through inspection of the installed app. 345 */ 346 @Test 347 @AppModeFull(reason = "'full' portion of the hostside test") testNativeSingleNatural_full()348 public void testNativeSingleNatural_full() throws Exception { 349 testNativeSingle(false, true); 350 } 351 @Test 352 @AppModeInstant(reason = "'instant' portion of the hostside test") testNativeSingleNatural_instant()353 public void testNativeSingleNatural_instant() throws Exception { 354 testNativeSingle(true, true); 355 } 356 assumeNativeAbi()357 private void assumeNativeAbi() throws Exception { 358 // Skip this test if not running on the device's native abi. 359 Assume.assumeTrue(CpuFeatures.isNativeAbi(getDevice(), getAbi().getName())); 360 } 361 /** 362 * Install test app with <em>all</em> possible ABI splits. This also 363 * explicitly forces ABI when installing. 364 */ 365 @Test 366 @AppModeFull(reason = "'full' portion of the hostside test") testNativeAll_full()367 public void testNativeAll_full() throws Exception { 368 assumeNativeAbi(); 369 testNativeAll(false, false); 370 } 371 @Test 372 @AppModeInstant(reason = "'instant' portion of the hostside test") testNativeAll_instant()373 public void testNativeAll_instant() throws Exception { 374 testNativeAll(true, false); 375 } testNativeAll(boolean instant, boolean useNaturalAbi)376 private void testNativeAll(boolean instant, boolean useNaturalAbi) throws Exception { 377 final InstallMultiple inst = getInstallMultiple(instant, useNaturalAbi).addFile(APK); 378 for (String apk : ABI_TO_APK.values()) { 379 inst.addFile(apk); 380 } 381 inst.run(); 382 runDeviceTests(PKG, CLASS, "testNative"); 383 runDeviceTests(PKG, CLASS, "testNativeRevision_sub_shouldImplementBadly"); 384 385 final InstallMultiple instInheritFrom = 386 getInstallMultiple(instant, useNaturalAbi).inheritFrom(PKG); 387 for (String apk : ABI_TO_REVISION_APK.values()) { 388 instInheritFrom.addFile(apk); 389 } 390 instInheritFrom.addFile(APK_NUMBER_PROVIDER_A); 391 instInheritFrom.addFile(APK_NUMBER_PROVIDER_B); 392 instInheritFrom.addFile(APK_NUMBER_PROXY); 393 instInheritFrom.run(); 394 runDeviceTests(PKG, CLASS, "testNativeRevision_sub_shouldImplementWell"); 395 396 runDeviceTests(PKG, CLASS, "testNative_getNumberADirectly_shouldBeSeven"); 397 runDeviceTests(PKG, CLASS, "testNative_getNumberAViaProxy_shouldBeSeven"); 398 runDeviceTests(PKG, CLASS, "testNative_getNumberBDirectly_shouldBeEleven"); 399 runDeviceTests(PKG, CLASS, "testNative_getNumberBViaProxy_shouldBeEleven"); 400 } 401 402 /** 403 * Install test app with <em>all</em> possible ABI splits. This variant 404 * <em>does not</em> force the ABI when installing, instead exercising the 405 * system's ability to choose the ABI through inspection of the installed 406 * app. 407 */ 408 @Test 409 @AppModeFull(reason = "'full' portion of the hostside test") testNativeAllNatural_full()410 public void testNativeAllNatural_full() throws Exception { 411 assumeNativeAbi(); 412 testNativeAll(false, true); 413 } 414 @Test 415 @AppModeInstant(reason = "'instant' portion of the hostside test") testNativeAllNatural_instant()416 public void testNativeAllNatural_instant() throws Exception { 417 testNativeAll(true, true); 418 } 419 420 @Test 421 @AppModeFull(reason = "'full' portion of the hostside test") testDuplicateBase_full()422 public void testDuplicateBase_full() throws Exception { 423 testDuplicateBase(false); 424 } 425 @Test 426 @AppModeInstant(reason = "'instant' portion of the hostside test") testDuplicateBase_instant()427 public void testDuplicateBase_instant() throws Exception { 428 testDuplicateBase(true); 429 } testDuplicateBase(boolean instant)430 private void testDuplicateBase(boolean instant) throws Exception { 431 new InstallMultiple(instant).addFile(APK).addFile(APK).runExpectingFailure(); 432 } 433 434 @Test 435 @AppModeFull(reason = "'full' portion of the hostside test") testDuplicateSplit_full()436 public void testDuplicateSplit_full() throws Exception { 437 testDuplicateSplit(false); 438 } 439 @Test 440 @AppModeInstant(reason = "'instant' portion of the hostside test") testDuplicateSplit_instant()441 public void testDuplicateSplit_instant() throws Exception { 442 testDuplicateSplit(true); 443 } testDuplicateSplit(boolean instant)444 private void testDuplicateSplit(boolean instant) throws Exception { 445 new InstallMultiple(instant).addFile(APK).addFile(APK_v7).addFile(APK_v7).runExpectingFailure(); 446 } 447 448 @Test 449 @AppModeFull(reason = "'full' portion of the hostside test") testDiffCert_full()450 public void testDiffCert_full() throws Exception { 451 testDiffCert(false); 452 } 453 @Test 454 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffCert_instant()455 public void testDiffCert_instant() throws Exception { 456 testDiffCert(true); 457 } testDiffCert(boolean instant)458 private void testDiffCert(boolean instant) throws Exception { 459 new InstallMultiple(instant).addFile(APK).addFile(APK_DIFF_CERT_v7).runExpectingFailure(); 460 } 461 462 @Test 463 @AppModeFull(reason = "'full' portion of the hostside test") testDiffCertInherit_full()464 public void testDiffCertInherit_full() throws Exception { 465 testDiffCertInherit(false); 466 } 467 @Test 468 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffCertInherit_instant()469 public void testDiffCertInherit_instant() throws Exception { 470 testDiffCertInherit(true); 471 } testDiffCertInherit(boolean instant)472 private void testDiffCertInherit(boolean instant) throws Exception { 473 new InstallMultiple(instant).addFile(APK).run(); 474 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_DIFF_CERT_v7).runExpectingFailure(); 475 } 476 477 @Test 478 @AppModeFull(reason = "'full' portion of the hostside test") testDiffVersion_full()479 public void testDiffVersion_full() throws Exception { 480 testDiffVersion(false); 481 } 482 @Test 483 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffVersion_instant()484 public void testDiffVersion_instant() throws Exception { 485 testDiffVersion(true); 486 } testDiffVersion(boolean instant)487 private void testDiffVersion(boolean instant) throws Exception { 488 new InstallMultiple(instant).addFile(APK).addFile(APK_DIFF_VERSION_v7).runExpectingFailure(); 489 } 490 491 @Test 492 @AppModeFull(reason = "'full' portion of the hostside test") testDiffVersionInherit_full()493 public void testDiffVersionInherit_full() throws Exception { 494 testDiffVersionInherit(false); 495 } 496 @Test 497 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffVersionInherit_instant()498 public void testDiffVersionInherit_instant() throws Exception { 499 testDiffVersionInherit(true); 500 } testDiffVersionInherit(boolean instant)501 private void testDiffVersionInherit(boolean instant) throws Exception { 502 new InstallMultiple(instant).addFile(APK).run(); 503 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_DIFF_VERSION_v7).runExpectingFailure(); 504 } 505 506 @Test 507 @AppModeFull(reason = "'full' portion of the hostside test") testDiffRevision_full()508 public void testDiffRevision_full() throws Exception { 509 testDiffRevision(false); 510 } 511 @Test 512 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffRevision_instant()513 public void testDiffRevision_instant() throws Exception { 514 testDiffRevision(true); 515 } testDiffRevision(boolean instant)516 private void testDiffRevision(boolean instant) throws Exception { 517 new InstallMultiple(instant).addFile(APK).addFile(APK_DIFF_REVISION_v7).run(); 518 runDeviceTests(PKG, CLASS, "testRevision0_12"); 519 } 520 521 @Test 522 @AppModeFull(reason = "'full' portion of the hostside test") testDiffRevisionInheritBase_full()523 public void testDiffRevisionInheritBase_full() throws Exception { 524 testDiffRevisionInheritBase(false); 525 } 526 @Test 527 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffRevisionInheritBase_instant()528 public void testDiffRevisionInheritBase_instant() throws Exception { 529 testDiffRevisionInheritBase(true); 530 } testDiffRevisionInheritBase(boolean instant)531 private void testDiffRevisionInheritBase(boolean instant) throws Exception { 532 new InstallMultiple(instant).addFile(APK).addFile(APK_v7).run(); 533 runDeviceTests(PKG, CLASS, "testRevision0_0"); 534 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_DIFF_REVISION_v7).run(); 535 runDeviceTests(PKG, CLASS, "testRevision0_12"); 536 } 537 538 @Test 539 @AppModeFull(reason = "'full' portion of the hostside test") testDiffRevisionInheritSplit_full()540 public void testDiffRevisionInheritSplit_full() throws Exception { 541 testDiffRevisionInheritSplit(false); 542 } 543 @Test 544 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffRevisionInheritSplit_instant()545 public void testDiffRevisionInheritSplit_instant() throws Exception { 546 testDiffRevisionInheritSplit(true); 547 } testDiffRevisionInheritSplit(boolean instant)548 private void testDiffRevisionInheritSplit(boolean instant) throws Exception { 549 new InstallMultiple(instant).addFile(APK).addFile(APK_v7).run(); 550 runDeviceTests(PKG, CLASS, "testRevision0_0"); 551 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_DIFF_REVISION).run(); 552 runDeviceTests(PKG, CLASS, "testRevision12_0"); 553 } 554 555 @Test 556 @AppModeFull(reason = "'full' portion of the hostside test") testDiffRevisionDowngrade_full()557 public void testDiffRevisionDowngrade_full() throws Exception { 558 testDiffRevisionDowngrade(false); 559 } 560 @Test 561 @AppModeInstant(reason = "'instant' portion of the hostside test") testDiffRevisionDowngrade_instant()562 public void testDiffRevisionDowngrade_instant() throws Exception { 563 testDiffRevisionDowngrade(true); 564 } testDiffRevisionDowngrade(boolean instant)565 private void testDiffRevisionDowngrade(boolean instant) throws Exception { 566 new InstallMultiple(instant).addFile(APK).addFile(APK_DIFF_REVISION_v7).run(); 567 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_v7).runExpectingFailure(); 568 } 569 570 @Test 571 @AppModeFull(reason = "'full' portion of the hostside test") testFeatureWarmBase_full()572 public void testFeatureWarmBase_full() throws Exception { 573 testFeatureWarmBase(false); 574 } 575 @Test 576 @AppModeInstant(reason = "'instant' portion of the hostside test") testFeatureWarmBase_instant()577 public void testFeatureWarmBase_instant() throws Exception { 578 testFeatureWarmBase(true); 579 } testFeatureWarmBase(boolean instant)580 private void testFeatureWarmBase(boolean instant) throws Exception { 581 new InstallMultiple(instant).addFile(APK).addFile(APK_FEATURE_WARM).run(); 582 runDeviceTests(PKG, CLASS, "testFeatureWarmBase"); 583 } 584 585 @Test 586 @AppModeFull(reason = "'full' portion of the hostside test") testFeatureWarmApi_full()587 public void testFeatureWarmApi_full() throws Exception { 588 testFeatureWarmApi(false); 589 } 590 @Test 591 @AppModeInstant(reason = "'instant' portion of the hostside test") testFeatureWarmApi_instant()592 public void testFeatureWarmApi_instant() throws Exception { 593 testFeatureWarmApi(true); 594 } testFeatureWarmApi(boolean instant)595 private void testFeatureWarmApi(boolean instant) throws Exception { 596 new InstallMultiple(instant).addFile(APK).addFile(APK_FEATURE_WARM) 597 .addFile(APK_FEATURE_WARM_v7).run(); 598 runDeviceTests(PKG, CLASS, "testFeatureWarmApi"); 599 } 600 601 @Test 602 @AppModeFull(reason = "'full' portion of the hostside test") testInheritUpdatedBase_full()603 public void testInheritUpdatedBase_full() throws Exception { 604 testInheritUpdatedBase(false); 605 } 606 @Test 607 @AppModeInstant(reason = "'instant' portion of the hostside test") testInheritUpdatedBase_instant()608 public void testInheritUpdatedBase_instant() throws Exception { 609 testInheritUpdatedBase(true); 610 } testInheritUpdatedBase(boolean instant)611 public void testInheritUpdatedBase(boolean instant) throws Exception { 612 new InstallMultiple(instant).addFile(APK).addFile(APK_FEATURE_WARM).run(); 613 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_REVISION_A).run(); 614 runDeviceTests(PKG, CLASS, "testInheritUpdatedBase_withRevisionA", instant); 615 } 616 617 @Test 618 @AppModeFull(reason = "'full' portion of the hostside test") testInheritUpdatedSplit_full()619 public void testInheritUpdatedSplit_full() throws Exception { 620 testInheritUpdatedSplit(false); 621 } 622 @Test 623 @AppModeInstant(reason = "'instant' portion of the hostside test") testInheritUpdatedSplit_instant()624 public void testInheritUpdatedSplit_instant() throws Exception { 625 testInheritUpdatedSplit(true); 626 } testInheritUpdatedSplit(boolean instant)627 private void testInheritUpdatedSplit(boolean instant) throws Exception { 628 new InstallMultiple(instant).addFile(APK).addFile(APK_FEATURE_WARM).run(); 629 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_FEATURE_WARM_REVISION_A).run(); 630 runDeviceTests(PKG, CLASS, "testInheritUpdatedSplit_withRevisionA", instant); 631 } 632 633 @Test 634 @AppModeFull(reason = "'full' portion of the hostside test") testFeatureWithoutRestart_full()635 public void testFeatureWithoutRestart_full() throws Exception { 636 testFeatureWithoutRestart(false); 637 } 638 @Test 639 @AppModeInstant(reason = "'instant' portion of the hostside test") testFeatureWithoutRestart_instant()640 public void testFeatureWithoutRestart_instant() throws Exception { 641 testFeatureWithoutRestart(true); 642 } testFeatureWithoutRestart(boolean instant)643 private void testFeatureWithoutRestart(boolean instant) throws Exception { 644 // always install as a full app; we're testing that the instant app can be 645 // updated without restarting and need a broadcast receiver to ensure the 646 // correct behaviour. So, this component must be visible to instant apps. 647 new InstallMultiple().addFile(APK).run(); 648 649 new InstallMultiple(instant).addFile(APK_NO_RESTART_BASE).run(); 650 runDeviceTests(PKG, CLASS, "testBaseInstalled", instant); 651 new InstallMultiple(instant) 652 .addArg("--dont-kill") 653 .inheritFrom(PKG_NO_RESTART) 654 .addFile(APK_NO_RESTART_FEATURE) 655 .run(); 656 runDeviceTests(PKG, CLASS, "testFeatureInstalled", instant); 657 } 658 659 @Test 660 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitMissing_full()661 public void testRequiredSplitMissing_full() throws Exception { 662 testRequiredSplitMissing(false); 663 } 664 @Test 665 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitMissing_instant()666 public void testRequiredSplitMissing_instant() throws Exception { 667 testRequiredSplitMissing(true); 668 } testRequiredSplitMissing(boolean instant)669 private void testRequiredSplitMissing(boolean instant) throws Exception { 670 new InstallMultiple(instant).addFile(APK_NEED_SPLIT_BASE) 671 .runExpectingFailure("INSTALL_FAILED_MISSING_SPLIT"); 672 } 673 674 @Test 675 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitInstalledFeatureWarm_full()676 public void testRequiredSplitInstalledFeatureWarm_full() throws Exception { 677 testRequiredSplitInstalledFeatureWarm(false); 678 } 679 @Test 680 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitInstalledFeatureWarm_instant()681 public void testRequiredSplitInstalledFeatureWarm_instant() throws Exception { 682 testRequiredSplitInstalledFeatureWarm(true); 683 } testRequiredSplitInstalledFeatureWarm(boolean instant)684 private void testRequiredSplitInstalledFeatureWarm(boolean instant) throws Exception { 685 new InstallMultiple(instant).addFile(APK_NEED_SPLIT_BASE) 686 .addFile(APK_NEED_SPLIT_FEATURE_WARM).run(); 687 } 688 689 @Test 690 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitInstalledConfig_full()691 public void testRequiredSplitInstalledConfig_full() throws Exception { 692 testRequiredSplitInstalledConfig(false); 693 } 694 @Test 695 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitInstalledConfig_instant()696 public void testRequiredSplitInstalledConfig_instant() throws Exception { 697 testRequiredSplitInstalledConfig(true); 698 } testRequiredSplitInstalledConfig(boolean instant)699 private void testRequiredSplitInstalledConfig(boolean instant) throws Exception { 700 new InstallMultiple(instant).addFile(APK_NEED_SPLIT_BASE).addFile(APK_NEED_SPLIT_CONFIG) 701 .run(); 702 } 703 704 @Test 705 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitRemoved_full()706 public void testRequiredSplitRemoved_full() throws Exception { 707 testRequiredSplitRemoved(false); 708 } 709 @Test 710 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitRemoved_instant()711 public void testRequiredSplitRemoved_instant() throws Exception { 712 testRequiredSplitRemoved(true); 713 } testRequiredSplitRemoved(boolean instant)714 private void testRequiredSplitRemoved(boolean instant) throws Exception { 715 // start with a base and two splits 716 new InstallMultiple(instant) 717 .addFile(APK_NEED_SPLIT_BASE) 718 .addFile(APK_NEED_SPLIT_FEATURE_WARM) 719 .addFile(APK_NEED_SPLIT_CONFIG) 720 .run(); 721 // it's okay to remove one of the splits 722 new InstallMultiple(instant).inheritFrom(PKG).removeSplit("feature_warm").run(); 723 // but, not to remove all of them 724 new InstallMultiple(instant).inheritFrom(PKG).removeSplit("config.xxhdpi") 725 .runExpectingFailure("INSTALL_FAILED_MISSING_SPLIT"); 726 } 727 728 @Test 729 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitTypesInstalledIncomplete_full()730 public void testRequiredSplitTypesInstalledIncomplete_full() throws Exception { 731 testRequiredSplitTypesInstalledIncomplete(false); 732 } 733 @Test 734 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitTypesInstalledIncomplete_instant()735 public void testRequiredSplitTypesInstalledIncomplete_instant() throws Exception { 736 testRequiredSplitTypesInstalledIncomplete(true); 737 } testRequiredSplitTypesInstalledIncomplete(boolean instant)738 private void testRequiredSplitTypesInstalledIncomplete(boolean instant) throws Exception { 739 new InstallMultiple(instant).addFile(APK_REQUIRED_SPLIT_TYPE_BASE) 740 .addFile(APK_REQUIRED_SPLIT_TYPE_LOCALE) 741 .runExpectingFailure("INSTALL_FAILED_MISSING_SPLIT"); 742 } 743 744 @Test 745 @AppModeFull(reason = "'full' portion of the hostside test") testInvalidRequiredSplitTypes_full()746 public void testInvalidRequiredSplitTypes_full() throws Exception { 747 testInvalidRequiredSplitTypes(false); 748 } 749 @Test 750 @AppModeInstant(reason = "'instant' portion of the hostside test") testInvalidRequiredSplitTypes_instant()751 public void testInvalidRequiredSplitTypes_instant() throws Exception { 752 testInvalidRequiredSplitTypes(true); 753 } testInvalidRequiredSplitTypes(boolean instant)754 private void testInvalidRequiredSplitTypes(boolean instant) throws Exception { 755 new InstallMultiple(instant).addFile(APK_INVALID_REQUIRED_SPLIT_TYPE_BASE) 756 .runExpectingFailure("INSTALL_PARSE_FAILED_MANIFEST_MALFORMED"); 757 } 758 759 @Test 760 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitTypesInstalledAll_full()761 public void testRequiredSplitTypesInstalledAll_full() throws Exception { 762 testRequiredSplitTypesInstalledAll(false); 763 } 764 @Test 765 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitTypesInstalledAll_instant()766 public void testRequiredSplitTypesInstalledAll_instant() throws Exception { 767 testRequiredSplitTypesInstalledAll(true); 768 } testRequiredSplitTypesInstalledAll(boolean instant)769 private void testRequiredSplitTypesInstalledAll(boolean instant) throws Exception { 770 new InstallMultiple(instant).addFile(APK_REQUIRED_SPLIT_TYPE_BASE) 771 .addFile(APK_REQUIRED_SPLIT_TYPE_DENSITY) 772 .addFile(APK_REQUIRED_SPLIT_TYPE_LOCALE) 773 .run(); 774 } 775 776 @Test 777 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitTypesInstalledMultipleOne_full()778 public void testRequiredSplitTypesInstalledMultipleOne_full() throws Exception { 779 testRequiredSplitTypesInstalledMultipleOne(false); 780 } 781 @Test 782 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitTypesInstalledMultipleOne_instant()783 public void testRequiredSplitTypesInstalledMultipleOne_instant() throws Exception { 784 testRequiredSplitTypesInstalledMultipleOne(true); 785 } testRequiredSplitTypesInstalledMultipleOne(boolean instant)786 private void testRequiredSplitTypesInstalledMultipleOne(boolean instant) throws Exception { 787 new InstallMultiple(instant).addFile(APK_REQUIRED_SPLIT_TYPE_BASE) 788 .addFile(APK_REQUIRED_SPLIT_TYPE_MULTIPLE) 789 .run(); 790 } 791 792 @Test 793 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitTypesRemoved_full()794 public void testRequiredSplitTypesRemoved_full() throws Exception { 795 testRequiredSplitTypesRemoved(false); 796 } 797 @Test 798 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitTypesRemoved_instant()799 public void testRequiredSplitTypesRemoved_instant() throws Exception { 800 testRequiredSplitTypesRemoved(true); 801 } testRequiredSplitTypesRemoved(boolean instant)802 private void testRequiredSplitTypesRemoved(boolean instant) throws Exception { 803 // start with a base and three splits 804 new InstallMultiple(instant) 805 .addFile(APK_REQUIRED_SPLIT_TYPE_BASE) 806 .addFile(APK_REQUIRED_SPLIT_TYPE_DENSITY) 807 .addFile(APK_REQUIRED_SPLIT_TYPE_LOCALE) 808 .addFile(APK_REQUIRED_SPLIT_TYPE_FOO) 809 .run(); 810 // it's okay to remove non-required split type 811 new InstallMultiple(instant).inheritFrom(PKG).removeSplit("config.foo").run(); 812 // but, not to remove a required one 813 new InstallMultiple(instant).inheritFrom(PKG).removeSplit("config.de") 814 .runExpectingFailure("INSTALL_FAILED_MISSING_SPLIT"); 815 } 816 817 @Test 818 @AppModeFull(reason = "'full' portion of the hostside test") testInheritUpdatedBase_requiredSplitTypesMissing_full()819 public void testInheritUpdatedBase_requiredSplitTypesMissing_full() throws Exception { 820 testInheritUpdatedBase_requiredSplitTypesMissing(false); 821 } 822 @Test 823 @AppModeInstant(reason = "'instant' portion of the hostside test") testInheritUpdatedBase_requiredSplitTypesMissing_instant()824 public void testInheritUpdatedBase_requiredSplitTypesMissing_instant() throws Exception { 825 testInheritUpdatedBase_requiredSplitTypesMissing(true); 826 } testInheritUpdatedBase_requiredSplitTypesMissing(boolean instant)827 private void testInheritUpdatedBase_requiredSplitTypesMissing(boolean instant) 828 throws Exception { 829 // start with a base and the required splits 830 new InstallMultiple(instant) 831 .addFile(APK_REQUIRED_SPLIT_TYPE_BASE) 832 .addFile(APK_REQUIRED_SPLIT_TYPE_DENSITY) 833 .addFile(APK_REQUIRED_SPLIT_TYPE_LOCALE) 834 .run(); 835 // the updated base requires a new split type, but it's missing 836 new InstallMultiple(instant).inheritFrom(PKG).addFile(APK_REQUIRED_SPLIT_TYPE_BASE_UPDATED) 837 .runExpectingFailure("INSTALL_FAILED_MISSING_SPLIT"); 838 } 839 840 @Test 841 @AppModeFull(reason = "'full' portion of the hostside test") testInheritUpdatedBase_requiredSplitTypesInstalled_full()842 public void testInheritUpdatedBase_requiredSplitTypesInstalled_full() throws Exception { 843 testInheritUpdatedBase_requiredSplitTypesInstalled(false); 844 } 845 @Test 846 @AppModeInstant(reason = "'instant' portion of the hostside test") testInheritUpdatedBase_requiredSplitTypesInstalled_instant()847 public void testInheritUpdatedBase_requiredSplitTypesInstalled_instant() throws Exception { 848 testInheritUpdatedBase_requiredSplitTypesInstalled(true); 849 } testInheritUpdatedBase_requiredSplitTypesInstalled(boolean instant)850 private void testInheritUpdatedBase_requiredSplitTypesInstalled(boolean instant) 851 throws Exception { 852 // start with a base and the required splits 853 new InstallMultiple(instant) 854 .addFile(APK_REQUIRED_SPLIT_TYPE_BASE) 855 .addFile(APK_REQUIRED_SPLIT_TYPE_DENSITY) 856 .addFile(APK_REQUIRED_SPLIT_TYPE_LOCALE) 857 .run(); 858 // the updated base requires a split type, and this split also requires another. 859 new InstallMultiple(instant).inheritFrom(PKG) 860 .addFile(APK_REQUIRED_SPLIT_TYPE_BASE_UPDATED) 861 .addFile(APK_REQUIRED_SPLIT_TYPE_FEATURE) 862 .addFile(APK_REQUIRED_SPLIT_TYPE_FEATURE_DATA) 863 .run(); 864 } 865 866 @Test 867 @AppModeFull(reason = "'full' portion of the hostside test") testRequiredSplitTypesFromSplit_full()868 public void testRequiredSplitTypesFromSplit_full() throws Exception { 869 testRequiredSplitTypesFromSplit(false); 870 } 871 @Test 872 @AppModeInstant(reason = "'instant' portion of the hostside test") testRequiredSplitTypesFromSplit_instant()873 public void testRequiredSplitTypesFromSplit_instant() throws Exception { 874 testRequiredSplitTypesFromSplit(true); 875 } testRequiredSplitTypesFromSplit(boolean instant)876 private void testRequiredSplitTypesFromSplit(boolean instant) throws Exception { 877 new InstallMultiple(instant) 878 .addFile(APK_REQUIRED_SPLIT_TYPE_BASE) 879 .addFile(APK_REQUIRED_SPLIT_TYPE_DENSITY) 880 .addFile(APK_REQUIRED_SPLIT_TYPE_LOCALE) 881 .addFile(APK_REQUIRED_SPLIT_TYPE_FEATURE) 882 .addFile(APK_REQUIRED_SPLIT_TYPE_FEATURE_DATA) 883 .addFile(APK_REQUIRED_SPLIT_TYPE_FEATURE_FOO) 884 .run(); 885 // it's okay to remove non-required split type for the split 886 new InstallMultiple(instant).inheritFrom(PKG).removeSplit("feature_foo.foo").run(); 887 // but, not to remove a required one for the split 888 new InstallMultiple(instant).inheritFrom(PKG).removeSplit("feature_foo.data") 889 .runExpectingFailure("INSTALL_FAILED_MISSING_SPLIT"); 890 } 891 892 /** 893 * Verify that installing a new version of app wipes code cache. 894 */ 895 @Test 896 @AppModeFull(reason = "'full' portion of the hostside test") testClearCodeCache_full()897 public void testClearCodeCache_full() throws Exception { 898 testClearCodeCache(false); 899 } 900 @Test 901 @AppModeInstant(reason = "'instant' portion of the hostside test") testClearCodeCache_instant()902 public void testClearCodeCache_instant() throws Exception { 903 testClearCodeCache(true); 904 } testClearCodeCache(boolean instant)905 private void testClearCodeCache(boolean instant) throws Exception { 906 new InstallMultiple(instant).addFile(APK).run(); 907 runDeviceTests(PKG, CLASS, "testCodeCacheWrite"); 908 new InstallMultiple(instant).addArg("-r").addFile(APK_DIFF_VERSION).run(); 909 runDeviceTests(PKG, CLASS, "testCodeCacheRead"); 910 } 911 912 @Test 913 @AppModeInstant(reason = "'instant' portion of the hostside test") testComponentWithSplitName_instant()914 public void testComponentWithSplitName_instant() throws Exception { 915 new InstallMultiple(true).addFile(APK_INSTANT).run(); 916 runDeviceTests(PKG, CLASS, "testComponentWithSplitName_singleBase"); 917 new InstallMultiple(true).inheritFrom(PKG).addFile(APK_FEATURE_WARM).run(); 918 runDeviceTests(PKG, CLASS, "testComponentWithSplitName_featureWarmInstalled"); 919 } 920 921 @Test 922 @AppModeFull(reason = "'full' portion of the hostside test") testTheme_installBase_full()923 public void testTheme_installBase_full() throws Exception { 924 testTheme_installBase(false); 925 } 926 @Test 927 @AppModeInstant(reason = "'instant' portion of the hostside test") testTheme_installBase_instant()928 public void testTheme_installBase_instant() throws Exception { 929 testTheme_installBase(true); 930 } testTheme_installBase(boolean instant)931 private void testTheme_installBase(boolean instant) throws Exception { 932 new InstallMultiple(instant).addFile(APK).run(); 933 runDeviceTests(PKG, CLASS, "launchBaseActivity_withThemeBase_baseApplied"); 934 } 935 936 @Test 937 @AppModeFull(reason = "'full' portion of the hostside test") testTheme_installBaseV23_full()938 public void testTheme_installBaseV23_full() throws Exception { 939 testTheme_installBaseV23(false); 940 } 941 @Test 942 @AppModeInstant(reason = "'instant' portion of the hostside test") testTheme_installBaseV23_instant()943 public void testTheme_installBaseV23_instant() throws Exception { 944 testTheme_installBaseV23(true); 945 } testTheme_installBaseV23(boolean instant)946 private void testTheme_installBaseV23(boolean instant) throws Exception { 947 new InstallMultiple(instant).addFile(APK).addFile(APK_v23).run(); 948 runDeviceTests(PKG, CLASS, "launchBaseActivity_withThemeBaseLt_baseLtApplied"); 949 } 950 951 @Test 952 @AppModeFull(reason = "'full' portion of the hostside test") testTheme_installFeatureWarm_full()953 public void testTheme_installFeatureWarm_full() throws Exception { 954 testTheme_installFeatureWarm(false); 955 } 956 @Test 957 @AppModeInstant(reason = "'instant' portion of the hostside test") testTheme_installFeatureWarm_instant()958 public void testTheme_installFeatureWarm_instant() throws Exception { 959 testTheme_installFeatureWarm(true); 960 } testTheme_installFeatureWarm(boolean instant)961 private void testTheme_installFeatureWarm(boolean instant) throws Exception { 962 new InstallMultiple(instant).addFile(APK).addFile(APK_FEATURE_WARM).run(); 963 runDeviceTests(PKG, CLASS, "launchBaseActivity_withThemeWarm_warmApplied"); 964 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeBase_baseApplied"); 965 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeWarm_warmApplied"); 966 } 967 968 @Test 969 @AppModeFull(reason = "'full' portion of the hostside test") testTheme_installFeatureWarmV23_full()970 public void testTheme_installFeatureWarmV23_full() throws Exception { 971 testTheme_installFeatureWarmV23(false); 972 } 973 @Test 974 @AppModeInstant(reason = "'instant' portion of the hostside test") testTheme_installFeatureWarmV23_instant()975 public void testTheme_installFeatureWarmV23_instant() throws Exception { 976 testTheme_installFeatureWarmV23(true); 977 } testTheme_installFeatureWarmV23(boolean instant)978 private void testTheme_installFeatureWarmV23(boolean instant) throws Exception { 979 new InstallMultiple(instant).addFile(APK).addFile(APK_v23).addFile(APK_FEATURE_WARM) 980 .addFile(APK_FEATURE_WARM_v23).run(); 981 runDeviceTests(PKG, CLASS, "launchBaseActivity_withThemeWarmLt_warmLtApplied"); 982 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeBaseLt_baseLtApplied"); 983 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeWarmLt_warmLtApplied"); 984 } 985 986 @Test 987 @AppModeFull(reason = "'full' portion of the hostside test") testTheme_installFeatureWarmV23_removeV23_full()988 public void testTheme_installFeatureWarmV23_removeV23_full() throws Exception { 989 testTheme_installFeatureWarmV23_removeV23(false); 990 } 991 @Test 992 @AppModeInstant(reason = "'instant' portion of the hostside test") testTheme_installFeatureWarmV23_removeV23_instant()993 public void testTheme_installFeatureWarmV23_removeV23_instant() throws Exception { 994 testTheme_installFeatureWarmV23_removeV23(true); 995 } testTheme_installFeatureWarmV23_removeV23(boolean instant)996 private void testTheme_installFeatureWarmV23_removeV23(boolean instant) throws Exception { 997 new InstallMultiple(instant).addFile(APK).addFile(APK_v23).addFile(APK_FEATURE_WARM) 998 .addFile(APK_FEATURE_WARM_v23).run(); 999 new InstallMultiple(instant).inheritFrom(PKG).removeSplit("config.v23") 1000 .removeSplit("feature_warm.config.v23").run(); 1001 runDeviceTests(PKG, CLASS, "launchBaseActivity_withThemeWarm_warmApplied"); 1002 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeBase_baseApplied"); 1003 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeWarm_warmApplied"); 1004 } 1005 1006 @Test 1007 @AppModeFull(reason = "'full' portion of the hostside test") testTheme_installFeatureWarmAndRose_full()1008 public void testTheme_installFeatureWarmAndRose_full() throws Exception { 1009 testTheme_installFeatureWarmAndRose(false); 1010 } 1011 @Test 1012 @AppModeInstant(reason = "'instant' portion of the hostside test") testTheme_installFeatureWarmAndRose_instant()1013 public void testTheme_installFeatureWarmAndRose_instant() throws Exception { 1014 testTheme_installFeatureWarmAndRose(true); 1015 } testTheme_installFeatureWarmAndRose(boolean instant)1016 private void testTheme_installFeatureWarmAndRose(boolean instant) throws Exception { 1017 new InstallMultiple(instant).addFile(APK).addFile(APK_FEATURE_WARM) 1018 .addFile(APK_FEATURE_ROSE).run(); 1019 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeWarm_warmApplied"); 1020 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeRose_roseApplied"); 1021 runDeviceTests(PKG, CLASS, "launchRoseActivity_withThemeWarm_warmApplied"); 1022 runDeviceTests(PKG, CLASS, "launchRoseActivity_withThemeRose_roseApplied"); 1023 } 1024 1025 @Test 1026 @AppModeFull(reason = "'full' portion of the hostside test") testTheme_installFeatureWarmAndRoseV23_full()1027 public void testTheme_installFeatureWarmAndRoseV23_full() throws Exception { 1028 testTheme_installFeatureWarmAndRoseV23(false); 1029 } 1030 @Test 1031 @AppModeInstant(reason = "'instant' portion of the hostside test") testTheme_installFeatureWarmAndRoseV23_instant()1032 public void testTheme_installFeatureWarmAndRoseV23_instant() throws Exception { 1033 testTheme_installFeatureWarmAndRoseV23(true); 1034 } testTheme_installFeatureWarmAndRoseV23(boolean instant)1035 private void testTheme_installFeatureWarmAndRoseV23(boolean instant) throws Exception { 1036 new InstallMultiple(instant).addFile(APK).addFile(APK_v23) 1037 .addFile(APK_FEATURE_WARM).addFile(APK_FEATURE_WARM_v23) 1038 .addFile(APK_FEATURE_ROSE).addFile(APK_FEATURE_ROSE_v23).run(); 1039 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeWarmLt_warmLtApplied"); 1040 runDeviceTests(PKG, CLASS, "launchWarmActivity_withThemeRoseLt_roseLtApplied"); 1041 runDeviceTests(PKG, CLASS, "launchRoseActivity_withThemeWarmLt_warmLtApplied"); 1042 runDeviceTests(PKG, CLASS, "launchRoseActivity_withThemeRoseLt_roseLtApplied"); 1043 } 1044 } 1045