Merge "Add AppModeFull to dEQP level tests" into stage-aosp-sc-ts-dev am: dfa9bcf0a2 am: db37f9dffb
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/15785049
Change-Id: If798319a267dfc9313b8e9801ac18596ae330a1b
diff --git a/hostsidetests/angle/Android.bp b/hostsidetests/angle/Android.bp
index 794ea69..47ce8e0 100644
--- a/hostsidetests/angle/Android.bp
+++ b/hostsidetests/angle/Android.bp
@@ -20,7 +20,6 @@
name: "CtsAngleIntegrationHostTestCases",
defaults: ["cts_defaults"],
srcs: ["src/**/*.java"],
- java_resource_dirs: ["assets/"],
// tag this module as a cts test artifact
test_suites: [
"cts",
diff --git a/hostsidetests/angle/assets/emptyRules.json b/hostsidetests/angle/assets/emptyRules.json
deleted file mode 100644
index 77fa0c0..0000000
--- a/hostsidetests/angle/assets/emptyRules.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "Rules":[
- {
- "Rule":"Default Rule (i.e. use native driver)",
- "UseANGLE":false
- }
- ]
-}
diff --git a/hostsidetests/angle/assets/enableAngleRules.json b/hostsidetests/angle/assets/enableAngleRules.json
deleted file mode 100644
index 90f4893..0000000
--- a/hostsidetests/angle/assets/enableAngleRules.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "Rules":[
- {
- "Rule":"Default Rule (i.e. use native driver)",
- "UseANGLE":false
- },
- {
- "Rule":"Supported application(s) (e.g. Maps on Google devices)",
- "UseANGLE":true,
- "Applications":[
- {
- "AppName":"com.android.angleIntegrationTest.driverTest"
- }
- ]
- }
- ]
-}
diff --git a/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java b/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java
index 45bb43e..3fb5c6c 100644
--- a/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java
+++ b/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java
@@ -55,7 +55,6 @@
ANGLE_DRIVER_TEST_PKG + "/com.android.angleIntegrationTest.common.AngleIntegrationTestActivity";
static final String ANGLE_DRIVER_TEST_SEC_ACTIVITY =
ANGLE_DRIVER_TEST_SEC_PKG + "/com.android.angleIntegrationTest.common.AngleIntegrationTestActivity";
- static final String ANGLE_MAIN_ACTIVTY = "android.app.action.ANGLE_FOR_ANDROID";
enum OpenGlDriverChoice {
DEFAULT,
@@ -116,12 +115,6 @@
return (driverProp != null) && (driverProp.equals("angle"));
}
- static void startActivity(ITestDevice device, String action) throws Exception {
- // Run the ANGLE activity so it'll clear up any 'default' settings.
- device.executeShellCommand("am start --user " + device.getCurrentUser() +
- " -S -W -a \"" + action + "\"");
- }
-
static void stopPackage(ITestDevice device, String pkgName) throws Exception {
device.executeShellCommand("am force-stop " + pkgName);
}
diff --git a/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java b/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java
index 9431088..12770b1 100644
--- a/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java
+++ b/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java
@@ -62,8 +62,6 @@
setAndValidateAngleDevOptionPkgDriver(pkgName, sDriverGlobalSettingMap.get(driver));
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
CLog.logAndDisplay(LogLevel.INFO, "Validating driver selection (" +
driver + ") with method '" + sDriverTestMethodMap.get(driver) + "'");
@@ -288,8 +286,6 @@
sDriverGlobalSettingMap.get(OpenGlDriverChoice.ANGLE) + "," +
sDriverGlobalSettingMap.get(firstDriver));
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
CLog.logAndDisplay(LogLevel.INFO, "Validating driver selection (" +
firstDriver + ") with method '" + sDriverTestMethodMap.get(firstDriver) + "'");
@@ -302,8 +298,6 @@
sDriverGlobalSettingMap.get(OpenGlDriverChoice.ANGLE) + "," +
sDriverGlobalSettingMap.get(secondDriver));
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
CLog.logAndDisplay(LogLevel.INFO, "Validating driver selection (" +
secondDriver + ") with method '" + sDriverTestMethodMap.get(secondDriver) + "'");
@@ -311,9 +305,6 @@
ANGLE_DRIVER_TEST_SEC_PKG + "." + ANGLE_DRIVER_TEST_CLASS,
sDriverTestMethodMap.get(secondDriver));
- // Make sure the first PKG's driver value was not modified
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
String devOptionPkg = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_PKGS);
String devOptionValue = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_VALUES);
CLog.logAndDisplay(LogLevel.INFO, "Validating: PKG name = '" +
@@ -327,129 +318,6 @@
}
/**
- * Test setting a driver to 'default' does not keep the value in the settings when the ANGLE
- * activity runs and cleans things up.
- */
- @Test
- public void testDefaultNotInSettings() throws Exception {
- Assume.assumeTrue(isAngleLoadable(getDevice()));
-
- // Install the package so the setting isn't removed because the package isn't present.
- installApp(ANGLE_DRIVER_TEST_APP);
-
- setAndValidateAngleDevOptionPkgDriver(ANGLE_DRIVER_TEST_PKG,
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.DEFAULT));
-
- // Run the ANGLE activity so it'll clear up any 'default' settings.
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
- String devOptionPkg = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_PKGS);
- String devOptionValue = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_VALUES);
- CLog.logAndDisplay(LogLevel.INFO, "Validating: PKG name = '" +
- devOptionPkg + "', driver value = '" + devOptionValue + "'");
-
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_PKGS + " = '" + devOptionPkg + "'",
- "", devOptionPkg);
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_VALUES + " = '" + devOptionValue + "'",
- "", devOptionValue);
- }
-
- /**
- * Test uninstalled PKGs have their settings removed.
- */
- @Test
- public void testUninstalledPkgsNotInSettings() throws Exception {
- Assume.assumeTrue(isAngleLoadable(getDevice()));
-
- uninstallPackage(getDevice(), ANGLE_DRIVER_TEST_PKG);
-
- setAndValidateAngleDevOptionPkgDriver(ANGLE_DRIVER_TEST_PKG,
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.NATIVE));
-
- // Run the ANGLE activity so it'll clear up any 'default' settings.
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
- String devOptionPkg = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_PKGS);
- String devOptionValue = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_VALUES);
- CLog.logAndDisplay(LogLevel.INFO, "Validating: PKG name = '" +
- devOptionPkg + "', driver value = '" + devOptionValue + "'");
-
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_PKGS + " = '" + devOptionPkg + "'",
- "", devOptionPkg);
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_VALUES + " = '" + devOptionValue + "'",
- "", devOptionValue);
- }
-
- /**
- * Test different PKGs can have different developer option values.
- * Primary: ANGLE
- * Secondary: Default
- *
- * Verify the PKG set to 'default' is removed from the settings.
- */
- @Test
- public void testMultipleDevOptionsAngleDefault() throws Exception {
- Assume.assumeTrue(isAngleLoadable(getDevice()));
-
- installApp(ANGLE_DRIVER_TEST_APP);
- installApp(ANGLE_DRIVER_TEST_SEC_APP);
-
- setAndValidateAngleDevOptionPkgDriver(ANGLE_DRIVER_TEST_PKG + "," + ANGLE_DRIVER_TEST_SEC_PKG,
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.ANGLE) + "," +
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.DEFAULT));
-
- // Run the ANGLE activity so it'll clear up any 'default' settings.
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
- String devOption = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_PKGS);
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_PKGS + " = '" + devOption + "'",
- ANGLE_DRIVER_TEST_PKG, devOption);
-
- devOption = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_VALUES);
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_VALUES + " = '" + devOption + "'",
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.ANGLE), devOption);
- }
-
- /**
- * Test different PKGs can have different developer option values.
- * Primary: ANGLE
- * Secondary: Default
- *
- * Verify the uninstalled PKG is removed from the settings.
- */
- @Test
- public void testMultipleDevOptionsAngleNativeUninstall() throws Exception {
- Assume.assumeTrue(isAngleLoadable(getDevice()));
-
- installApp(ANGLE_DRIVER_TEST_SEC_APP);
-
- setAndValidateAngleDevOptionPkgDriver(ANGLE_DRIVER_TEST_PKG + "," + ANGLE_DRIVER_TEST_SEC_PKG,
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.ANGLE) + "," +
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.NATIVE));
-
- // Run the ANGLE activity so it'll clear up any 'default' settings.
- startActivity(getDevice(), ANGLE_MAIN_ACTIVTY);
-
- String devOptionPkg = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_PKGS);
- String devOptionValue = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_DRIVER_VALUES);
- CLog.logAndDisplay(LogLevel.INFO, "Validating: PKG name = '" +
- devOptionPkg + "', driver value = '" + devOptionValue + "'");
-
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_PKGS + " = '" + devOptionPkg + "'",
- ANGLE_DRIVER_TEST_SEC_PKG, devOptionPkg);
- Assert.assertEquals(
- "Invalid developer option: " + SETTINGS_GLOBAL_DRIVER_VALUES + " = '" + devOptionValue + "'",
- sDriverGlobalSettingMap.get(OpenGlDriverChoice.NATIVE), devOptionValue);
- }
-
- /**
* Test that the "ANGLE In Use" dialog box can be enabled when ANGLE is used.
*
* We can't actually make sure the dialog box shows up, just that enabling it and attempting to
diff --git a/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java b/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
deleted file mode 100644
index 4f0859e..0000000
--- a/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2018 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.angle.cts;
-
-import static android.angle.cts.CtsAngleCommon.*;
-
-import com.google.common.io.ByteStreams;
-import com.google.common.io.Files;
-
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-/**
- * Tests ANGLE Rules File Opt-In/Out functionality.
- */
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class CtsAngleRulesFileTest extends BaseHostJUnit4Test {
-
- private final String TAG = this.getClass().getSimpleName();
-
- private File mRulesFile;
- private String mAllowList;
-
- // Rules Files
- private static final String RULES_FILE_EMPTY = "emptyRules.json";
- private static final String RULES_FILE_ENABLE_ANGLE = "enableAngleRules.json";
-
- private void pushRulesFile(String hostFilename) throws Exception {
- byte[] rulesFileBytes =
- ByteStreams.toByteArray(getClass().getResourceAsStream("/" + hostFilename));
-
- Assert.assertTrue("Loaded empty rules file", rulesFileBytes.length > 0); // validity check
- mRulesFile = File.createTempFile("rulesFile", "tempRules.json");
- Files.write(rulesFileBytes, mRulesFile);
-
- Assert.assertTrue(getDevice().pushFile(mRulesFile, DEVICE_TEMP_RULES_FILE_PATH));
-
- setProperty(getDevice(), PROPERTY_TEMP_RULES_FILE, DEVICE_TEMP_RULES_FILE_PATH);
- }
-
- private void setAndValidateAngleDevOptionAllowlist(String allowList) throws Exception {
- // SETTINGS_GLOBAL_ALLOWLIST
- setGlobalSetting(getDevice(), SETTINGS_GLOBAL_ALLOWLIST, allowList);
-
- String devOption = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_ALLOWLIST);
- Assert.assertEquals(
- "Developer option '" + SETTINGS_GLOBAL_ALLOWLIST +
- "' was not set correctly: '" + devOption + "'",
- allowList, devOption);
- }
-
- @Before
- public void setUp() throws Exception {
- clearSettings(getDevice());
-
- mAllowList = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_ALLOWLIST);
-
- final String allowlist = ANGLE_DRIVER_TEST_PKG + "," + ANGLE_DRIVER_TEST_SEC_PKG;
- setAndValidateAngleDevOptionAllowlist(allowlist);
- }
-
- @After
- public void tearDown() throws Exception {
- clearSettings(getDevice());
-
- setAndValidateAngleDevOptionAllowlist(mAllowList);
-
- FileUtil.deleteFile(mRulesFile);
- }
-
- /**
- * Test ANGLE is not loaded when an empty rules file is used.
- */
- @Test
- public void testEmptyRulesFile() throws Exception {
- Assume.assumeTrue(isAngleLoadable(getDevice()));
- Assume.assumeFalse(isNativeDriverAngle(getDevice()));
-
- pushRulesFile(RULES_FILE_EMPTY);
-
- installPackage(ANGLE_DRIVER_TEST_APP);
-
- runDeviceTests(ANGLE_DRIVER_TEST_PKG,
- ANGLE_DRIVER_TEST_PKG + "." + ANGLE_DRIVER_TEST_CLASS,
- ANGLE_DRIVER_TEST_NATIVE_METHOD);
- }
-
- /**
- * Test ANGLE is loaded for only the PKG the rules file specifies.
- */
- @Test
- public void testEnableAngleRulesFile() throws Exception {
- Assume.assumeTrue(isAngleLoadable(getDevice()));
- Assume.assumeFalse(isNativeDriverAngle(getDevice()));
-
- pushRulesFile(RULES_FILE_ENABLE_ANGLE);
-
- installPackage(ANGLE_DRIVER_TEST_APP);
- installPackage(ANGLE_DRIVER_TEST_SEC_APP);
-
- runDeviceTests(ANGLE_DRIVER_TEST_PKG,
- ANGLE_DRIVER_TEST_PKG + "." + ANGLE_DRIVER_TEST_CLASS,
- ANGLE_DRIVER_TEST_ANGLE_METHOD);
-
- runDeviceTests(ANGLE_DRIVER_TEST_SEC_PKG,
- ANGLE_DRIVER_TEST_SEC_PKG + "." + ANGLE_DRIVER_TEST_CLASS,
- ANGLE_DRIVER_TEST_NATIVE_METHOD);
- }
-}
diff --git a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
index 6db2d4c..55fb3d0 100644
--- a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
@@ -29,8 +29,6 @@
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
-import com.android.compatibility.common.util.RequiredServiceRule;
-
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.MediumTest;
import androidx.test.runner.AndroidJUnit4;
@@ -40,8 +38,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.util.Arrays;
-
/**
* Tests related SettingsPanels:
*
@@ -56,6 +52,7 @@
private static final String RESOURCE_DONE = "done";
private static final String RESOURCE_SEE_MORE = "see_more";
private static final String RESOURCE_TITLE = "panel_title";
+ private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
private String mSettingsPackage;
private String mLauncherPackage;
@@ -100,12 +97,12 @@
// Check correct package is opened
@Test
- public void internetPanel_correctPackage() {
- launchInternetPanel();
+ public void internetDialog_correctPackage() {
+ launchInternetDialog();
String currentPackage = mDevice.getCurrentPackageName();
- assertThat(currentPackage).isEqualTo(mSettingsPackage);
+ assertThat(currentPackage).isEqualTo(SYSTEMUI_PACKAGE_NAME);
}
@Test
@@ -137,18 +134,23 @@
}
@Test
- public void internetPanel_doneClosesPanel() {
+ public void internetDialog_doneClosesDialog() {
// Launch panel
- launchInternetPanel();
+ launchInternetDialog();
String currentPackage = mDevice.getCurrentPackageName();
- assertThat(currentPackage).isEqualTo(mSettingsPackage);
+ assertThat(currentPackage).isEqualTo(SYSTEMUI_PACKAGE_NAME);
// Click the done button
- pressDone();
+ if (mHasTouchScreen) {
+ mDevice.findObject(By.res(SYSTEMUI_PACKAGE_NAME, RESOURCE_DONE)).click();
+ mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
+ } else {
+ mDevice.pressBack();
+ }
// Assert that we have left the panel
currentPackage = mDevice.getCurrentPackageName();
- assertThat(currentPackage).isNotEqualTo(mSettingsPackage);
+ assertThat(currentPackage).isNotEqualTo(SYSTEMUI_PACKAGE_NAME);
}
@Test
@@ -252,8 +254,19 @@
launchPanel(Settings.Panel.ACTION_VOLUME);
}
- private void launchInternetPanel() {
- launchPanel(Settings.Panel.ACTION_INTERNET_CONNECTIVITY);
+ private void launchInternetDialog() {
+ // Start from the home screen
+ mDevice.pressHome();
+ mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
+
+ Intent intent = new Intent(Settings.Panel.ACTION_INTERNET_CONNECTIVITY);
+ intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
+ .setPackage(SYSTEMUI_PACKAGE_NAME);
+
+ mContext.sendBroadcast(intent);
+
+ // Wait for the app to appear
+ mDevice.wait(Until.hasObject(By.pkg(SYSTEMUI_PACKAGE_NAME).depth(0)), TIMEOUT);
}
private void launchNfcPanel() {