diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-22 12:00:48 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-22 12:00:48 +0000 |
commit | c1660e326c71934b6f2dfa0bb675e83fc812d24b (patch) | |
tree | d57217935a50a23c02150a7c34a776eaaaa529a5 | |
parent | 62310a3fefa43f8eae1aede1c0ff32f17b8cfc87 (diff) | |
parent | f4dfd60836c81cdc2a8a7f4771c1144030a915c3 (diff) | |
download | cts-c1660e326c71934b6f2dfa0bb675e83fc812d24b.tar.gz |
Snap for 10545323 from f4dfd60836c81cdc2a8a7f4771c1144030a915c3 to mainline-media-releaseaml_med_340922010
Change-Id: Icd3b5d61b9c3fcde576795bbd79a00a19e02c559
43 files changed, 1152 insertions, 721 deletions
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml index 3f94b7be7d6..bbd50666b9d 100644 --- a/apps/CtsVerifier/AndroidManifest.xml +++ b/apps/CtsVerifier/AndroidManifest.xml @@ -419,7 +419,10 @@ <!-- Support service to ensure HID Device Test succeeds on devices with full screen pairing dialogs (ex. Android TV --> - <service android:name=".bluetooth.FocusLossPreventionService" /> + <service android:name=".bluetooth.FocusLossPreventionService" + android:foregroundServiceType="specialUse"> + <property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="CtsVerifier" /> + </service> <!-- CTS Verifier Bluetooth Hid Host Test Screen diff --git a/hostsidetests/securitybulletin/src/android/security/cts/CVE_2023_21272.java b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2023_21272.java new file mode 100644 index 00000000000..0c4f2a247fd --- /dev/null +++ b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2023_21272.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security.cts; + +import static org.junit.Assume.assumeNoException; + +import android.platform.test.annotations.AsbSecurityTest; + +import com.android.sts.common.tradefed.testtype.NonRootSecurityTestCase; +import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; + +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(DeviceJUnit4ClassRunner.class) +public class CVE_2023_21272 extends NonRootSecurityTestCase { + + // b/227471459 + // Vulnerable module : framework.jar + @AsbSecurityTest(cveBugId = 227471459) + @Test + public void testPocCVE_2023_21272() { + try { + final String testPkg = "android.security.cts.CVE_2023_21272_test"; + + // Install the helper app + installPackage("CVE-2023-21272-helper.apk"); + + // Install the test app + installPackage("CVE-2023-21272-test.apk"); + + // Run the test "testCVE_2023_21272" + runDeviceTests(testPkg, testPkg + ".DeviceTest", "testCVE_2023_21272"); + } catch (Exception e) { + assumeNoException(e); + } finally { + try { + // return to Home screen after test run + AdbUtils.runCommandLine("input keyevent KEYCODE_HOME", getDevice()); + } catch (Exception ignored) { + // ignore all exceptions + } + } + } +} diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/Android.bp new file mode 100644 index 00000000000..bc60c24804f --- /dev/null +++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/Android.bp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +android_test_helper_app { + name: "CVE-2023-21272-test", + srcs: [ + "test-app/src/**/*.java" + ], + test_suites: [ + "sts", + ], + manifest: "test-app/AndroidManifest.xml", + static_libs: [ + "androidx.test.core", + "androidx.test.rules", + ], + platform_apis: true, +} + +android_test_helper_app { + name: "CVE-2023-21272-helper", + test_suites: [ + "sts", + ], + srcs: [ + "helper-app/src/**/*.java" + ], + manifest: "helper-app/AndroidManifest.xml", +} diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/helper-app/AndroidManifest.xml b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/helper-app/AndroidManifest.xml new file mode 100644 index 00000000000..95ced3dadf2 --- /dev/null +++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/helper-app/AndroidManifest.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2023 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.security.cts.CVE_2023_21272_helper"> + <application> + <activity android:name=".PocActivity" + android:exported="true" /> + </application> +</manifest> diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/helper-app/src/android/security/cts/CVE_2023_21272_helper/PocActivity.java b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/helper-app/src/android/security/cts/CVE_2023_21272_helper/PocActivity.java new file mode 100644 index 00000000000..744cc75491a --- /dev/null +++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/helper-app/src/android/security/cts/CVE_2023_21272_helper/PocActivity.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security.cts.CVE_2023_21272_helper; + +import static android.content.pm.PackageManager.PERMISSION_GRANTED; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Process; + +public class PocActivity extends Activity { + @Override + protected void onResume() { + super.onResume(); + + // If current package has permission to 'downloads' authority then send broadcast + if (this.checkUriPermission( + Uri.parse("content://downloads/all_downloads"), + Process.myPid(), + Process.myUid(), + 0 /* modeFlags */) + == PERMISSION_GRANTED) { + sendBroadcast((getIntent().getParcelableExtra(Intent.EXTRA_INTENT))); + } + } +} diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/AndroidManifest.xml b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/AndroidManifest.xml new file mode 100644 index 00000000000..7afe63548f0 --- /dev/null +++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/AndroidManifest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2023 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.security.cts.CVE_2023_21272_test"> + <application> + <provider android:name=".TestProvider" + android:authorities="download" + android:grantUriPermissions="true" + android:enabled="true" /> + </application> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.security.cts.CVE_2023_21272_test" /> +</manifest> diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/src/android/security/cts/CVE_2023_21272_test/DeviceTest.java b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/src/android/security/cts/CVE_2023_21272_test/DeviceTest.java new file mode 100644 index 00000000000..39093765bf7 --- /dev/null +++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/src/android/security/cts/CVE_2023_21272_test/DeviceTest.java @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security.cts.CVE_2023_21272_test; + +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assume.assumeNoException; + +import android.app.ActivityManager; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.Uri; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Constructor; +import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; + +@RunWith(AndroidJUnit4.class) +public class DeviceTest { + + @Test + public void testCVE_2023_21272() { + try { + Context context = getInstrumentation().getContext(); + + // 'Path', 'PathPart', and 'HierarchicalUri' classes are in default scope of Uri.java. + // Hence, reflection is used to access their APIs + final String targetPkg = "android.security.cts.CVE_2023_21272_helper"; + Class partClass = Class.forName("android.net.Uri$Part"); + Constructor partConstructor = + partClass.getDeclaredConstructor(String.class, String.class); + partConstructor.setAccessible(true); + + Class pathPartClass = Class.forName("android.net.Uri$PathPart"); + Constructor pathPartConstructor = + pathPartClass.getDeclaredConstructor(String.class, String.class); + pathPartConstructor.setAccessible(true); + + Class hierarchicalUriClass = Class.forName("android.net.Uri$HierarchicalUri"); + Constructor hierarchicalUriConstructor = + hierarchicalUriClass.getDeclaredConstructor( + String.class, partClass, pathPartClass, partClass, partClass); + hierarchicalUriConstructor.setAccessible(true); + + final String testAuthority = "download"; + Object authority = partConstructor.newInstance(testAuthority, testAuthority); + final String testPath = "s/all_downloads"; + Object path = pathPartConstructor.newInstance(testPath, testPath); + Uri testUri = + (Uri) + hierarchicalUriConstructor.newInstance( + "content", + authority, + path, + null /* query */, + null /* fragment */); + Semaphore broadcastReceived = new Semaphore(0); + final String broadcastAction = "CVE_2023_21272_broadcastAction"; + + // Register a broadcast receiver to receive broadcast from PocActivity indicating + // presence of vulnerability + BroadcastReceiver broadcastReceiver = + new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + try { + if (intent.getAction().equals(broadcastAction)) { + broadcastReceived.release(); + } + } catch (Exception ignored) { + // ignore any exceptions + } + } + }; + + context.registerReceiver(broadcastReceiver, new IntentFilter(broadcastAction)); + + // Grant read uri permission to 'targetPkg' for 'testUri' + ActivityManager.getService() + .grantUriPermission( + context.getIApplicationThread(), + targetPkg, + testUri, + Intent.FLAG_GRANT_READ_URI_PERMISSION, + context.getUserId()); + + // Check if the uri permission was granted to correct authority or not. Without fix, + // permission is granted to 'downloads' authority and the test fails + context.startActivity( + new Intent() + .setClassName(targetPkg, targetPkg + ".PocActivity") + .putExtra(Intent.EXTRA_INTENT, new Intent(broadcastAction)) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); + assertFalse( + "Vulnerable to b/227471459", + broadcastReceived.tryAcquire(5_000 /* waitMs */, TimeUnit.MILLISECONDS)); + } catch (Exception e) { + assumeNoException(e); + } + } +} diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/src/android/security/cts/CVE_2023_21272_test/TestProvider.java b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/src/android/security/cts/CVE_2023_21272_test/TestProvider.java new file mode 100644 index 00000000000..cb5f5757376 --- /dev/null +++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21272/test-app/src/android/security/cts/CVE_2023_21272_test/TestProvider.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security.cts.CVE_2023_21272_test; + +import android.content.ContentProvider; +import android.content.ContentValues; +import android.database.Cursor; +import android.net.Uri; + +public class TestProvider extends ContentProvider { + public TestProvider() {} + + @Override + public int delete(Uri uri, String selection, String[] selectionArgs) { + return 0; + } + + @Override + public String getType(Uri uri) { + return ""; + } + + @Override + public Uri insert(Uri uri, ContentValues values) { + return null; + } + + @Override + public boolean onCreate() { + return false; + } + + @Override + public Cursor query( + Uri uri, + String[] projection, + String selection, + String[] selectionArgs, + String sortOrder) { + return null; + } + + @Override + public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { + return 0; + } +} diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/DefaultSmsApplicationTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/DefaultSmsApplicationTest.java index 0947bafb2e0..4dfee59f22a 100644 --- a/tests/devicepolicy/src/android/devicepolicy/cts/DefaultSmsApplicationTest.java +++ b/tests/devicepolicy/src/android/devicepolicy/cts/DefaultSmsApplicationTest.java @@ -22,6 +22,7 @@ import static com.android.queryable.queries.IntentFilterQuery.intentFilter; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeTrue; import static org.testng.Assert.assertThrows; @@ -57,6 +58,8 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.runner.RunWith; +import java.util.Objects; + // TODO(b/198442101): Add tests for the COPE case when we can sideload system apps @RunWith(BedsteadJUnit4.class) public final class DefaultSmsApplicationTest { @@ -101,8 +104,7 @@ public final class DefaultSmsApplicationTest { mDpm.setManagedSubscriptionsPolicy(new ManagedSubscriptionsPolicy( ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS)); } - assumeTrue(mTelephonyManager.isSmsCapable() - || (mRoleManager != null && mRoleManager.isRoleAvailable(RoleManager.ROLE_SMS))); + assumeTrue(isSmsCapable()); String previousSmsAppName = getDefaultSmsPackage(); try (TestAppInstance smsApp = sSmsApp.install()) { mDpm.setDefaultSmsApplication(mAdmin, smsApp.packageName()); @@ -124,8 +126,7 @@ public final class DefaultSmsApplicationTest { Settings.Global.ALLOW_WORK_PROFILE_TELEPHONY_FOR_NON_DPM_ROLE_HOLDERS, value = "1") @EnsureHasPermission(INTERACT_ACROSS_USERS) public void setDefaultSmsApplication_unchanged() { - assumeTrue(mTelephonyManager.isSmsCapable() - || (mRoleManager != null && mRoleManager.isRoleAvailable(RoleManager.ROLE_SMS))); + assumeTrue(isSmsCapable()); //TODO(b/273529454): replace with EnsureTelephonyEnabledInUser annotation if (mDpm.isOrganizationOwnedDeviceWithManagedProfile()) { mDpm.setManagedSubscriptionsPolicy(new ManagedSubscriptionsPolicy( @@ -154,8 +155,7 @@ public final class DefaultSmsApplicationTest { @EnsureGlobalSettingSet(key = Settings.Global.ALLOW_WORK_PROFILE_TELEPHONY_FOR_NON_DPM_ROLE_HOLDERS, value = "1") public void setDefaultSmsApplication_smsPackageDoesNotExist_unchanged() { - assumeTrue(mTelephonyManager.isSmsCapable() - || (mRoleManager != null && mRoleManager.isRoleAvailable(RoleManager.ROLE_SMS))); + assumeTrue(isSmsCapable()); //TODO(b/273529454): replace with EnsureTelephonyEnabledInUser annotation if (mDpm.isOrganizationOwnedDeviceWithManagedProfile()) { mDpm.setManagedSubscriptionsPolicy(new ManagedSubscriptionsPolicy( @@ -191,15 +191,33 @@ public final class DefaultSmsApplicationTest { // TODO(b/198588696): Add support is @RequireSmsCapable and @RequireNotSmsCapable @Postsubmit(reason = "new test") @CanSetPolicyTest(policy = DefaultSmsApplication.class) + @EnsureGlobalSettingSet(key = + Settings.Global.ALLOW_WORK_PROFILE_TELEPHONY_FOR_NON_DPM_ROLE_HOLDERS, value = "1") public void setDefaultSmsApplication_notSmsCapable_unchanged() { - assumeTrue(!mTelephonyManager.isSmsCapable() - && (mRoleManager == null || !mRoleManager.isRoleAvailable(RoleManager.ROLE_SMS))); + assumeFalse(isSmsCapable()); + //TODO(b/273529454): replace with EnsureTelephonyEnabledInUser annotation + if (mDpm.isOrganizationOwnedDeviceWithManagedProfile()) { + mDpm.setManagedSubscriptionsPolicy(new ManagedSubscriptionsPolicy( + ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS)); + } String previousSmsAppName = getDefaultSmsPackage(); try (TestAppInstance smsApp = sSmsApp.install()) { + mDpm.setDefaultSmsApplication(mAdmin, smsApp.packageName()); - assertThat(getDefaultSmsPackage()).isEqualTo(previousSmsAppName); + + // ROLE_SMS behaviour(SmsRoleBehaviour.java) changes based on the + // ManagedSubscriptionsPolicy on the work profile, so asserting isSmsCapable here again + // to check that if device is actually smsCapable or else assert that default sms app + // does not changes. + assertThat(isSmsCapable() || Objects.equals(getDefaultSmsPackage(), + previousSmsAppName)).isTrue(); } finally { mDpm.setDefaultSmsApplication(mAdmin, previousSmsAppName); + //TODO(b/273529454): replace with EnsureTelephonyEnabledInUser annotation + if (mDpm.isOrganizationOwnedDeviceWithManagedProfile()) { + mDpm.setManagedSubscriptionsPolicy(new ManagedSubscriptionsPolicy( + ManagedSubscriptionsPolicy.TYPE_ALL_PERSONAL_SUBSCRIPTIONS)); + } } } @@ -232,4 +250,9 @@ public final class DefaultSmsApplicationTest { throw new RuntimeException(e); } } + + private boolean isSmsCapable() { + return mTelephonyManager.isSmsCapable() + || (mRoleManager != null && mRoleManager.isRoleAvailable(RoleManager.ROLE_SMS)); + } } diff --git a/tests/framework/base/windowmanager/src/android/server/wm/CompatScaleTests.java b/tests/framework/base/windowmanager/src/android/server/wm/CompatScaleTests.java index 7004d578bec..81973df61f6 100644 --- a/tests/framework/base/windowmanager/src/android/server/wm/CompatScaleTests.java +++ b/tests/framework/base/windowmanager/src/android/server/wm/CompatScaleTests.java @@ -70,6 +70,12 @@ import java.util.Arrays; */ @RunWith(Parameterized.class) public class CompatScaleTests extends ActivityManagerTestBase { + /** + * If application size is 1280, then Upscaling by 0.3 will make the surface 1280/0.3 = 4267. + * Some devices do not support this high resolution, so limiting Upscaling test case for + * scaling >= 0.35. + */ + public static float MAX_UPSCALING_TESTED = 0.35f; @Parameterized.Parameters(name = "{0}") public static Iterable<Object[]> data() { @@ -188,15 +194,17 @@ public class CompatScaleTests extends ActivityManagerTestBase { test_scalesCorrectly_inCompatDownscalingMode(); test_windowState_inCompatDownscalingMode(); - // Now launch the same activity with upscaling *enabled* and get the sizes it reports - // and its Window state. - try (var up = new CompatChangeCloseable("DOWNSCALED_INVERSE", PACKAGE_UNDER_TEST); - var session = new BaseActivitySessionCloseable(ACTIVITY_UNDER_TEST)) { - mAppSizesUpscaled = getActivityReportedSizes(); - mWindowStateUpscaled = getPackageWindowState(); + if (mCompatScale >= MAX_UPSCALING_TESTED) { + // Now launch the same activity with upscaling *enabled* and get the sizes it + // reports and its Window state. + try (var up = new CompatChangeCloseable("DOWNSCALED_INVERSE", PACKAGE_UNDER_TEST); + var session = new BaseActivitySessionCloseable(ACTIVITY_UNDER_TEST)) { + mAppSizesUpscaled = getActivityReportedSizes(); + mWindowStateUpscaled = getPackageWindowState(); + } + test_scalesCorrectly_inCompatUpscalingMode(); + test_windowState_inCompatUpscalingMode(); } - test_scalesCorrectly_inCompatUpscalingMode(); - test_windowState_inCompatUpscalingMode(); } } diff --git a/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/UiAutomationTestBase.kt b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/UiAutomationTestBase.kt index 68c997bdbd0..1b4ac4a6da6 100644 --- a/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/UiAutomationTestBase.kt +++ b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/UiAutomationTestBase.kt @@ -238,11 +238,16 @@ open class UiAutomationTestBase( } else { // First, select the device in the device chooser dialog. confirmationUi.waitAndClickOnFirstFoundDevice() - // Second, wait until the permissionList dialog shows up and scroll to the bottom. - confirmationUi.scrollToBottom() - // Third, tap the `Allow` bottom. - callback.assertInvokedByActions { - confirmationUi.waitUntilPositiveButtonIsEnabledAndClick() + // Do not need to click the positive button if the CDM dialog no longer exists at + // this point, which means the OS is running the older flow from udc-dev. + if (confirmationUi.isCdmDialogExists()) { + // Second, wait until the permissionList dialog shows up and scroll + // to the bottom. + confirmationUi.scrollToBottom() + // Third, tap the `Allow` bottom. + callback.assertInvokedByActions { + confirmationUi.waitUntilPositiveButtonIsEnabledAndClick() + } } } } else { diff --git a/tests/tests/companion/uicommon/src/android/companion/cts/uicommon/CompanionDeviceManagerUi.kt b/tests/tests/companion/uicommon/src/android/companion/cts/uicommon/CompanionDeviceManagerUi.kt index 2c3232b9a6b..64e53a82125 100644 --- a/tests/tests/companion/uicommon/src/android/companion/cts/uicommon/CompanionDeviceManagerUi.kt +++ b/tests/tests/companion/uicommon/src/android/companion/cts/uicommon/CompanionDeviceManagerUi.kt @@ -16,6 +16,8 @@ package android.companion.cts.uicommon +import android.os.SystemClock +import android.os.SystemClock.sleep import androidx.test.uiautomator.By import androidx.test.uiautomator.BySelector import androidx.test.uiautomator.SearchCondition @@ -47,9 +49,22 @@ open class CompanionDeviceManagerUi(private val ui: UiDevice) { fun waitUntilGone() = ui.waitShort(Until.gone(CONFIRMATION_UI), "CDM UI has not disappeared") - fun waitAndClickOnFirstFoundDevice() = ui.waitLongAndFind( - Until.findObject(DEVICE_LIST_WITH_ITEMS), "Device List not found or empty") - .children[0].click() + fun waitAndClickOnFirstFoundDevice() { + val firstDevice = ui.waitLongAndFind( + Until.findObject( + DEVICE_LIST_WITH_ITEMS), "The item in the Device List not found or empty") + .children[0] + + val startTime = SystemClock.uptimeMillis() + var elapsedTime = 0L + // Keep trying to click the first item in the list until the device_list is disappeared + // or it times out after 5s. + while (ui.hasObject(DEVICE_LIST) && elapsedTime < 5.seconds.inWholeMilliseconds) { + firstDevice.click() + SystemClock.sleep(0.2.seconds.inWholeMilliseconds) + elapsedTime = SystemClock.uptimeMillis() - startTime + } + } fun waitUntilPositiveButtonIsEnabledAndClick() = ui.waitLongAndFind( Until.findObject(POSITIVE_BUTTON), "Positive button not found or not clickable") @@ -84,6 +99,10 @@ open class CompanionDeviceManagerUi(private val ui: UiDevice) { } } + fun isCdmDialogExists(): Boolean { + return ui.wait(Until.hasObject(CONFIRMATION_UI), 2.seconds.inWholeMilliseconds) + } + protected fun click(selector: BySelector, description: String) = ui.waitShortAndFind( Until.findObject(selector), "$description is not found") .click() diff --git a/tests/tests/keystore/CtsKeystoreWycheproofTestConfig.xml b/tests/tests/keystore/CtsKeystoreWycheproofTestConfig.xml index 8e9eb319a48..1b02be7c1ba 100644 --- a/tests/tests/keystore/CtsKeystoreWycheproofTestConfig.xml +++ b/tests/tests/keystore/CtsKeystoreWycheproofTestConfig.xml @@ -27,7 +27,7 @@ <test class="com.android.tradefed.testtype.AndroidJUnitTest" > <option name="package" value="com.google.security.wycheproof" /> <option name="runtime-hint" value="17m" /> - <option name="test-timeout" value="34m" /> + <option name="test-timeout" value="45m" /> <option name="hidden-api-checks" value="false" /> <option name="isolated-storage" value="false" /> </test> diff --git a/tests/tests/media/decoder/src/android/media/decoder/cts/DecodeOnlyTest.java b/tests/tests/media/decoder/src/android/media/decoder/cts/DecodeOnlyTest.java index 018b284d9f7..8b25bcde25e 100644 --- a/tests/tests/media/decoder/src/android/media/decoder/cts/DecodeOnlyTest.java +++ b/tests/tests/media/decoder/src/android/media/decoder/cts/DecodeOnlyTest.java @@ -784,7 +784,10 @@ public class DecodeOnlyTest extends MediaTestBase { outputBuffer.clear(); ByteBuffer audioData = ByteBuffer.wrap(audioArray); int writtenSize = 0; - while (true) { + // This is a workaround, just to avoid blocking audio track write and codec + // crashes caused by invalid index after audio track pause and codec flush. + // b/291959069 to fix the outstanding callback issue. + while (!mDone.get()) { int written = mAudioTrack.write(audioData, info.size - writtenSize, AudioTrack.WRITE_BLOCKING, info.presentationTimeUs * 1000); if (written >= 0) { diff --git a/tests/tests/sdksandbox/webkit/Android.bp b/tests/tests/sdksandbox/webkit/Android.bp index f0ab1430c64..edfce673cfa 100644 --- a/tests/tests/sdksandbox/webkit/Android.bp +++ b/tests/tests/sdksandbox/webkit/Android.bp @@ -31,7 +31,6 @@ android_test { "ctswebkitsharedenv", ], data: [ - ":EmptySdkProviderApp", ":WebViewSandboxTestSdk", ], srcs: [ diff --git a/tests/tests/sdksandbox/webkit/AndroidManifest.xml b/tests/tests/sdksandbox/webkit/AndroidManifest.xml index 24cc75fd251..777e43a9d76 100644 --- a/tests/tests/sdksandbox/webkit/AndroidManifest.xml +++ b/tests/tests/sdksandbox/webkit/AndroidManifest.xml @@ -24,9 +24,6 @@ <application android:maxRecents="1"> <uses-library android:name="android.test.runner"/> - <uses-sdk-library android:name="com.android.emptysdkprovider" - android:versionMajor="1" - android:certDigest="0B:44:2D:88:FA:A7:B3:AD:23:8D:DE:29:8A:A1:9B:D5:62:03:92:0B:BF:D8:D3:EB:C8:99:33:2C:8E:E1:15:99"/> <uses-sdk-library android:name="com.android.cts.sdk.webviewsandboxtest" android:versionMajor="1" android:certDigest="0B:44:2D:88:FA:A7:B3:AD:23:8D:DE:29:8A:A1:9B:D5:62:03:92:0B:BF:D8:D3:EB:C8:99:33:2C:8E:E1:15:99"/> diff --git a/tests/tests/sdksandbox/webkit/AndroidTest.xml b/tests/tests/sdksandbox/webkit/AndroidTest.xml index 783ce8f256f..8052a9f7009 100644 --- a/tests/tests/sdksandbox/webkit/AndroidTest.xml +++ b/tests/tests/sdksandbox/webkit/AndroidTest.xml @@ -23,7 +23,6 @@ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> <option name="cleanup-apks" value="true"/> <option name="test-file-name" value="WebViewSandboxTestSdk.apk"/> - <option name="test-file-name" value="EmptySdkProviderApp.apk"/> <option name="test-file-name" value="CtsSdkSandboxWebkitTestCases.apk"/> </target_preparer> diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkMimeTypeMapTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkMimeTypeMapTest.java index 4834cb3d621..50d09f93189 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkMimeTypeMapTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkMimeTypeMapTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,40 +30,36 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkMimeTypeMapTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.MimeTypeMapTest"); @Test - public void testGetFileExtensionFromUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetFileExtensionFromUrl"); + public void testGetFileExtensionFromUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetFileExtensionFromUrl"); } @Test - public void testHasMimeType() throws Exception { - sdkTester.assertSdkTestRunPasses("testHasMimeType"); + public void testHasMimeType() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testHasMimeType"); } @Test - public void testGetMimeTypeFromExtension() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetMimeTypeFromExtension"); + public void testGetMimeTypeFromExtension() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetMimeTypeFromExtension"); } @Test - public void testHasExtension() throws Exception { - sdkTester.assertSdkTestRunPasses("testHasExtension"); + public void testHasExtension() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testHasExtension"); } @Test - public void testGetExtensionFromMimeType() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetExtensionFromMimeType"); + public void testGetExtensionFromMimeType() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetExtensionFromMimeType"); } @Test - public void testGetSingleton() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetSingleton"); + public void testGetSingleton() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetSingleton"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieManagerTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieManagerTest.java index 8db9cdf8a51..c3137f7b579 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieManagerTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieManagerTest.java @@ -16,13 +16,10 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,80 +27,76 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxCookieManagerTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.CookieManagerTest"); @Test - public void testGetInstance() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetInstance"); + public void testGetInstance() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetInstance"); } @Test - public void testFlush() throws Exception { - sdkTester.assertSdkTestRunPasses("testFlush"); + public void testFlush() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testFlush"); } @Test - public void testAcceptCookie() throws Exception { - sdkTester.assertSdkTestRunPasses("testAcceptCookie"); + public void testAcceptCookie() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAcceptCookie"); } @Test - public void testSetCookie() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetCookie"); + public void testSetCookie() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetCookie"); } @Test - public void testSetCookieNullCallback() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetCookieNullCallback"); + public void testSetCookieNullCallback() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetCookieNullCallback"); } @Test - public void testSetCookieCallback() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetCookieCallback"); + public void testSetCookieCallback() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetCookieCallback"); } @Test - public void testRemoveCookies() throws Exception { - sdkTester.assertSdkTestRunPasses("testRemoveCookies"); + public void testRemoveCookies() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testRemoveCookies"); } @Test - public void testRemoveCookiesNullCallback() throws Exception { - sdkTester.assertSdkTestRunPasses("testRemoveCookiesNullCallback"); + public void testRemoveCookiesNullCallback() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testRemoveCookiesNullCallback"); } @Test - public void testRemoveCookiesCallback() throws Exception { - sdkTester.assertSdkTestRunPasses("testRemoveCookiesCallback"); + public void testRemoveCookiesCallback() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testRemoveCookiesCallback"); } @Test - public void testThirdPartyCookie() throws Exception { - sdkTester.assertSdkTestRunPasses("testThirdPartyCookie"); + public void testThirdPartyCookie() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testThirdPartyCookie"); } @Test - public void testSameSiteLaxByDefault() throws Exception { - sdkTester.assertSdkTestRunPasses("testSameSiteLaxByDefault"); + public void testSameSiteLaxByDefault() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSameSiteLaxByDefault"); } @Test - public void testSameSiteNoneRequiresSecure() throws Exception { - sdkTester.assertSdkTestRunPasses("testSameSiteNoneRequiresSecure"); + public void testSameSiteNoneRequiresSecure() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSameSiteNoneRequiresSecure"); } @Test - public void testSchemefulSameSite() throws Exception { - sdkTester.assertSdkTestRunPasses("testSchemefulSameSite"); + public void testSchemefulSameSite() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSchemefulSameSite"); } @Test - public void testb3167208() throws Exception { - sdkTester.assertSdkTestRunPasses("testb3167208"); + public void testb3167208() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testb3167208"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieTest.java index 52f4daf9a58..2fa647384e7 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxCookieTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.Presubmit; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,36 +29,32 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxCookieTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.CookieTest"); @Presubmit @Test - public void testDomain() throws Exception { - sdkTester.assertSdkTestRunPasses("testDomain"); + public void testDomain() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDomain"); } @Test - public void testSubDomain() throws Exception { - sdkTester.assertSdkTestRunPasses("testSubDomain"); + public void testSubDomain() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSubDomain"); } @Test - public void testInvalidDomain() throws Exception { - sdkTester.assertSdkTestRunPasses("testInvalidDomain"); + public void testInvalidDomain() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testInvalidDomain"); } @Test - public void testPath() throws Exception { - sdkTester.assertSdkTestRunPasses("testPath"); + public void testPath() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testPath"); } @Test - public void testEmptyValue() throws Exception { - sdkTester.assertSdkTestRunPasses("testEmptyValue"); + public void testEmptyValue() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testEmptyValue"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxDateSorterTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxDateSorterTest.java index e83a5248961..3099a8f4532 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxDateSorterTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxDateSorterTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,30 +30,26 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxDateSorterTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.DateSorterTest"); @Test - public void testConstructor() throws Exception { - sdkTester.assertSdkTestRunPasses("testConstructor"); + public void testConstructor() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testConstructor"); } @Test - public void testGetLabel() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetLabel"); + public void testGetLabel() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetLabel"); } @Test - public void testGetIndex() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetIndex"); + public void testGetIndex() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetIndex"); } @Test - public void testGetBoundary() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetBoundary"); + public void testGetBoundary() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetBoundary"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxHttpAuthHandlerTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxHttpAuthHandlerTest.java index 05e9a1ff604..cb9efcc5f4f 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxHttpAuthHandlerTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxHttpAuthHandlerTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,25 +30,21 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxHttpAuthHandlerTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.HttpAuthHandlerTest"); @Test - public void testProceed() throws Exception { - sdkTester.assertSdkTestRunPasses("testProceed"); + public void testProceed() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testProceed"); } @Test - public void testCancel() throws Exception { - sdkTester.assertSdkTestRunPasses("testCancel"); + public void testCancel() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCancel"); } @Test - public void testUseHttpAuthUsernamePassword() throws Exception { - sdkTester.assertSdkTestRunPasses("testUseHttpAuthUsernamePassword"); + public void testUseHttpAuthUsernamePassword() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testUseHttpAuthUsernamePassword"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxPostMessageTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxPostMessageTest.java index 214084a0484..2b92f47ff8a 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxPostMessageTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxPostMessageTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,55 +30,51 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxPostMessageTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.PostMessageTest"); @Test - public void testSimpleMessageToMainFrame() throws Exception { - sdkTester.assertSdkTestRunPasses("testSimpleMessageToMainFrame"); + public void testSimpleMessageToMainFrame() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSimpleMessageToMainFrame"); } @Test - public void testWildcardOriginMatchesAnything() throws Exception { - sdkTester.assertSdkTestRunPasses("testWildcardOriginMatchesAnything"); + public void testWildcardOriginMatchesAnything() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWildcardOriginMatchesAnything"); } @Test - public void testEmptyStringOriginMatchesAnything() throws Exception { - sdkTester.assertSdkTestRunPasses("testEmptyStringOriginMatchesAnything"); + public void testEmptyStringOriginMatchesAnything() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testEmptyStringOriginMatchesAnything"); } @Test - public void testMultipleMessagesToMainFrame() throws Exception { - sdkTester.assertSdkTestRunPasses("testMultipleMessagesToMainFrame"); + public void testMultipleMessagesToMainFrame() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testMultipleMessagesToMainFrame"); } @Test - public void testMessageChannel() throws Exception { - sdkTester.assertSdkTestRunPasses("testMessageChannel"); + public void testMessageChannel() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testMessageChannel"); } @Test - public void testClose() throws Exception { - sdkTester.assertSdkTestRunPasses("testClose"); + public void testClose() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testClose"); } @Test - public void testReceiveMessagePort() throws Exception { - sdkTester.assertSdkTestRunPasses("testReceiveMessagePort"); + public void testReceiveMessagePort() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testReceiveMessagePort"); } @Test - public void testWebMessageHandler() throws Exception { - sdkTester.assertSdkTestRunPasses("testWebMessageHandler"); + public void testWebMessageHandler() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWebMessageHandler"); } @Test - public void testWebMessageDefaultHandler() throws Exception { - sdkTester.assertSdkTestRunPasses("testWebMessageDefaultHandler"); + public void testWebMessageDefaultHandler() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWebMessageDefaultHandler"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxServiceWorkerClientTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxServiceWorkerClientTest.java index 39922ede210..944e2e1f0db 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxServiceWorkerClientTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxServiceWorkerClientTest.java @@ -16,13 +16,10 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,20 +27,16 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxServiceWorkerClientTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.ServiceWorkerClientTest"); @Test - public void testServiceWorkerClientInterceptCallback() throws Exception { - sdkTester.assertSdkTestRunPasses("testServiceWorkerClientInterceptCallback"); + public void testServiceWorkerClientInterceptCallback() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testServiceWorkerClientInterceptCallback"); } @Test - public void testSetNullServiceWorkerClient() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetNullServiceWorkerClient"); + public void testSetNullServiceWorkerClient() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetNullServiceWorkerClient"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxURLUtilTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxURLUtilTest.java index 4e047c73431..1159d03729a 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxURLUtilTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxURLUtilTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,90 +30,86 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxURLUtilTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.URLUtilTest"); @Test - public void testIsAssetUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsAssetUrl"); + public void testIsAssetUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsAssetUrl"); } @Test - public void testIsAboutUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsAboutUrl"); + public void testIsAboutUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsAboutUrl"); } @Test - public void testIsContentUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsContentUrl"); + public void testIsContentUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsContentUrl"); } @Test - public void testIsCookielessProxyUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsCookielessProxyUrl"); + public void testIsCookielessProxyUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsCookielessProxyUrl"); } @Test - public void testIsDataUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsDataUrl"); + public void testIsDataUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsDataUrl"); } @Test - public void testIsFileUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsFileUrl"); + public void testIsFileUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsFileUrl"); } @Test - public void testIsHttpsUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsHttpsUrl"); + public void testIsHttpsUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsHttpsUrl"); } @Test - public void testIsHttpUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsHttpUrl"); + public void testIsHttpUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsHttpUrl"); } @Test - public void testIsJavaScriptUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsJavaScriptUrl"); + public void testIsJavaScriptUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsJavaScriptUrl"); } @Test - public void testIsNetworkUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsNetworkUrl"); + public void testIsNetworkUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsNetworkUrl"); } @Test - public void testIsValidUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testIsValidUrl"); + public void testIsValidUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIsValidUrl"); } @Test - public void testComposeSearchUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testComposeSearchUrl"); + public void testComposeSearchUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testComposeSearchUrl"); } @Test - public void testDecode() throws Exception { - sdkTester.assertSdkTestRunPasses("testDecode"); + public void testDecode() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDecode"); } @Test - public void testGuessFileName() throws Exception { - sdkTester.assertSdkTestRunPasses("testGuessFileName"); + public void testGuessFileName() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGuessFileName"); } @Test - public void testGuessUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testGuessUrl"); + public void testGuessUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGuessUrl"); } @Test - public void testStripAnchor() throws Exception { - sdkTester.assertSdkTestRunPasses("testStripAnchor"); + public void testStripAnchor() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testStripAnchor"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebBackForwardListTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebBackForwardListTest.java index 7d8c85bcc40..c9214e2b1da 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebBackForwardListTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebBackForwardListTest.java @@ -16,13 +16,10 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,15 +27,11 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxWebBackForwardListTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebBackForwardListTest"); @Test - public void testGetCurrentItem() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetCurrentItem"); + public void testGetCurrentItem() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetCurrentItem"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebChromeClientTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebChromeClientTest.java index 95ec8dae855..778b014c7fb 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebChromeClientTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebChromeClientTest.java @@ -15,13 +15,10 @@ */ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,66 +27,62 @@ import org.junit.runner.RunWith; public class SdkSandboxWebChromeClientTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebChromeClientTest"); @Test - public void testOnProgressChanged() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnProgressChanged"); + public void testOnProgressChanged() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnProgressChanged"); } @Test - public void testOnReceivedTitle() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedTitle"); + public void testOnReceivedTitle() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedTitle"); } @Test - public void testOnReceivedIcon() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedIcon"); + public void testOnReceivedIcon() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedIcon"); } @Test - public void testWindows() throws Exception { - sdkTester.assertSdkTestRunPasses("testWindows"); + public void testWindows() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWindows"); } @Test - public void testBlockWindowsSync() throws Exception { - sdkTester.assertSdkTestRunPasses("testBlockWindowsSync"); + public void testBlockWindowsSync() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testBlockWindowsSync"); } @Test - public void testBlockWindowsAsync() throws Exception { - sdkTester.assertSdkTestRunPasses("testBlockWindowsAsync"); + public void testBlockWindowsAsync() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testBlockWindowsAsync"); } @Test - public void testOnJsAlert() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnJsAlert"); + public void testOnJsAlert() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnJsAlert"); } @Test - public void testOnJsConfirm() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnJsConfirm"); + public void testOnJsConfirm() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnJsConfirm"); } @Test - public void testOnJsPrompt() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnJsPrompt"); + public void testOnJsPrompt() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnJsPrompt"); } @Test - public void testOnConsoleMessage() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnConsoleMessage"); + public void testOnConsoleMessage() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnConsoleMessage"); } @Test - public void testOnJsBeforeUnloadIsCalled() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnJsBeforeUnloadIsCalled"); + public void testOnJsBeforeUnloadIsCalled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnJsBeforeUnloadIsCalled"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebHistoryItemTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebHistoryItemTest.java index 5eb7225e286..53ce91669c3 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebHistoryItemTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebHistoryItemTest.java @@ -16,13 +16,10 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,15 +27,11 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxWebHistoryItemTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebHistoryItemTest"); @Test - public void testWebHistoryItem() throws Exception { - sdkTester.assertSdkTestRunPasses("testWebHistoryItem"); + public void testWebHistoryItem() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWebHistoryItem"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebSettingsTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebSettingsTest.java index e2112aed33d..85497c01b6b 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebSettingsTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebSettingsTest.java @@ -16,13 +16,10 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,250 +27,250 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxWebSettingsTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebSettingsTest"); @Test - public void testUserAgentString_default() throws Exception { - sdkTester.assertSdkTestRunPasses("testUserAgentString_default"); + public void testUserAgentString_default() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testUserAgentString_default"); } @Test - public void testUserAgentStringTest() throws Exception { - sdkTester.assertSdkTestRunPasses("testUserAgentStringTest"); + public void testUserAgentStringTest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testUserAgentStringTest"); } @Test - public void testAccessUserAgentString() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessUserAgentString"); + public void testAccessUserAgentString() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessUserAgentString"); } @Test - public void testAccessCacheMode_defaultValue() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessCacheMode_defaultValue"); + public void testAccessCacheMode_defaultValue() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessCacheMode_defaultValue"); } @Test - public void testAccessCacheMode_cacheElseNetwork() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessCacheMode_cacheElseNetwork"); + public void testAccessCacheMode_cacheElseNetwork() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessCacheMode_cacheElseNetwork"); } @Test - public void testAccessCacheMode_noCache() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessCacheMode_noCache"); + public void testAccessCacheMode_noCache() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessCacheMode_noCache"); } @Test - public void testAccessCacheMode_cacheOnly() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessCacheMode_cacheOnly"); + public void testAccessCacheMode_cacheOnly() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessCacheMode_cacheOnly"); } @Test - public void testAccessCursiveFontFamily() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessCursiveFontFamily"); + public void testAccessCursiveFontFamily() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessCursiveFontFamily"); } @Test - public void testAccessFantasyFontFamily() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessFantasyFontFamily"); + public void testAccessFantasyFontFamily() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessFantasyFontFamily"); } @Test - public void testAccessFixedFontFamily() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessFixedFontFamily"); + public void testAccessFixedFontFamily() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessFixedFontFamily"); } @Test - public void testAccessSansSerifFontFamily() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessSansSerifFontFamily"); + public void testAccessSansSerifFontFamily() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessSansSerifFontFamily"); } @Test - public void testAccessSerifFontFamily() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessSerifFontFamily"); + public void testAccessSerifFontFamily() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessSerifFontFamily"); } @Test - public void testAccessStandardFontFamily() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessStandardFontFamily"); + public void testAccessStandardFontFamily() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessStandardFontFamily"); } @Test - public void testAccessDefaultFontSize() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessDefaultFontSize"); + public void testAccessDefaultFontSize() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessDefaultFontSize"); } @Test - public void testAccessDefaultFixedFontSize() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessDefaultFixedFontSize"); + public void testAccessDefaultFixedFontSize() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessDefaultFixedFontSize"); } @Test - public void testAccessDefaultTextEncodingName() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessDefaultTextEncodingName"); + public void testAccessDefaultTextEncodingName() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessDefaultTextEncodingName"); } @Test - public void testAccessJavaScriptCanOpenWindowsAutomatically() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessJavaScriptCanOpenWindowsAutomatically"); + public void testAccessJavaScriptCanOpenWindowsAutomatically() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testAccessJavaScriptCanOpenWindowsAutomatically"); } @Test - public void testAccessJavaScriptEnabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessJavaScriptEnabled"); + public void testAccessJavaScriptEnabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessJavaScriptEnabled"); } @Test - public void testAccessLayoutAlgorithm() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessLayoutAlgorithm"); + public void testAccessLayoutAlgorithm() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessLayoutAlgorithm"); } @Test - public void testAccessMinimumFontSize() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessMinimumFontSize"); + public void testAccessMinimumFontSize() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessMinimumFontSize"); } @Test - public void testAccessMinimumLogicalFontSize() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessMinimumLogicalFontSize"); + public void testAccessMinimumLogicalFontSize() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessMinimumLogicalFontSize"); } @Test - public void testAccessPluginsEnabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessPluginsEnabled"); + public void testAccessPluginsEnabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessPluginsEnabled"); } @Test - public void testOffscreenPreRaster() throws Exception { - sdkTester.assertSdkTestRunPasses("testOffscreenPreRaster"); + public void testOffscreenPreRaster() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOffscreenPreRaster"); } @Test - public void testAccessPluginsPath() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessPluginsPath"); + public void testAccessPluginsPath() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessPluginsPath"); } @Test - public void testAccessTextSize() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessTextSize"); + public void testAccessTextSize() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessTextSize"); } @Test - public void testAccessUseDoubleTree() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessUseDoubleTree"); + public void testAccessUseDoubleTree() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessUseDoubleTree"); } @Test - public void testAccessUseWideViewPort() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessUseWideViewPort"); + public void testAccessUseWideViewPort() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessUseWideViewPort"); } @Test - public void testSetNeedInitialFocus() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetNeedInitialFocus"); + public void testSetNeedInitialFocus() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetNeedInitialFocus"); } @Test - public void testSetRenderPriority() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetRenderPriority"); + public void testSetRenderPriority() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetRenderPriority"); } @Test - public void testAccessSupportMultipleWindows() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessSupportMultipleWindows"); + public void testAccessSupportMultipleWindows() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessSupportMultipleWindows"); } @Test - public void testAccessSupportZoom() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessSupportZoom"); + public void testAccessSupportZoom() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessSupportZoom"); } @Test - public void testAccessBuiltInZoomControls() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessBuiltInZoomControls"); + public void testAccessBuiltInZoomControls() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessBuiltInZoomControls"); } @Test - public void testAppCacheDisabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testAppCacheDisabled"); + public void testAppCacheDisabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAppCacheDisabled"); } @Test - public void testAppCacheEnabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testAppCacheEnabled"); + public void testAppCacheEnabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAppCacheEnabled"); } @Test - public void testDatabaseDisabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testDatabaseDisabled"); + public void testDatabaseDisabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDatabaseDisabled"); } @Test - public void testDisabledActionModeMenuItems() throws Exception { - sdkTester.assertSdkTestRunPasses("testDisabledActionModeMenuItems"); + public void testDisabledActionModeMenuItems() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDisabledActionModeMenuItems"); } @Test - public void testLoadsImagesAutomatically_default() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadsImagesAutomatically_default"); + public void testLoadsImagesAutomatically_default() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testLoadsImagesAutomatically_default"); } @Test - public void testLoadsImagesAutomatically_httpImagesLoaded() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadsImagesAutomatically_httpImagesLoaded"); + public void testLoadsImagesAutomatically_httpImagesLoaded() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testLoadsImagesAutomatically_httpImagesLoaded"); } @Test - public void testLoadsImagesAutomatically_dataUriImagesLoaded() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadsImagesAutomatically_dataUriImagesLoaded"); + public void testLoadsImagesAutomatically_dataUriImagesLoaded() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadsImagesAutomatically_dataUriImagesLoaded"); } @Test - public void testLoadsImagesAutomatically_blockLoadingImages() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadsImagesAutomatically_blockLoadingImages"); + public void testLoadsImagesAutomatically_blockLoadingImages() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadsImagesAutomatically_blockLoadingImages"); } @Test - public void testLoadsImagesAutomatically_loadImagesWithoutReload() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadsImagesAutomatically_loadImagesWithoutReload"); + public void testLoadsImagesAutomatically_loadImagesWithoutReload() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadsImagesAutomatically_loadImagesWithoutReload"); } @Test - public void testBlockNetworkImage() throws Exception { - sdkTester.assertSdkTestRunPasses("testBlockNetworkImage"); + public void testBlockNetworkImage() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testBlockNetworkImage"); } @Test - public void testBlockNetworkLoads() throws Exception { - sdkTester.assertSdkTestRunPasses("testBlockNetworkLoads"); + public void testBlockNetworkLoads() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testBlockNetworkLoads"); } @Test - public void testIframesWhenAccessFromFileURLsDisabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testIframesWhenAccessFromFileURLsDisabled"); + public void testIframesWhenAccessFromFileURLsDisabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIframesWhenAccessFromFileURLsDisabled"); } @Test - public void testXHRWhenAccessFromFileURLsEnabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testXHRWhenAccessFromFileURLsEnabled"); + public void testXHRWhenAccessFromFileURLsEnabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testXHRWhenAccessFromFileURLsEnabled"); } @Test - public void testXHRWhenAccessFromFileURLsDisabled() throws Exception { - sdkTester.assertSdkTestRunPasses("testXHRWhenAccessFromFileURLsDisabled"); + public void testXHRWhenAccessFromFileURLsDisabled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testXHRWhenAccessFromFileURLsDisabled"); } @Test - public void testAllowMixedMode() throws Exception { - sdkTester.assertSdkTestRunPasses("testAllowMixedMode"); + public void testAllowMixedMode() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAllowMixedMode"); } @Test - public void testEnableSafeBrowsing() throws Exception { - sdkTester.assertSdkTestRunPasses("testEnableSafeBrowsing"); + public void testEnableSafeBrowsing() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testEnableSafeBrowsing"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewClientTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewClientTest.java index 1c184de6187..d436da96e68 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewClientTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewClientTest.java @@ -28,151 +28,146 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxWebViewClientTest { // TODO(b/266051278): Uncomment this when we work out why preserving - // the SDK sandbox manager between tests cases {@link testOnRenderProcessGone} - // to fail. - // - // @ClassRule - // public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - // new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - + // the SDK sandbox manager between tests causes {@link testOnRenderProcessGone} + // to fail. Change sSdkTestSuiteSetup to a @ClassRule once this is fixed. @Rule - public final WebViewSandboxTestRule sdkTester = + public final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebViewClientTest"); @Test - public void testShouldOverrideUrlLoadingDefault() throws Exception { - sdkTester.assertSdkTestRunPasses("testShouldOverrideUrlLoadingDefault"); + public void testShouldOverrideUrlLoadingDefault() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testShouldOverrideUrlLoadingDefault"); } @Test - public void testShouldOverrideUrlLoading() throws Exception { - sdkTester.assertSdkTestRunPasses("testShouldOverrideUrlLoading"); + public void testShouldOverrideUrlLoading() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testShouldOverrideUrlLoading"); } @Test - public void testShouldOverrideUrlLoadingOnCreateWindow() throws Exception { - sdkTester.assertSdkTestRunPasses("testShouldOverrideUrlLoadingOnCreateWindow"); + public void testShouldOverrideUrlLoadingOnCreateWindow() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testShouldOverrideUrlLoadingOnCreateWindow"); } @Test - public void testLoadPage() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadPage"); + public void testLoadPage() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testLoadPage"); } @Test - public void testOnReceivedLoginRequest() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedLoginRequest"); + public void testOnReceivedLoginRequest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedLoginRequest"); } @Test - public void testOnReceivedError() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedError"); + public void testOnReceivedError() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedError"); } @Test - public void testOnReceivedErrorForSubresource() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedErrorForSubresource"); + public void testOnReceivedErrorForSubresource() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedErrorForSubresource"); } @Test - public void testOnReceivedHttpError() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedHttpError"); + public void testOnReceivedHttpError() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedHttpError"); } @Test - public void testOnFormResubmission() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnFormResubmission"); + public void testOnFormResubmission() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnFormResubmission"); } @Test - public void testDoUpdateVisitedHistory() throws Exception { - sdkTester.assertSdkTestRunPasses("testDoUpdateVisitedHistory"); + public void testDoUpdateVisitedHistory() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDoUpdateVisitedHistory"); } @Test - public void testOnReceivedHttpAuthRequest() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedHttpAuthRequest"); + public void testOnReceivedHttpAuthRequest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedHttpAuthRequest"); } @Test - public void testShouldOverrideKeyEvent() throws Exception { - sdkTester.assertSdkTestRunPasses("testShouldOverrideKeyEvent"); + public void testShouldOverrideKeyEvent() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testShouldOverrideKeyEvent"); } @Test - public void testOnUnhandledKeyEvent() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnUnhandledKeyEvent"); + public void testOnUnhandledKeyEvent() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnUnhandledKeyEvent"); } @Test - public void testOnScaleChanged() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnScaleChanged"); + public void testOnScaleChanged() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnScaleChanged"); } @Test - public void testShouldInterceptRequestParams() throws Exception { - sdkTester.assertSdkTestRunPasses("testShouldInterceptRequestParams"); + public void testShouldInterceptRequestParams() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testShouldInterceptRequestParams"); } @Test - public void testShouldInterceptRequestResponse() throws Exception { - sdkTester.assertSdkTestRunPasses("testShouldInterceptRequestResponse"); + public void testShouldInterceptRequestResponse() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testShouldInterceptRequestResponse"); } @Test - public void testOnRenderProcessGoneDefault() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnRenderProcessGoneDefault"); + public void testOnRenderProcessGoneDefault() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnRenderProcessGoneDefault"); } @Test - public void testOnRenderProcessGone() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnRenderProcessGone"); + public void testOnRenderProcessGone() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnRenderProcessGone"); } // TODO(crbug/1245351): Remove @FlakyTest once bug fixed @FlakyTest @Test - public void testOnSafeBrowsingHitBackToSafety() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnSafeBrowsingHitBackToSafety"); + public void testOnSafeBrowsingHitBackToSafety() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnSafeBrowsingHitBackToSafety"); } // TODO(crbug/1245351): Remove @FlakyTest once bug fixed @FlakyTest @Test - public void testOnSafeBrowsingHitProceed() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnSafeBrowsingHitProceed"); + public void testOnSafeBrowsingHitProceed() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnSafeBrowsingHitProceed"); } // TODO(crbug/1245351): Remove @FlakyTest once bug fixed @FlakyTest @Test - public void testOnSafeBrowsingMalwareCode() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnSafeBrowsingMalwareCode"); + public void testOnSafeBrowsingMalwareCode() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnSafeBrowsingMalwareCode"); } // TODO(crbug/1245351): Remove @FlakyTest once bug fixed @FlakyTest @Test - public void testOnSafeBrowsingPhishingCode() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnSafeBrowsingPhishingCode"); + public void testOnSafeBrowsingPhishingCode() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnSafeBrowsingPhishingCode"); } // TODO(crbug/1245351): Remove @FlakyTest once bug fixed @FlakyTest @Test - public void testOnSafeBrowsingUnwantedSoftwareCode() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnSafeBrowsingUnwantedSoftwareCode"); + public void testOnSafeBrowsingUnwantedSoftwareCode() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnSafeBrowsingUnwantedSoftwareCode"); } // TODO(crbug/1245351): Remove @FlakyTest once bug fixed @FlakyTest @Test - public void testOnSafeBrowsingBillingCode() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnSafeBrowsingBillingCode"); + public void testOnSafeBrowsingBillingCode() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnSafeBrowsingBillingCode"); } @Test - public void testOnPageCommitVisibleCalled() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnPageCommitVisibleCalled"); + public void testOnPageCommitVisibleCalled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnPageCommitVisibleCalled"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewRenderProcessClientTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewRenderProcessClientTest.java index 999ad4471d0..2f8201ba50b 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewRenderProcessClientTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewRenderProcessClientTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,25 +30,21 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxWebViewRenderProcessClientTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebViewRenderProcessClientTest"); @Test - public void testWebViewRenderProcessClientWithoutExecutor() throws Exception { - sdkTester.assertSdkTestRunPasses("testWebViewRenderProcessClientWithoutExecutor"); + public void testWebViewRenderProcessClientWithoutExecutor() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWebViewRenderProcessClientWithoutExecutor"); } @Test - public void testWebViewRenderProcessClientWithExecutor() throws Exception { - sdkTester.assertSdkTestRunPasses("testWebViewRenderProcessClientWithExecutor"); + public void testWebViewRenderProcessClientWithExecutor() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWebViewRenderProcessClientWithExecutor"); } @Test - public void testSetWebViewRenderProcessClient() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetWebViewRenderProcessClient"); + public void testSetWebViewRenderProcessClient() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetWebViewRenderProcessClient"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewSslTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewSslTest.java index ba5975e7d08..931ef51993c 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewSslTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewSslTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,95 +29,93 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxWebViewSslTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebViewSslTest"); @Test @MediumTest - public void testInsecureSiteClearsCertificate() throws Exception { - sdkTester.assertSdkTestRunPasses("testInsecureSiteClearsCertificate"); + public void testInsecureSiteClearsCertificate() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testInsecureSiteClearsCertificate"); } @Test @MediumTest - public void testSecureSiteSetsCertificate() throws Exception { - sdkTester.assertSdkTestRunPasses("testSecureSiteSetsCertificate"); + public void testSecureSiteSetsCertificate() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSecureSiteSetsCertificate"); } @Test @MediumTest - public void testClearSslPreferences() throws Exception { - sdkTester.assertSdkTestRunPasses("testClearSslPreferences"); + public void testClearSslPreferences() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testClearSslPreferences"); } @Test @MediumTest - public void testOnReceivedSslError() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedSslError"); + public void testOnReceivedSslError() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedSslError"); } @Test @MediumTest - public void testOnReceivedSslErrorProceed() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedSslErrorProceed"); + public void testOnReceivedSslErrorProceed() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedSslErrorProceed"); } @Test @MediumTest - public void testOnReceivedSslErrorCancel() throws Exception { - sdkTester.assertSdkTestRunPasses("testOnReceivedSslErrorCancel"); + public void testOnReceivedSslErrorCancel() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testOnReceivedSslErrorCancel"); } @Test @MediumTest - public void testSslErrorProceedResponseReusedForSameHost() throws Exception { - sdkTester.assertSdkTestRunPasses("testSslErrorProceedResponseReusedForSameHost"); + public void testSslErrorProceedResponseReusedForSameHost() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSslErrorProceedResponseReusedForSameHost"); } @Test @MediumTest - public void testSslErrorProceedResponseNotReusedForDifferentHost() throws Exception { - sdkTester.assertSdkTestRunPasses("testSslErrorProceedResponseNotReusedForDifferentHost"); + public void testSslErrorProceedResponseNotReusedForDifferentHost() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testSslErrorProceedResponseNotReusedForDifferentHost"); } @Test @MediumTest - public void testSecureServerRequestingClientCertDoesNotCancelRequest() throws Exception { - sdkTester.assertSdkTestRunPasses( + public void testSecureServerRequestingClientCertDoesNotCancelRequest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( "testSecureServerRequestingClientCertDoesNotCancelRequest"); } @Test @MediumTest - public void testSecureServerRequiringClientCertDoesCancelRequest() throws Exception { - sdkTester.assertSdkTestRunPasses("testSecureServerRequiringClientCertDoesCancelRequest"); + public void testSecureServerRequiringClientCertDoesCancelRequest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testSecureServerRequiringClientCertDoesCancelRequest"); } @Test @MediumTest - public void testProceedClientCertRequest() throws Exception { - sdkTester.assertSdkTestRunPasses("testProceedClientCertRequest"); + public void testProceedClientCertRequest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testProceedClientCertRequest"); } @Test @MediumTest - public void testIgnoreClientCertRequest() throws Exception { - sdkTester.assertSdkTestRunPasses("testIgnoreClientCertRequest"); + public void testIgnoreClientCertRequest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testIgnoreClientCertRequest"); } @Test @MediumTest - public void testCancelClientCertRequest() throws Exception { - sdkTester.assertSdkTestRunPasses("testCancelClientCertRequest"); + public void testCancelClientCertRequest() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCancelClientCertRequest"); } @Test @MediumTest - public void testClientCertIssuersReceivedCorrectly() throws Exception { - sdkTester.assertSdkTestRunPasses("testClientCertIssuersReceivedCorrectly"); + public void testClientCertIssuersReceivedCorrectly() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testClientCertIssuersReceivedCorrectly"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTest.java index 13395d285d8..d1ed339e1b1 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTest.java @@ -16,7 +16,6 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import android.platform.test.annotations.Presubmit; @@ -24,7 +23,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,364 +30,371 @@ import org.junit.runner.RunWith; @AppModeFull @RunWith(AndroidJUnit4.class) public class SdkSandboxWebViewTest { - @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - @Rule - public final WebViewSandboxTestRule sdkTester = + @ClassRule + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebViewTest"); @Test - public void testConstructor() throws Exception { - sdkTester.assertSdkTestRunPasses("testConstructor"); + public void testConstructor() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testConstructor"); } @Test - public void testCreatingWebViewWithDeviceEncrpytionFails() throws Exception { - sdkTester.assertSdkTestRunPasses("testCreatingWebViewWithDeviceEncrpytionFails"); + public void testCreatingWebViewWithDeviceEncrpytionFails() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCreatingWebViewWithDeviceEncrpytionFails"); } @Test - public void testCreatingWebViewWithMultipleEncryptionContext() throws Exception { - sdkTester.assertSdkTestRunPasses("testCreatingWebViewWithMultipleEncryptionContext"); + public void testCreatingWebViewWithMultipleEncryptionContext() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testCreatingWebViewWithMultipleEncryptionContext"); } @Test - public void testCreatingWebViewCreatesCookieSyncManager() throws Exception { - sdkTester.assertSdkTestRunPasses("testCreatingWebViewCreatesCookieSyncManager"); + public void testCreatingWebViewCreatesCookieSyncManager() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCreatingWebViewCreatesCookieSyncManager"); } @Test - public void testFindAddress() throws Exception { - sdkTester.assertSdkTestRunPasses("testFindAddress"); + public void testFindAddress() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testFindAddress"); } @Test - public void testAccessHttpAuthUsernamePassword() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessHttpAuthUsernamePassword"); + public void testAccessHttpAuthUsernamePassword() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessHttpAuthUsernamePassword"); } @Test - public void testWebViewDatabaseAccessHttpAuthUsernamePassword() throws Exception { - sdkTester.assertSdkTestRunPasses("testWebViewDatabaseAccessHttpAuthUsernamePassword"); + public void testWebViewDatabaseAccessHttpAuthUsernamePassword() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testWebViewDatabaseAccessHttpAuthUsernamePassword"); } @Test - public void testScrollBarOverlay() throws Exception { - sdkTester.assertSdkTestRunPasses("testScrollBarOverlay"); + public void testScrollBarOverlay() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testScrollBarOverlay"); } @Test - public void testFlingScroll() throws Exception { - sdkTester.assertSdkTestRunPasses("testFlingScroll"); + public void testFlingScroll() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testFlingScroll"); } @Test @Presubmit - public void testLoadUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadUrl"); + public void testLoadUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testLoadUrl"); } @Test - public void testPostUrlWithNetworkUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testPostUrlWithNetworkUrl"); + public void testPostUrlWithNetworkUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testPostUrlWithNetworkUrl"); } @Test - public void testAppInjectedXRequestedWithHeaderIsNotOverwritten() throws Exception { - sdkTester.assertSdkTestRunPasses("testAppInjectedXRequestedWithHeaderIsNotOverwritten"); + public void testAppInjectedXRequestedWithHeaderIsNotOverwritten() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testAppInjectedXRequestedWithHeaderIsNotOverwritten"); } @Test - public void testAppCanInjectHeadersViaImmutableMap() throws Exception { - sdkTester.assertSdkTestRunPasses("testAppCanInjectHeadersViaImmutableMap"); + public void testAppCanInjectHeadersViaImmutableMap() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAppCanInjectHeadersViaImmutableMap"); } @Test - public void testCanInjectHeaders() throws Exception { - sdkTester.assertSdkTestRunPasses("testCanInjectHeaders"); + public void testCanInjectHeaders() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCanInjectHeaders"); } @Test - public void testGetVisibleTitleHeight() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetVisibleTitleHeight"); + public void testGetVisibleTitleHeight() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetVisibleTitleHeight"); } @Test - public void testGetOriginalUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetOriginalUrl"); + public void testGetOriginalUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetOriginalUrl"); } @Test - public void testStopLoading() throws Exception { - sdkTester.assertSdkTestRunPasses("testStopLoading"); + public void testStopLoading() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testStopLoading"); } @Test - public void testGoBackAndForward() throws Exception { - sdkTester.assertSdkTestRunPasses("testGoBackAndForward"); + public void testGoBackAndForward() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGoBackAndForward"); } @Test - public void testAddJavascriptInterface() throws Exception { - sdkTester.assertSdkTestRunPasses("testAddJavascriptInterface"); + public void testAddJavascriptInterface() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAddJavascriptInterface"); } @Test - public void testAddJavascriptInterfaceNullObject() throws Exception { - sdkTester.assertSdkTestRunPasses("testAddJavascriptInterfaceNullObject"); + public void testAddJavascriptInterfaceNullObject() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAddJavascriptInterfaceNullObject"); } @Test - public void testRemoveJavascriptInterface() throws Exception { - sdkTester.assertSdkTestRunPasses("testRemoveJavascriptInterface"); + public void testRemoveJavascriptInterface() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testRemoveJavascriptInterface"); } @Test - public void testUseRemovedJavascriptInterface() throws Exception { - sdkTester.assertSdkTestRunPasses("testUseRemovedJavascriptInterface"); + public void testUseRemovedJavascriptInterface() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testUseRemovedJavascriptInterface"); } @Test - public void testAddJavascriptInterfaceExceptions() throws Exception { - sdkTester.assertSdkTestRunPasses("testAddJavascriptInterfaceExceptions"); + public void testAddJavascriptInterfaceExceptions() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAddJavascriptInterfaceExceptions"); } @Test - public void testJavascriptInterfaceCustomPropertiesClearedOnReload() throws Exception { - sdkTester.assertSdkTestRunPasses("testJavascriptInterfaceCustomPropertiesClearedOnReload"); + public void testJavascriptInterfaceCustomPropertiesClearedOnReload() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testJavascriptInterfaceCustomPropertiesClearedOnReload"); } @Test @MediumTest - public void testJavascriptInterfaceForClientPopup() throws Exception { - sdkTester.assertSdkTestRunPasses("testJavascriptInterfaceForClientPopup"); + public void testJavascriptInterfaceForClientPopup() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testJavascriptInterfaceForClientPopup"); } @Test @MediumTest - public void testLoadDataWithBaseUrl_historyUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_historyUrl"); + public void testLoadDataWithBaseUrl_historyUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testLoadDataWithBaseUrl_historyUrl"); } @Test - public void testLoadDataWithBaseUrl_nullHistoryUrlShowsAsAboutBlank() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_nullHistoryUrlShowsAsAboutBlank"); + public void testLoadDataWithBaseUrl_nullHistoryUrlShowsAsAboutBlank() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadDataWithBaseUrl_nullHistoryUrlShowsAsAboutBlank"); } @Test - public void testLoadDataWithBaseUrl_dataBaseUrlIgnoresHistoryUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_dataBaseUrlIgnoresHistoryUrl"); + public void testLoadDataWithBaseUrl_dataBaseUrlIgnoresHistoryUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadDataWithBaseUrl_dataBaseUrlIgnoresHistoryUrl"); } @Test - public void testLoadDataWithBaseUrl_unencodedContentHttpBaseUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_unencodedContentHttpBaseUrl"); + public void testLoadDataWithBaseUrl_unencodedContentHttpBaseUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadDataWithBaseUrl_unencodedContentHttpBaseUrl"); } @Test - public void testLoadDataWithBaseUrl_urlEncodedContentDataBaseUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_urlEncodedContentDataBaseUrl"); + public void testLoadDataWithBaseUrl_urlEncodedContentDataBaseUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadDataWithBaseUrl_urlEncodedContentDataBaseUrl"); } @Test - public void testLoadDataWithBaseUrl_nullSafe() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_nullSafe"); + public void testLoadDataWithBaseUrl_nullSafe() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testLoadDataWithBaseUrl_nullSafe"); } @Test - public void testSaveWebArchive() throws Exception { - sdkTester.assertSdkTestRunPasses("testSaveWebArchive"); + public void testSaveWebArchive() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSaveWebArchive"); } @Test - public void testFindAll() throws Exception { - sdkTester.assertSdkTestRunPasses("testFindAll"); + public void testFindAll() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testFindAll"); } @Test - public void testFindNext() throws Exception { - sdkTester.assertSdkTestRunPasses("testFindNext"); + public void testFindNext() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testFindNext"); } @Test - public void testPageScroll() throws Exception { - sdkTester.assertSdkTestRunPasses("testPageScroll"); + public void testPageScroll() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testPageScroll"); } @Test - public void testGetContentHeight() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetContentHeight"); + public void testGetContentHeight() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetContentHeight"); } @Test - public void testPlatformNotifications() throws Exception { - sdkTester.assertSdkTestRunPasses("testPlatformNotifications"); + public void testPlatformNotifications() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testPlatformNotifications"); } @Test - public void testAccessPluginList() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessPluginList"); + public void testAccessPluginList() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessPluginList"); } @Test - public void testDestroy() throws Exception { - sdkTester.assertSdkTestRunPasses("testDestroy"); + public void testDestroy() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDestroy"); } @Test - public void testDebugDump() throws Exception { - sdkTester.assertSdkTestRunPasses("testDebugDump"); + public void testDebugDump() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDebugDump"); } @Test - public void testSetInitialScale() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetInitialScale"); + public void testSetInitialScale() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetInitialScale"); } @Test - public void testRequestChildRectangleOnScreen() throws Exception { - sdkTester.assertSdkTestRunPasses("testRequestChildRectangleOnScreen"); + public void testRequestChildRectangleOnScreen() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testRequestChildRectangleOnScreen"); } @Test - public void testSetLayoutParams() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetLayoutParams"); + public void testSetLayoutParams() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetLayoutParams"); } @Test - public void testSetMapTrackballToArrowKeys() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetMapTrackballToArrowKeys"); + public void testSetMapTrackballToArrowKeys() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetMapTrackballToArrowKeys"); } @Test - public void testPauseResumeTimers() throws Exception { - sdkTester.assertSdkTestRunPasses("testPauseResumeTimers"); + public void testPauseResumeTimers() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testPauseResumeTimers"); } @Test - public void testEvaluateJavascript() throws Exception { - sdkTester.assertSdkTestRunPasses("testEvaluateJavascript"); + public void testEvaluateJavascript() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testEvaluateJavascript"); } @Test - public void testPrinting() throws Exception { - sdkTester.assertSdkTestRunPasses("testPrinting"); + public void testPrinting() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testPrinting"); } @Test - public void testPrintingPagesCount() throws Exception { - sdkTester.assertSdkTestRunPasses("testPrintingPagesCount"); + public void testPrintingPagesCount() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testPrintingPagesCount"); } @Test - public void testVisualStateCallbackCalled() throws Exception { - sdkTester.assertSdkTestRunPasses("testVisualStateCallbackCalled"); + public void testVisualStateCallbackCalled() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testVisualStateCallbackCalled"); } @Test - public void testSetSafeBrowsingAllowlistWithMalformedList() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetSafeBrowsingAllowlistWithMalformedList"); + public void testSetSafeBrowsingAllowlistWithMalformedList() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetSafeBrowsingAllowlistWithMalformedList"); } @Test - public void testSetSafeBrowsingAllowlistWithValidList() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetSafeBrowsingAllowlistWithValidList"); + public void testSetSafeBrowsingAllowlistWithValidList() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetSafeBrowsingAllowlistWithValidList"); } @Test - public void testGetWebViewClient() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetWebViewClient"); + public void testGetWebViewClient() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetWebViewClient"); } @Test - public void testGetWebChromeClient() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetWebChromeClient"); + public void testGetWebChromeClient() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetWebChromeClient"); } @Test - public void testSetCustomTextClassifier() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetCustomTextClassifier"); + public void testSetCustomTextClassifier() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetCustomTextClassifier"); } @Test - public void testGetSafeBrowsingPrivacyPolicyUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetSafeBrowsingPrivacyPolicyUrl"); + public void testGetSafeBrowsingPrivacyPolicyUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetSafeBrowsingPrivacyPolicyUrl"); } @Test - public void testWebViewClassLoaderReturnsNonNull() throws Exception { - sdkTester.assertSdkTestRunPasses("testWebViewClassLoaderReturnsNonNull"); + public void testWebViewClassLoaderReturnsNonNull() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testWebViewClassLoaderReturnsNonNull"); } @Test - public void testCapturePicture() throws Exception { - sdkTester.assertSdkTestRunPasses("testCapturePicture"); + public void testCapturePicture() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCapturePicture"); } @Test - public void testSetPictureListener() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetPictureListener"); + public void testSetPictureListener() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetPictureListener"); } @Test - public void testLoadData() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadData"); + public void testLoadData() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testLoadData"); } @Test - public void testLoadDataWithBaseUrl_resolvesRelativeToBaseUrl() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_resolvesRelativeToBaseUrl"); + public void testLoadDataWithBaseUrl_resolvesRelativeToBaseUrl() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadDataWithBaseUrl_resolvesRelativeToBaseUrl"); } @Test - public void testLoadDataWithBaseUrl_javascriptCanAccessOrigin() throws Exception { - sdkTester.assertSdkTestRunPasses("testLoadDataWithBaseUrl_javascriptCanAccessOrigin"); + public void testLoadDataWithBaseUrl_javascriptCanAccessOrigin() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses( + "testLoadDataWithBaseUrl_javascriptCanAccessOrigin"); } @Test - public void testDocumentHasImages() throws Exception { - sdkTester.assertSdkTestRunPasses("testDocumentHasImages"); + public void testDocumentHasImages() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testDocumentHasImages"); } @Test - public void testClearHistory() throws Exception { - sdkTester.assertSdkTestRunPasses("testClearHistory"); + public void testClearHistory() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testClearHistory"); } @Test - public void testSaveAndRestoreState() throws Exception { - sdkTester.assertSdkTestRunPasses("testSaveAndRestoreState"); + public void testSaveAndRestoreState() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSaveAndRestoreState"); } @Test - public void testSetDownloadListener() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetDownloadListener"); + public void testSetDownloadListener() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetDownloadListener"); } @Test - public void testSetNetworkAvailable() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetNetworkAvailable"); + public void testSetNetworkAvailable() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetNetworkAvailable"); } @Test - public void testSetWebChromeClient() throws Exception { - sdkTester.assertSdkTestRunPasses("testSetWebChromeClient"); + public void testSetWebChromeClient() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testSetWebChromeClient"); } @Test - public void testRequestFocusNodeHref() throws Exception { - sdkTester.assertSdkTestRunPasses("testRequestFocusNodeHref"); + public void testRequestFocusNodeHref() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testRequestFocusNodeHref"); } @Test - public void testRequestImageRef() throws Exception { - sdkTester.assertSdkTestRunPasses("testRequestImageRef"); + public void testRequestImageRef() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testRequestImageRef"); } @Test - public void testGetHitTestResult() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetHitTestResult"); + public void testGetHitTestResult() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetHitTestResult"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTransportTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTransportTest.java index a4db755e434..41d51592927 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTransportTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewTransportTest.java @@ -16,13 +16,10 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,15 +27,11 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkSandboxWebViewTransportTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebViewTransportTest"); @Test - public void testAccessWebView() throws Exception { - sdkTester.assertSdkTestRunPasses("testAccessWebView"); + public void testAccessWebView() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAccessWebView"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewZoomTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewZoomTest.java index 4afee9ca31d..e1a801d81bd 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewZoomTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkSandboxWebViewZoomTest.java @@ -15,13 +15,10 @@ */ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; - import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,55 +27,51 @@ import org.junit.runner.RunWith; public class SdkSandboxWebViewZoomTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebViewZoomTest"); @Test - public void testZoomIn() throws Exception { - sdkTester.assertSdkTestRunPasses("testZoomIn"); + public void testZoomIn() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testZoomIn"); } @Test - public void testGetZoomControls() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetZoomControls"); + public void testGetZoomControls() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetZoomControls"); } @Test - public void testInvokeZoomPicker() throws Exception { - sdkTester.assertSdkTestRunPasses("testInvokeZoomPicker"); + public void testInvokeZoomPicker() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testInvokeZoomPicker"); } @Test - public void testZoom_canNotZoomInPastMaximum() throws Exception { - sdkTester.assertSdkTestRunPasses("testZoom_canNotZoomInPastMaximum"); + public void testZoom_canNotZoomInPastMaximum() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testZoom_canNotZoomInPastMaximum"); } @Test - public void testZoom_canNotZoomOutPastMinimum() throws Exception { - sdkTester.assertSdkTestRunPasses("testZoom_canNotZoomOutPastMinimum"); + public void testZoom_canNotZoomOutPastMinimum() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testZoom_canNotZoomOutPastMinimum"); } @Test - public void testCanZoomWhileZoomSupportedFalse() throws Exception { - sdkTester.assertSdkTestRunPasses("testCanZoomWhileZoomSupportedFalse"); + public void testCanZoomWhileZoomSupportedFalse() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCanZoomWhileZoomSupportedFalse"); } @Test - public void testZoomByPowerOfTwoIncrements() throws Exception { - sdkTester.assertSdkTestRunPasses("testZoomByPowerOfTwoIncrements"); + public void testZoomByPowerOfTwoIncrements() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testZoomByPowerOfTwoIncrements"); } @Test - public void testZoomByNonPowerOfTwoIncrements() throws Exception { - sdkTester.assertSdkTestRunPasses("testZoomByNonPowerOfTwoIncrements"); + public void testZoomByNonPowerOfTwoIncrements() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testZoomByNonPowerOfTwoIncrements"); } @Test - public void testScaleChangeCallbackMatchesGetScale() throws Exception { - sdkTester.assertSdkTestRunPasses("testScaleChangeCallbackMatchesGetScale"); + public void testScaleChangeCallbackMatchesGetScale() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testScaleChangeCallbackMatchesGetScale"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkServiceWorkerWebSettingsTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkServiceWorkerWebSettingsTest.java index e83a333463e..fc6027fc1c9 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkServiceWorkerWebSettingsTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkServiceWorkerWebSettingsTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,30 +30,26 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkServiceWorkerWebSettingsTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.ServiceWorkerWebSettingsTest"); @Test - public void testCacheMode() throws Exception { - sdkTester.assertSdkTestRunPasses("testCacheMode"); + public void testCacheMode() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testCacheMode"); } @Test - public void testAllowContentAccess() throws Exception { - sdkTester.assertSdkTestRunPasses("testAllowContentAccess"); + public void testAllowContentAccess() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAllowContentAccess"); } @Test - public void testAllowFileAccess() throws Exception { - sdkTester.assertSdkTestRunPasses("testAllowFileAccess"); + public void testAllowFileAccess() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testAllowFileAccess"); } @Test - public void testBlockNetworkLoads() throws Exception { - sdkTester.assertSdkTestRunPasses("testBlockNetworkLoads"); + public void testBlockNetworkLoads() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testBlockNetworkLoads"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkWebViewRenderProcessTest.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkWebViewRenderProcessTest.java index 91f3fbedaec..fa31f8ca9cc 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkWebViewRenderProcessTest.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/SdkWebViewRenderProcessTest.java @@ -16,14 +16,12 @@ package android.sdksandbox.webkit.cts; -import android.app.sdksandbox.testutils.testscenario.KeepSdkSandboxAliveRule; import android.platform.test.annotations.AppModeFull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.MediumTest; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,15 +30,11 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class SdkWebViewRenderProcessTest { @ClassRule - public static final KeepSdkSandboxAliveRule sSdkTestSuiteSetup = - new KeepSdkSandboxAliveRule("com.android.emptysdkprovider"); - - @Rule - public final WebViewSandboxTestRule sdkTester = + public static final WebViewSandboxTestRule sSdkTestSuiteSetup = new WebViewSandboxTestRule("android.webkit.cts.WebViewRenderProcessTest"); @Test - public void testGetWebViewRenderProcess() throws Exception { - sdkTester.assertSdkTestRunPasses("testGetWebViewRenderProcess"); + public void testGetWebViewRenderProcess() throws Throwable { + sSdkTestSuiteSetup.assertSdkTestRunPasses("testGetWebViewRenderProcess"); } } diff --git a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/WebViewSandboxTestRule.java b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/WebViewSandboxTestRule.java index 433b5cecf5a..cc9e42233e5 100644 --- a/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/WebViewSandboxTestRule.java +++ b/tests/tests/sdksandbox/webkit/src/android/sdksandbox/webkit/cts/WebViewSandboxTestRule.java @@ -15,8 +15,6 @@ */ package android.sdksandbox.webkit.cts; -import static android.app.sdksandbox.testutils.testscenario.SdkSandboxScenarioRule.ENABLE_LIFE_CYCLE_ANNOTATIONS; - import android.app.sdksandbox.testutils.testscenario.SdkSandboxScenarioRule; import android.os.Bundle; import android.webkit.cts.SharedWebViewTest; diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTestOnMockModem.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTestOnMockModem.java index 36dabae767e..dae46f7fb61 100644 --- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTestOnMockModem.java +++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTestOnMockModem.java @@ -76,11 +76,12 @@ import java.util.Arrays; import java.util.concurrent.Executor; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import java.util.function.BooleanSupplier; /** Test MockModemService interfaces. */ public class TelephonyManagerTestOnMockModem { private static final String TAG = "TelephonyManagerTestOnMockModem"; - private static final long WAIT_TIME_MS = 5000; + private static final long WAIT_TIME_MS = 20000; private static MockModemManager sMockModemManager; private static TelephonyManager sTelephonyManager; private static final String ALLOW_MOCK_MODEM_PROPERTY = "persist.radio.allow_mock_modem"; @@ -97,6 +98,8 @@ public class TelephonyManagerTestOnMockModem { private static ServiceStateListener sServiceStateCallback; private static CallDisconnectCauseListener sCallDisconnectCauseCallback; private static CallStateListener sCallStateCallback; + private int mServiceState; + private int mExpectedRegState; private int mPreciseCallDisconnectCause; private int mCallState; private final Object mServiceStateChangeLock = new Object(); @@ -107,7 +110,7 @@ public class TelephonyManagerTestOnMockModem { private final Executor mCallStateChangeExecutor = Runnable::run; private boolean mResetCarrierStatusInfo; private static String mShaId; - private final int TIMEOUT_IN_SEC_FOR_MODEM_CB = 5; + private static final int TIMEOUT_IN_SEC_FOR_MODEM_CB = 10; @BeforeClass public static void beforeAllTests() throws Exception { Log.d(TAG, "TelephonyManagerTestOnMockModem#beforeAllTests()"); @@ -293,9 +296,7 @@ public class TelephonyManagerTestOnMockModem { int subsLength = allSubs.length; Log.d(TAG, " Active Sub length is " + subsLength); - assertTrue(phoneId <= (subsLength - 1)); - - return allSubs[phoneId]; + return (phoneId < subsLength) ? allSubs[phoneId] : -1; } private int getRegState(int domain, int subId) { @@ -318,6 +319,16 @@ public class TelephonyManagerTestOnMockModem { return reg; } + private void waitForCondition(BooleanSupplier condition, Object lock, long maxWaitMillis) + throws Exception { + long now = System.currentTimeMillis(); + long deadlineTime = now + maxWaitMillis; + while (!condition.getAsBoolean() && now < deadlineTime) { + lock.wait(deadlineTime - now); + now = System.currentTimeMillis(); + } + } + @Test public void testSimStateChange() throws Throwable { Log.d(TAG, "TelephonyManagerTestOnMockModem#testSimStateChange"); @@ -363,37 +374,70 @@ public class TelephonyManagerTestOnMockModem { // Insert a SIM sMockModemManager.insertSimCard(slotId, MOCK_SIM_PROFILE_ID_TWN_CHT); - // Leave Service - Log.d(TAG, "testServiceStateChange: Leave Service"); - sMockModemManager.changeNetworkService(slotId, MOCK_SIM_PROFILE_ID_TWN_CHT, false); - - // Expect: Seaching State TimeUnit.SECONDS.sleep(2); subId = getActiveSubId(slotId); - assertEquals( - getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId), - NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); + assertTrue(subId > 0); + + // Register service state change callback + synchronized (mServiceStateChangeLock) { + mServiceState = ServiceState.STATE_OUT_OF_SERVICE; + mExpectedRegState = ServiceState.STATE_IN_SERVICE; + } + + sServiceStateChangeCallbackHandler.post( + () -> { + sServiceStateCallback = new ServiceStateListener(); + ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn( + sTelephonyManager, + (tm) -> + tm.registerTelephonyCallback( + mServiceStateChangeExecutor, sServiceStateCallback)); + }); // Enter Service Log.d(TAG, "testServiceStateChange: Enter Service"); sMockModemManager.changeNetworkService(slotId, MOCK_SIM_PROFILE_ID_TWN_CHT, true); // Expect: Home State - TimeUnit.SECONDS.sleep(2); + synchronized (mServiceStateChangeLock) { + if (mServiceState != ServiceState.STATE_IN_SERVICE) { + Log.d(TAG, "Wait for service state change to in service"); + waitForCondition( + () -> (ServiceState.STATE_IN_SERVICE == mServiceState), + mServiceStateChangeLock, + WAIT_TIME_MS); + } + } assertEquals( getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId), NetworkRegistrationInfo.REGISTRATION_STATE_HOME); // Leave Service + synchronized (mServiceStateChangeLock) { + mExpectedRegState = ServiceState.STATE_OUT_OF_SERVICE; + } + Log.d(TAG, "testServiceStateChange: Leave Service"); sMockModemManager.changeNetworkService(slotId, MOCK_SIM_PROFILE_ID_TWN_CHT, false); // Expect: Seaching State - TimeUnit.SECONDS.sleep(2); + synchronized (mServiceStateChangeLock) { + if (mServiceState != ServiceState.STATE_OUT_OF_SERVICE) { + Log.d(TAG, "Wait for service state change to out of service"); + waitForCondition( + () -> (ServiceState.STATE_OUT_OF_SERVICE == mServiceState), + mServiceStateChangeLock, + WAIT_TIME_MS); + } + } assertEquals( getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId), NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); + // Unregister service state change callback + sTelephonyManager.unregisterTelephonyCallback(sServiceStateCallback); + sServiceStateCallback = null; + // Remove the SIM sMockModemManager.removeSimCard(slotId); } @@ -402,8 +446,12 @@ public class TelephonyManagerTestOnMockModem { implements TelephonyCallback.ServiceStateListener { @Override public void onServiceStateChanged(ServiceState serviceState) { - if (serviceState.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) { - mServiceStateChangeLock.notify(); + Log.d(TAG, "Callback: service state = " + serviceState.getVoiceRegState()); + synchronized (mServiceStateChangeLock) { + mServiceState = serviceState.getVoiceRegState(); + if (serviceState.getVoiceRegState() == mExpectedRegState) { + mServiceStateChangeLock.notify(); + } } } } @@ -448,6 +496,11 @@ public class TelephonyManagerTestOnMockModem { TimeUnit.SECONDS.sleep(1); // Register service state change callback + synchronized (mServiceStateChangeLock) { + mServiceState = ServiceState.STATE_OUT_OF_SERVICE; + mExpectedRegState = ServiceState.STATE_IN_SERVICE; + } + sServiceStateChangeCallbackHandler.post( () -> { sServiceStateCallback = new ServiceStateListener(); @@ -465,11 +518,17 @@ public class TelephonyManagerTestOnMockModem { // Verify service state synchronized (mServiceStateChangeLock) { - Log.d(TAG, "Wait for service state change to in service"); - mServiceStateChangeLock.wait(WAIT_TIME_MS); + if (mServiceState != ServiceState.STATE_IN_SERVICE) { + Log.d(TAG, "Wait for service state change to in service"); + waitForCondition(() -> ( + ServiceState.STATE_IN_SERVICE == mServiceState), + mServiceStateChangeLock, + WAIT_TIME_MS); + } } subId = getActiveSubId(slotId); + assertTrue(subId > 0); assertEquals( getRegState(NetworkRegistrationInfo.DOMAIN_PS, subId), NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); @@ -616,17 +675,25 @@ public class TelephonyManagerTestOnMockModem { sMockModemManager.insertSimCard(slotId_0, MOCK_SIM_PROFILE_ID_TWN_CHT); sMockModemManager.insertSimCard(slotId_1, MOCK_SIM_PROFILE_ID_TWN_FET); - // Expect: Seaching State TimeUnit.SECONDS.sleep(2); subId_0 = getActiveSubId(slotId_0); - assertEquals( - getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_0), - NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); - subId_1 = getActiveSubId(slotId_1); - assertEquals( - getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_1), - NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); + + // Register service state change callback + synchronized (mServiceStateChangeLock) { + mServiceState = ServiceState.STATE_OUT_OF_SERVICE; + mExpectedRegState = ServiceState.STATE_IN_SERVICE; + } + + sServiceStateChangeCallbackHandler.post( + () -> { + sServiceStateCallback = new ServiceStateListener(); + ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn( + sTelephonyManager, + (tm) -> + tm.registerTelephonyCallback( + mServiceStateChangeExecutor, sServiceStateCallback)); + }); // Enter Service Log.d(TAG, "testDsdsServiceStateChange: Enter Service"); @@ -634,29 +701,62 @@ public class TelephonyManagerTestOnMockModem { sMockModemManager.changeNetworkService(slotId_1, MOCK_SIM_PROFILE_ID_TWN_FET, true); // Expect: Home State - TimeUnit.SECONDS.sleep(2); - assertEquals( - getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_0), - NetworkRegistrationInfo.REGISTRATION_STATE_HOME); - assertEquals( - getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_1), - NetworkRegistrationInfo.REGISTRATION_STATE_HOME); + synchronized (mServiceStateChangeLock) { + if (mServiceState != ServiceState.STATE_IN_SERVICE) { + Log.d(TAG, "Wait for service state change to in service"); + waitForCondition( + () -> (ServiceState.STATE_IN_SERVICE == mServiceState), + mServiceStateChangeLock, + WAIT_TIME_MS); + } + } + if (subId_0 > 0) { + assertEquals( + getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_0), + NetworkRegistrationInfo.REGISTRATION_STATE_HOME); + } + if (subId_1 > 0) { + TimeUnit.SECONDS.sleep(2); + assertEquals( + getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_1), + NetworkRegistrationInfo.REGISTRATION_STATE_HOME); + } - TimeUnit.SECONDS.sleep(2); + assertTrue(subId_0 > 0 || subId_1 > 0); // Leave Service + synchronized (mServiceStateChangeLock) { + mExpectedRegState = ServiceState.STATE_OUT_OF_SERVICE; + } + Log.d(TAG, "testDsdsServiceStateChange: Leave Service"); sMockModemManager.changeNetworkService(slotId_0, MOCK_SIM_PROFILE_ID_TWN_CHT, false); sMockModemManager.changeNetworkService(slotId_1, MOCK_SIM_PROFILE_ID_TWN_FET, false); // Expect: Seaching State - TimeUnit.SECONDS.sleep(2); - assertEquals( - getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_0), - NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); - assertEquals( - getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_1), - NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); + synchronized (mServiceStateChangeLock) { + if (mServiceState != ServiceState.STATE_OUT_OF_SERVICE) { + Log.d(TAG, "Wait for service state change to out of service"); + waitForCondition( + () -> (ServiceState.STATE_OUT_OF_SERVICE == mServiceState), + mServiceStateChangeLock, + WAIT_TIME_MS); + } + } + if (subId_0 > 0) { + assertEquals( + getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_0), + NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); + } + if (subId_1 > 0) { + assertEquals( + getRegState(NetworkRegistrationInfo.DOMAIN_CS, subId_1), + NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING); + } + + // Unregister service state change callback + sTelephonyManager.unregisterTelephonyCallback(sServiceStateCallback); + sServiceStateCallback = null; // Remove the SIM sMockModemManager.removeSimCard(slotId_0); diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java index d44cbb03b24..807095192a8 100644 --- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java +++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java @@ -113,6 +113,7 @@ public class WebSettingsTest extends SharedWebViewTest { public void tearDown() throws Exception { if (mWebServer != null) { mWebServer.shutdown(); + mWebServer = null; } if (mOnUiThread != null) { mOnUiThread.cleanUp(); diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewZoomTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewZoomTest.java index 6b8ea8de9f8..009b77eefd0 100644 --- a/tests/tests/webkit/src/android/webkit/cts/WebViewZoomTest.java +++ b/tests/tests/webkit/src/android/webkit/cts/WebViewZoomTest.java @@ -86,6 +86,7 @@ public class WebViewZoomTest extends SharedWebViewTest{ } if (mWebServer != null) { mWebServer.shutdown(); + mWebServer = null; } mActivity = null; diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiLocationInfoBackgroundTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiLocationInfoBackgroundTest.java index 77eb96ee900..f3ae6834438 100644 --- a/tests/tests/wifi/src/android/net/wifi/cts/WifiLocationInfoBackgroundTest.java +++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiLocationInfoBackgroundTest.java @@ -39,6 +39,7 @@ import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.rule.ActivityTestRule; import com.android.compatibility.common.util.ApiTest; +import com.android.compatibility.common.util.NonMainlineTest; import com.android.compatibility.common.util.PollingCheck; import com.android.compatibility.common.util.ShellIdentityUtils; import com.android.compatibility.common.util.SystemUtil; @@ -57,6 +58,7 @@ import java.util.List; @LargeTest @RunWith(AndroidJUnit4.class) @ApiTest(apis = {"Manifest.permission#ACCESS_BACKGROUND_LOCATION"}) +@NonMainlineTest public class WifiLocationInfoBackgroundTest extends WifiJUnit4TestBase{ private static final String TAG = "WifiLocationInfoTest"; diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java index 53072f8e808..7a38d8d8dcd 100644 --- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java +++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java @@ -5913,7 +5913,7 @@ public class WifiManagerTest extends WifiJUnit4TestBase { // Supplicant V2 is supported if the vendor partition indicates API > T. boolean halSupport = PropertyUtil.isVendorApiLevelNewerThan(Build.VERSION_CODES.TIRAMISU); boolean featureFlagEnabled = DeviceConfig.getBoolean(DEVICE_CONFIG_NAMESPACE, - "application_qos_policy_api_enabled", false); + "application_qos_policy_api_enabled", true); return overlayEnabled && featureFlagEnabled && halSupport; } |