diff --git a/tests/app/Android.mk b/tests/app/Android.mk deleted file mode 100644 index c0c0ccfc852..00000000000 --- a/tests/app/Android.mk +++ /dev/null @@ -1,27 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# We only want this apk build for tests. -LOCAL_MODULE_TAGS := tests -LOCAL_CERTIFICATE := platform - -LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle - -LOCAL_STATIC_JAVA_LIBRARIES := \ - android-support-test \ - mockito-target \ - espresso-core \ - espresso-contrib-nodep \ - espresso-intents-nodep \ - ub-uiautomator \ - truth-prebuilt \ - legacy-android-test - -# Include all test java files. -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := SettingsTests - -LOCAL_INSTRUMENTATION_FOR := Settings - -include $(BUILD_PACKAGE) diff --git a/tests/app/AndroidManifest.xml b/tests/app/AndroidManifest.xml deleted file mode 100644 index 6659e5ff184..00000000000 --- a/tests/app/AndroidManifest.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/app/src/com/android/settings/notification/SoundSettingsIntegrationTest.java b/tests/app/src/com/android/settings/notification/SoundSettingsIntegrationTest.java deleted file mode 100644 index dff7e611bee..00000000000 --- a/tests/app/src/com/android/settings/notification/SoundSettingsIntegrationTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2016 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 com.android.settings.notification; - -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; -import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withText; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.containsString; - -import android.content.Context; -import android.media.AudioManager; -import android.support.test.espresso.contrib.RecyclerViewActions; -import android.support.test.filters.SmallTest; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; -import com.android.settings.R; -import com.android.settings.Settings; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(AndroidJUnit4.class) -@SmallTest -public class SoundSettingsIntegrationTest { - - private AudioManager mAudioManager; - private final String TRUNCATED_SUMMARY = "Ring volume at"; - - @Rule - public ActivityTestRule mActivityRule = - new ActivityTestRule<>(Settings.class, true); - - @Test - public void soundPreferenceShowsCorrectSummaryOnSilentMode() { - mAudioManager = (AudioManager) mActivityRule.getActivity().getApplicationContext() - .getSystemService(Context.AUDIO_SERVICE); - mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT); - onView(withId(R.id.dashboard_container)) - .perform(RecyclerViewActions.scrollTo( - hasDescendant(withText(R.string.sound_settings)))); - onView(withText(R.string.sound_settings_summary_silent)).check(matches(isDisplayed())); - } - - @Test - public void soundPreferenceShowsCorrectSummaryOnVibrateMode() { - mAudioManager = (AudioManager) mActivityRule.getActivity().getApplicationContext() - .getSystemService(Context.AUDIO_SERVICE); - mAudioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); - onView(withId(R.id.dashboard_container)).perform(RecyclerViewActions - .scrollTo(hasDescendant(withText(R.string.sound_settings)))); - onView(withText(R.string.sound_settings_summary_vibrate)).check(matches(isDisplayed())); - } - - @Test - public void soundPreferenceShowsCorrectSummaryOnMaxVolume() { - mAudioManager = (AudioManager) mActivityRule.getActivity().getApplicationContext() - .getSystemService(Context.AUDIO_SERVICE); - mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL); - mAudioManager.setStreamVolume(AudioManager.STREAM_RING, - mAudioManager.getStreamMaxVolume(AudioManager.STREAM_RING), 0); - onView(withId(R.id.dashboard_container)) - .perform(RecyclerViewActions.scrollTo( - hasDescendant(withText(R.string.sound_settings)))); - onView(withText(containsString(TRUNCATED_SUMMARY))).check(matches(isDisplayed())); - } -} \ No newline at end of file diff --git a/tests/app/src/com/android/settings/tests/DashboardAdapterTest.java b/tests/app/src/com/android/settings/tests/DashboardAdapterTest.java deleted file mode 100644 index 4b8e6cf4bc4..00000000000 --- a/tests/app/src/com/android/settings/tests/DashboardAdapterTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2016 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 com.android.settings.tests; - -import android.app.Instrumentation; -import android.content.Context; -import android.content.Intent; -import android.provider.Settings; -import android.support.test.InstrumentationRegistry; -import android.support.test.filters.SmallTest; -import android.support.test.runner.AndroidJUnit4; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import com.android.settings.R; - -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.*; -import static android.support.test.espresso.matcher.ViewMatchers.Visibility.VISIBLE; -import static org.hamcrest.core.AllOf.allOf; - -@RunWith(AndroidJUnit4.class) -@SmallTest -public class DashboardAdapterTest { - @Before - public void SetUp() { - Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); - instrumentation.startActivitySync(new Intent(Settings - .ACTION_SETTINGS)); - } - - @Test - public void testTileConsistency_ToggleSuggestionsAndOpenBluetooth_shouldInBluetooth() - throws Exception{ - final Context context = InstrumentationRegistry.getTargetContext(); - - onView(allOf(withText(context.getString(R.string.suggestions_title)), - withEffectiveVisibility(VISIBLE))).perform(click()); - onView(allOf(withText(context.getString(R.string.bluetooth_settings)), - withEffectiveVisibility(VISIBLE))).perform(click()); - - // It should go to Bluetooth sub page, not other page or crash - onView(allOf(withText(context.getString(R.string.bluetooth_settings)), - withEffectiveVisibility(VISIBLE))).check(matches(isDisplayed())); - - } -} diff --git a/tests/unit/Android.mk b/tests/unit/Android.mk index b75a592c85b..a91dcb1539e 100644 --- a/tests/unit/Android.mk +++ b/tests/unit/Android.mk @@ -14,6 +14,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ mockito-target-minus-junit4 \ truth-prebuilt \ ub-uiautomator \ + espresso-contrib-nodep \ espresso-intents-nodep \ diff --git a/tests/unit/AndroidManifest.xml b/tests/unit/AndroidManifest.xml index c4cae0c3f87..65ed661eff8 100644 --- a/tests/unit/AndroidManifest.xml +++ b/tests/unit/AndroidManifest.xml @@ -17,8 +17,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/app/res/drawable-hdpi/ic_settings_applications.png b/tests/unit/res/drawable-hdpi/ic_settings_applications.png similarity index 100% rename from tests/app/res/drawable-hdpi/ic_settings_applications.png rename to tests/unit/res/drawable-hdpi/ic_settings_applications.png diff --git a/tests/app/res/drawable-mdpi/ic_settings_applications.png b/tests/unit/res/drawable-mdpi/ic_settings_applications.png similarity index 100% rename from tests/app/res/drawable-mdpi/ic_settings_applications.png rename to tests/unit/res/drawable-mdpi/ic_settings_applications.png diff --git a/tests/app/res/drawable-xhdpi/ic_settings_applications.png b/tests/unit/res/drawable-xhdpi/ic_settings_applications.png similarity index 100% rename from tests/app/res/drawable-xhdpi/ic_settings_applications.png rename to tests/unit/res/drawable-xhdpi/ic_settings_applications.png diff --git a/tests/app/res/layout/bluetooth_request_permission_test.xml b/tests/unit/res/layout/bluetooth_request_permission_test.xml similarity index 100% rename from tests/app/res/layout/bluetooth_request_permission_test.xml rename to tests/unit/res/layout/bluetooth_request_permission_test.xml diff --git a/tests/app/res/layout/manufacturer_main.xml b/tests/unit/res/layout/manufacturer_main.xml similarity index 100% rename from tests/app/res/layout/manufacturer_main.xml rename to tests/unit/res/layout/manufacturer_main.xml diff --git a/tests/app/res/layout/operator_main.xml b/tests/unit/res/layout/operator_main.xml similarity index 100% rename from tests/app/res/layout/operator_main.xml rename to tests/unit/res/layout/operator_main.xml diff --git a/tests/app/res/values-af/strings.xml b/tests/unit/res/values-af/strings.xml similarity index 100% rename from tests/app/res/values-af/strings.xml rename to tests/unit/res/values-af/strings.xml diff --git a/tests/app/res/values-am/strings.xml b/tests/unit/res/values-am/strings.xml similarity index 100% rename from tests/app/res/values-am/strings.xml rename to tests/unit/res/values-am/strings.xml diff --git a/tests/app/res/values-ar/strings.xml b/tests/unit/res/values-ar/strings.xml similarity index 100% rename from tests/app/res/values-ar/strings.xml rename to tests/unit/res/values-ar/strings.xml diff --git a/tests/app/res/values-az/strings.xml b/tests/unit/res/values-az/strings.xml similarity index 100% rename from tests/app/res/values-az/strings.xml rename to tests/unit/res/values-az/strings.xml diff --git a/tests/app/res/values-b+sr+Latn/strings.xml b/tests/unit/res/values-b+sr+Latn/strings.xml similarity index 100% rename from tests/app/res/values-b+sr+Latn/strings.xml rename to tests/unit/res/values-b+sr+Latn/strings.xml diff --git a/tests/app/res/values-be/strings.xml b/tests/unit/res/values-be/strings.xml similarity index 100% rename from tests/app/res/values-be/strings.xml rename to tests/unit/res/values-be/strings.xml diff --git a/tests/app/res/values-bg/strings.xml b/tests/unit/res/values-bg/strings.xml similarity index 100% rename from tests/app/res/values-bg/strings.xml rename to tests/unit/res/values-bg/strings.xml diff --git a/tests/app/res/values-bn/strings.xml b/tests/unit/res/values-bn/strings.xml similarity index 100% rename from tests/app/res/values-bn/strings.xml rename to tests/unit/res/values-bn/strings.xml diff --git a/tests/app/res/values-bs/strings.xml b/tests/unit/res/values-bs/strings.xml similarity index 100% rename from tests/app/res/values-bs/strings.xml rename to tests/unit/res/values-bs/strings.xml diff --git a/tests/app/res/values-ca/strings.xml b/tests/unit/res/values-ca/strings.xml similarity index 100% rename from tests/app/res/values-ca/strings.xml rename to tests/unit/res/values-ca/strings.xml diff --git a/tests/app/res/values-cs/strings.xml b/tests/unit/res/values-cs/strings.xml similarity index 100% rename from tests/app/res/values-cs/strings.xml rename to tests/unit/res/values-cs/strings.xml diff --git a/tests/app/res/values-da/strings.xml b/tests/unit/res/values-da/strings.xml similarity index 100% rename from tests/app/res/values-da/strings.xml rename to tests/unit/res/values-da/strings.xml diff --git a/tests/app/res/values-de/strings.xml b/tests/unit/res/values-de/strings.xml similarity index 100% rename from tests/app/res/values-de/strings.xml rename to tests/unit/res/values-de/strings.xml diff --git a/tests/app/res/values-el/strings.xml b/tests/unit/res/values-el/strings.xml similarity index 100% rename from tests/app/res/values-el/strings.xml rename to tests/unit/res/values-el/strings.xml diff --git a/tests/app/res/values-en-rAU/strings.xml b/tests/unit/res/values-en-rAU/strings.xml similarity index 100% rename from tests/app/res/values-en-rAU/strings.xml rename to tests/unit/res/values-en-rAU/strings.xml diff --git a/tests/app/res/values-en-rCA/strings.xml b/tests/unit/res/values-en-rCA/strings.xml similarity index 100% rename from tests/app/res/values-en-rCA/strings.xml rename to tests/unit/res/values-en-rCA/strings.xml diff --git a/tests/app/res/values-en-rGB/strings.xml b/tests/unit/res/values-en-rGB/strings.xml similarity index 100% rename from tests/app/res/values-en-rGB/strings.xml rename to tests/unit/res/values-en-rGB/strings.xml diff --git a/tests/app/res/values-en-rIN/strings.xml b/tests/unit/res/values-en-rIN/strings.xml similarity index 100% rename from tests/app/res/values-en-rIN/strings.xml rename to tests/unit/res/values-en-rIN/strings.xml diff --git a/tests/app/res/values-en-rXC/strings.xml b/tests/unit/res/values-en-rXC/strings.xml similarity index 100% rename from tests/app/res/values-en-rXC/strings.xml rename to tests/unit/res/values-en-rXC/strings.xml diff --git a/tests/app/res/values-es-rUS/strings.xml b/tests/unit/res/values-es-rUS/strings.xml similarity index 100% rename from tests/app/res/values-es-rUS/strings.xml rename to tests/unit/res/values-es-rUS/strings.xml diff --git a/tests/app/res/values-es/strings.xml b/tests/unit/res/values-es/strings.xml similarity index 100% rename from tests/app/res/values-es/strings.xml rename to tests/unit/res/values-es/strings.xml diff --git a/tests/app/res/values-et/strings.xml b/tests/unit/res/values-et/strings.xml similarity index 100% rename from tests/app/res/values-et/strings.xml rename to tests/unit/res/values-et/strings.xml diff --git a/tests/app/res/values-eu/strings.xml b/tests/unit/res/values-eu/strings.xml similarity index 100% rename from tests/app/res/values-eu/strings.xml rename to tests/unit/res/values-eu/strings.xml diff --git a/tests/app/res/values-fa/strings.xml b/tests/unit/res/values-fa/strings.xml similarity index 100% rename from tests/app/res/values-fa/strings.xml rename to tests/unit/res/values-fa/strings.xml diff --git a/tests/app/res/values-fi/strings.xml b/tests/unit/res/values-fi/strings.xml similarity index 100% rename from tests/app/res/values-fi/strings.xml rename to tests/unit/res/values-fi/strings.xml diff --git a/tests/app/res/values-fr-rCA/strings.xml b/tests/unit/res/values-fr-rCA/strings.xml similarity index 100% rename from tests/app/res/values-fr-rCA/strings.xml rename to tests/unit/res/values-fr-rCA/strings.xml diff --git a/tests/app/res/values-fr/strings.xml b/tests/unit/res/values-fr/strings.xml similarity index 100% rename from tests/app/res/values-fr/strings.xml rename to tests/unit/res/values-fr/strings.xml diff --git a/tests/app/res/values-gl/strings.xml b/tests/unit/res/values-gl/strings.xml similarity index 100% rename from tests/app/res/values-gl/strings.xml rename to tests/unit/res/values-gl/strings.xml diff --git a/tests/app/res/values-gu/strings.xml b/tests/unit/res/values-gu/strings.xml similarity index 100% rename from tests/app/res/values-gu/strings.xml rename to tests/unit/res/values-gu/strings.xml diff --git a/tests/app/res/values-hi/strings.xml b/tests/unit/res/values-hi/strings.xml similarity index 100% rename from tests/app/res/values-hi/strings.xml rename to tests/unit/res/values-hi/strings.xml diff --git a/tests/app/res/values-hr/strings.xml b/tests/unit/res/values-hr/strings.xml similarity index 100% rename from tests/app/res/values-hr/strings.xml rename to tests/unit/res/values-hr/strings.xml diff --git a/tests/app/res/values-hu/strings.xml b/tests/unit/res/values-hu/strings.xml similarity index 100% rename from tests/app/res/values-hu/strings.xml rename to tests/unit/res/values-hu/strings.xml diff --git a/tests/app/res/values-hy/strings.xml b/tests/unit/res/values-hy/strings.xml similarity index 100% rename from tests/app/res/values-hy/strings.xml rename to tests/unit/res/values-hy/strings.xml diff --git a/tests/app/res/values-in/strings.xml b/tests/unit/res/values-in/strings.xml similarity index 100% rename from tests/app/res/values-in/strings.xml rename to tests/unit/res/values-in/strings.xml diff --git a/tests/app/res/values-is/strings.xml b/tests/unit/res/values-is/strings.xml similarity index 100% rename from tests/app/res/values-is/strings.xml rename to tests/unit/res/values-is/strings.xml diff --git a/tests/app/res/values-it/strings.xml b/tests/unit/res/values-it/strings.xml similarity index 100% rename from tests/app/res/values-it/strings.xml rename to tests/unit/res/values-it/strings.xml diff --git a/tests/app/res/values-iw/strings.xml b/tests/unit/res/values-iw/strings.xml similarity index 100% rename from tests/app/res/values-iw/strings.xml rename to tests/unit/res/values-iw/strings.xml diff --git a/tests/app/res/values-ja/strings.xml b/tests/unit/res/values-ja/strings.xml similarity index 100% rename from tests/app/res/values-ja/strings.xml rename to tests/unit/res/values-ja/strings.xml diff --git a/tests/app/res/values-ka/strings.xml b/tests/unit/res/values-ka/strings.xml similarity index 100% rename from tests/app/res/values-ka/strings.xml rename to tests/unit/res/values-ka/strings.xml diff --git a/tests/app/res/values-kk/strings.xml b/tests/unit/res/values-kk/strings.xml similarity index 100% rename from tests/app/res/values-kk/strings.xml rename to tests/unit/res/values-kk/strings.xml diff --git a/tests/app/res/values-km/strings.xml b/tests/unit/res/values-km/strings.xml similarity index 100% rename from tests/app/res/values-km/strings.xml rename to tests/unit/res/values-km/strings.xml diff --git a/tests/app/res/values-kn/strings.xml b/tests/unit/res/values-kn/strings.xml similarity index 100% rename from tests/app/res/values-kn/strings.xml rename to tests/unit/res/values-kn/strings.xml diff --git a/tests/app/res/values-ko/strings.xml b/tests/unit/res/values-ko/strings.xml similarity index 100% rename from tests/app/res/values-ko/strings.xml rename to tests/unit/res/values-ko/strings.xml diff --git a/tests/app/res/values-ky/strings.xml b/tests/unit/res/values-ky/strings.xml similarity index 100% rename from tests/app/res/values-ky/strings.xml rename to tests/unit/res/values-ky/strings.xml diff --git a/tests/app/res/values-lo/strings.xml b/tests/unit/res/values-lo/strings.xml similarity index 100% rename from tests/app/res/values-lo/strings.xml rename to tests/unit/res/values-lo/strings.xml diff --git a/tests/app/res/values-lt/strings.xml b/tests/unit/res/values-lt/strings.xml similarity index 100% rename from tests/app/res/values-lt/strings.xml rename to tests/unit/res/values-lt/strings.xml diff --git a/tests/app/res/values-lv/strings.xml b/tests/unit/res/values-lv/strings.xml similarity index 100% rename from tests/app/res/values-lv/strings.xml rename to tests/unit/res/values-lv/strings.xml diff --git a/tests/app/res/values-mk/strings.xml b/tests/unit/res/values-mk/strings.xml similarity index 100% rename from tests/app/res/values-mk/strings.xml rename to tests/unit/res/values-mk/strings.xml diff --git a/tests/app/res/values-ml/strings.xml b/tests/unit/res/values-ml/strings.xml similarity index 100% rename from tests/app/res/values-ml/strings.xml rename to tests/unit/res/values-ml/strings.xml diff --git a/tests/app/res/values-mn/strings.xml b/tests/unit/res/values-mn/strings.xml similarity index 100% rename from tests/app/res/values-mn/strings.xml rename to tests/unit/res/values-mn/strings.xml diff --git a/tests/app/res/values-mr/strings.xml b/tests/unit/res/values-mr/strings.xml similarity index 100% rename from tests/app/res/values-mr/strings.xml rename to tests/unit/res/values-mr/strings.xml diff --git a/tests/app/res/values-ms/strings.xml b/tests/unit/res/values-ms/strings.xml similarity index 100% rename from tests/app/res/values-ms/strings.xml rename to tests/unit/res/values-ms/strings.xml diff --git a/tests/app/res/values-my/strings.xml b/tests/unit/res/values-my/strings.xml similarity index 100% rename from tests/app/res/values-my/strings.xml rename to tests/unit/res/values-my/strings.xml diff --git a/tests/app/res/values-nb/strings.xml b/tests/unit/res/values-nb/strings.xml similarity index 100% rename from tests/app/res/values-nb/strings.xml rename to tests/unit/res/values-nb/strings.xml diff --git a/tests/app/res/values-ne/strings.xml b/tests/unit/res/values-ne/strings.xml similarity index 100% rename from tests/app/res/values-ne/strings.xml rename to tests/unit/res/values-ne/strings.xml diff --git a/tests/app/res/values-nl/strings.xml b/tests/unit/res/values-nl/strings.xml similarity index 100% rename from tests/app/res/values-nl/strings.xml rename to tests/unit/res/values-nl/strings.xml diff --git a/tests/app/res/values-pa/strings.xml b/tests/unit/res/values-pa/strings.xml similarity index 100% rename from tests/app/res/values-pa/strings.xml rename to tests/unit/res/values-pa/strings.xml diff --git a/tests/app/res/values-pl/strings.xml b/tests/unit/res/values-pl/strings.xml similarity index 100% rename from tests/app/res/values-pl/strings.xml rename to tests/unit/res/values-pl/strings.xml diff --git a/tests/app/res/values-pt-rBR/strings.xml b/tests/unit/res/values-pt-rBR/strings.xml similarity index 100% rename from tests/app/res/values-pt-rBR/strings.xml rename to tests/unit/res/values-pt-rBR/strings.xml diff --git a/tests/app/res/values-pt-rPT/strings.xml b/tests/unit/res/values-pt-rPT/strings.xml similarity index 100% rename from tests/app/res/values-pt-rPT/strings.xml rename to tests/unit/res/values-pt-rPT/strings.xml diff --git a/tests/app/res/values-pt/strings.xml b/tests/unit/res/values-pt/strings.xml similarity index 100% rename from tests/app/res/values-pt/strings.xml rename to tests/unit/res/values-pt/strings.xml diff --git a/tests/app/res/values-ro/strings.xml b/tests/unit/res/values-ro/strings.xml similarity index 100% rename from tests/app/res/values-ro/strings.xml rename to tests/unit/res/values-ro/strings.xml diff --git a/tests/app/res/values-ru/strings.xml b/tests/unit/res/values-ru/strings.xml similarity index 100% rename from tests/app/res/values-ru/strings.xml rename to tests/unit/res/values-ru/strings.xml diff --git a/tests/app/res/values-si/strings.xml b/tests/unit/res/values-si/strings.xml similarity index 100% rename from tests/app/res/values-si/strings.xml rename to tests/unit/res/values-si/strings.xml diff --git a/tests/app/res/values-sk/strings.xml b/tests/unit/res/values-sk/strings.xml similarity index 100% rename from tests/app/res/values-sk/strings.xml rename to tests/unit/res/values-sk/strings.xml diff --git a/tests/app/res/values-sl/strings.xml b/tests/unit/res/values-sl/strings.xml similarity index 100% rename from tests/app/res/values-sl/strings.xml rename to tests/unit/res/values-sl/strings.xml diff --git a/tests/app/res/values-sq/strings.xml b/tests/unit/res/values-sq/strings.xml similarity index 100% rename from tests/app/res/values-sq/strings.xml rename to tests/unit/res/values-sq/strings.xml diff --git a/tests/app/res/values-sr/strings.xml b/tests/unit/res/values-sr/strings.xml similarity index 100% rename from tests/app/res/values-sr/strings.xml rename to tests/unit/res/values-sr/strings.xml diff --git a/tests/app/res/values-sv/strings.xml b/tests/unit/res/values-sv/strings.xml similarity index 100% rename from tests/app/res/values-sv/strings.xml rename to tests/unit/res/values-sv/strings.xml diff --git a/tests/app/res/values-sw/strings.xml b/tests/unit/res/values-sw/strings.xml similarity index 100% rename from tests/app/res/values-sw/strings.xml rename to tests/unit/res/values-sw/strings.xml diff --git a/tests/app/res/values-ta/strings.xml b/tests/unit/res/values-ta/strings.xml similarity index 100% rename from tests/app/res/values-ta/strings.xml rename to tests/unit/res/values-ta/strings.xml diff --git a/tests/app/res/values-te/strings.xml b/tests/unit/res/values-te/strings.xml similarity index 100% rename from tests/app/res/values-te/strings.xml rename to tests/unit/res/values-te/strings.xml diff --git a/tests/app/res/values-th/strings.xml b/tests/unit/res/values-th/strings.xml similarity index 100% rename from tests/app/res/values-th/strings.xml rename to tests/unit/res/values-th/strings.xml diff --git a/tests/app/res/values-tl/strings.xml b/tests/unit/res/values-tl/strings.xml similarity index 100% rename from tests/app/res/values-tl/strings.xml rename to tests/unit/res/values-tl/strings.xml diff --git a/tests/app/res/values-tr/strings.xml b/tests/unit/res/values-tr/strings.xml similarity index 100% rename from tests/app/res/values-tr/strings.xml rename to tests/unit/res/values-tr/strings.xml diff --git a/tests/app/res/values-uk/strings.xml b/tests/unit/res/values-uk/strings.xml similarity index 100% rename from tests/app/res/values-uk/strings.xml rename to tests/unit/res/values-uk/strings.xml diff --git a/tests/app/res/values-ur/strings.xml b/tests/unit/res/values-ur/strings.xml similarity index 100% rename from tests/app/res/values-ur/strings.xml rename to tests/unit/res/values-ur/strings.xml diff --git a/tests/app/res/values-uz/strings.xml b/tests/unit/res/values-uz/strings.xml similarity index 100% rename from tests/app/res/values-uz/strings.xml rename to tests/unit/res/values-uz/strings.xml diff --git a/tests/app/res/values-vi/strings.xml b/tests/unit/res/values-vi/strings.xml similarity index 100% rename from tests/app/res/values-vi/strings.xml rename to tests/unit/res/values-vi/strings.xml diff --git a/tests/app/res/values-zh-rCN/strings.xml b/tests/unit/res/values-zh-rCN/strings.xml similarity index 100% rename from tests/app/res/values-zh-rCN/strings.xml rename to tests/unit/res/values-zh-rCN/strings.xml diff --git a/tests/app/res/values-zh-rHK/strings.xml b/tests/unit/res/values-zh-rHK/strings.xml similarity index 100% rename from tests/app/res/values-zh-rHK/strings.xml rename to tests/unit/res/values-zh-rHK/strings.xml diff --git a/tests/app/res/values-zh-rTW/strings.xml b/tests/unit/res/values-zh-rTW/strings.xml similarity index 100% rename from tests/app/res/values-zh-rTW/strings.xml rename to tests/unit/res/values-zh-rTW/strings.xml diff --git a/tests/app/res/values-zu/strings.xml b/tests/unit/res/values-zu/strings.xml similarity index 100% rename from tests/app/res/values-zu/strings.xml rename to tests/unit/res/values-zu/strings.xml diff --git a/tests/app/res/values/strings.xml b/tests/unit/res/values/strings.xml similarity index 100% rename from tests/app/res/values/strings.xml rename to tests/unit/res/values/strings.xml diff --git a/tests/app/src/com/android/settings/SettingsHookTests.java b/tests/unit/src/com/android/settings/SettingsHookTests.java similarity index 97% rename from tests/app/src/com/android/settings/SettingsHookTests.java rename to tests/unit/src/com/android/settings/SettingsHookTests.java index 4dfd4846e50..cc7aa89981a 100644 --- a/tests/app/src/com/android/settings/SettingsHookTests.java +++ b/tests/unit/src/com/android/settings/SettingsHookTests.java @@ -17,8 +17,6 @@ package com.android.settings; import com.android.settings.Settings; -import com.android.settings.tests.Manufacturer; -import com.android.settings.tests.Operator; import android.content.Context; import android.content.Intent; @@ -41,7 +39,7 @@ import java.util.List; */ public class SettingsHookTests extends ActivityInstrumentationTestCase2 { - private static final String PACKAGE_NAME = "com.android.settings.tests"; + private static final String PACKAGE_NAME = "com.android.settings.tests.unit"; private static final String KEY_SETTINGS_ROOT = "parent"; private static final String KEY_SETTINGS_OPERATOR = "operator_settings"; diff --git a/tests/app/src/com/android/settings/applications/DefaultAppSettingsTest.java b/tests/unit/src/com/android/settings/applications/DefaultAppSettingsTest.java similarity index 93% rename from tests/app/src/com/android/settings/applications/DefaultAppSettingsTest.java rename to tests/unit/src/com/android/settings/applications/DefaultAppSettingsTest.java index bd03bc94077..eafe32a5014 100644 --- a/tests/app/src/com/android/settings/applications/DefaultAppSettingsTest.java +++ b/tests/unit/src/com/android/settings/applications/DefaultAppSettingsTest.java @@ -67,6 +67,9 @@ public class DefaultAppSettingsTest extends InstrumentationTestCase { final String titleApps = mTargetContext.getResources().getString( R.string.app_and_notification_dashboard_title); mDevice.findObject(new UiSelector().text(titleApps)).click(); + final String titleAdvance = mTargetContext.getResources().getString( + R.string.advanced_section_header); + mDevice.findObject(new UiSelector().text(titleAdvance)).click(); final String titleDefaultApps = mTargetContext.getResources().getString( R.string.app_default_dashboard_title); mDevice.findObject(new UiSelector().text(titleDefaultApps)).click(); diff --git a/tests/app/src/com/android/settings/applications/ExternalSourcesSettingsTest.java b/tests/unit/src/com/android/settings/applications/ExternalSourcesSettingsTest.java similarity index 100% rename from tests/app/src/com/android/settings/applications/ExternalSourcesSettingsTest.java rename to tests/unit/src/com/android/settings/applications/ExternalSourcesSettingsTest.java diff --git a/tests/app/src/com/android/settings/deviceinfo/StorageDashboardFragmentEspressoTest.java b/tests/unit/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java similarity index 91% rename from tests/app/src/com/android/settings/deviceinfo/StorageDashboardFragmentEspressoTest.java rename to tests/unit/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java index b43a5ba882d..00b710f8029 100644 --- a/tests/app/src/com/android/settings/deviceinfo/StorageDashboardFragmentEspressoTest.java +++ b/tests/unit/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java @@ -19,7 +19,7 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @SmallTest -public class StorageDashboardFragmentEspressoTest { +public class StorageDashboardFragmentTest { public static final String EXTRA_KEY = ":settings:show_fragment"; @@ -30,7 +30,7 @@ public class StorageDashboardFragmentEspressoTest { @Test public void testStorageManagePreference_canClickTextView() throws InterruptedException { // Click on the actual textbox instead of just somewhere in the preference - onView(withText(R.string.storage_menu_manage)).perform(click()); + onView(withText(R.string.automatic_storage_manager_preference_title)).perform(click()); // Check that it worked by seeing if we switched screens intended(hasExtra(equalTo(EXTRA_KEY), diff --git a/tests/app/src/com/android/settings/fuelgauge/PowerUsageSummaryUiTest.java b/tests/unit/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java similarity index 97% rename from tests/app/src/com/android/settings/fuelgauge/PowerUsageSummaryUiTest.java rename to tests/unit/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java index 6c372c5f5f1..9cbd74229bf 100644 --- a/tests/app/src/com/android/settings/fuelgauge/PowerUsageSummaryUiTest.java +++ b/tests/unit/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java @@ -34,7 +34,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @SmallTest -public class PowerUsageSummaryUiTest { +public class PowerUsageSummaryTest { private static final String BATTERY_INTENT = "android.intent.action.POWER_USAGE_SUMMARY"; @Before diff --git a/tests/app/src/com/android/settings/notification/ZenModeSettingsIntegrationTest.java b/tests/unit/src/com/android/settings/notification/ZenModeSettingsIntegrationTest.java similarity index 100% rename from tests/app/src/com/android/settings/notification/ZenModeSettingsIntegrationTest.java rename to tests/unit/src/com/android/settings/notification/ZenModeSettingsIntegrationTest.java diff --git a/tests/app/src/com/android/settings/password/ChooseLockGenericTest.java b/tests/unit/src/com/android/settings/password/ChooseLockGenericTest.java similarity index 96% rename from tests/app/src/com/android/settings/password/ChooseLockGenericTest.java rename to tests/unit/src/com/android/settings/password/ChooseLockGenericTest.java index 40b69a400a0..32b47df9cbe 100644 --- a/tests/app/src/com/android/settings/password/ChooseLockGenericTest.java +++ b/tests/unit/src/com/android/settings/password/ChooseLockGenericTest.java @@ -170,6 +170,14 @@ public class ChooseLockGenericTest { enterTestPin(view); enterTestPin(view); + // Dismiss notifications setting + view = new UiObject(new UiSelector() + .resourceId(mSettingPackage + ":id/redaction_done_button")); + if (view.waitForExists(TIMEOUT)) { + view.click(); + mDevice.waitForIdle(); + } + mDevice.pressBack(); assertThat(getTargetContext().getSystemService(KeyguardManager.class).isDeviceSecure()) diff --git a/tests/app/src/com/android/settings/password/ChooseLockPasswordTest.java b/tests/unit/src/com/android/settings/password/ChooseLockPasswordTest.java similarity index 100% rename from tests/app/src/com/android/settings/password/ChooseLockPasswordTest.java rename to tests/unit/src/com/android/settings/password/ChooseLockPasswordTest.java diff --git a/tests/app/src/com/android/settings/password/ConfirmLockPasswordTest.java b/tests/unit/src/com/android/settings/password/ConfirmLockPasswordTest.java similarity index 100% rename from tests/app/src/com/android/settings/password/ConfirmLockPasswordTest.java rename to tests/unit/src/com/android/settings/password/ConfirmLockPasswordTest.java diff --git a/tests/app/src/com/android/settings/password/SetupChooseLockPasswordAppTest.java b/tests/unit/src/com/android/settings/password/SetupChooseLockPasswordAppTest.java similarity index 100% rename from tests/app/src/com/android/settings/password/SetupChooseLockPasswordAppTest.java rename to tests/unit/src/com/android/settings/password/SetupChooseLockPasswordAppTest.java diff --git a/tests/app/src/com/android/settings/tests/BluetoothRequestPermissionTest.java b/tests/unit/src/com/android/settings/tests/BluetoothRequestPermissionTest.java similarity index 99% rename from tests/app/src/com/android/settings/tests/BluetoothRequestPermissionTest.java rename to tests/unit/src/com/android/settings/tests/BluetoothRequestPermissionTest.java index a2cdafe8aa4..442f4b6aa65 100644 --- a/tests/app/src/com/android/settings/tests/BluetoothRequestPermissionTest.java +++ b/tests/unit/src/com/android/settings/tests/BluetoothRequestPermissionTest.java @@ -30,6 +30,7 @@ import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; +import com.android.settings.tests.unit.R; public class BluetoothRequestPermissionTest extends Activity { private static final String TAG = "BluetoothRequestPermissionTest"; diff --git a/tests/app/src/com/android/settings/tests/DrawOverlayDetailsTest.java b/tests/unit/src/com/android/settings/tests/DrawOverlayDetailsTest.java similarity index 84% rename from tests/app/src/com/android/settings/tests/DrawOverlayDetailsTest.java rename to tests/unit/src/com/android/settings/tests/DrawOverlayDetailsTest.java index 234f8e6b151..3e00a45f11f 100644 --- a/tests/app/src/com/android/settings/tests/DrawOverlayDetailsTest.java +++ b/tests/unit/src/com/android/settings/tests/DrawOverlayDetailsTest.java @@ -21,9 +21,13 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.support.test.InstrumentationRegistry; +import android.support.test.uiautomator.UiDevice; + import org.junit.runner.RunWith; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; +import android.support.test.uiautomator.UiScrollable; +import android.support.test.uiautomator.UiSelector; import org.junit.Test; import com.android.settings.R; @@ -52,8 +56,16 @@ public class DrawOverlayDetailsTest { final String appName = (String) packageManager.getApplicationLabel(packageManager .getApplicationInfo(PACKAGE_SYSTEM_UI, PackageManager.GET_META_DATA)); + final UiDevice device = UiDevice.getInstance(instrumentation); + device.waitForIdle(); + openActionBarOverflowOrOptionsMenu(targetContext); onView(withText(targetContext.getString(R.string.menu_show_system))).perform(click()); + device.waitForIdle(); + + final UiScrollable settings = new UiScrollable( + new UiSelector().packageName(targetContext.getPackageName()).scrollable(true)); + settings.scrollTextIntoView(appName); onView(withText(appName)).perform(click()); onView(withText(targetContext.getString(R.string.permit_draw_overlay))).check(matches (not(isEnabled()))); diff --git a/tests/app/src/com/android/settings/tests/KeepOnScreenTest.java b/tests/unit/src/com/android/settings/tests/KeepOnScreenTest.java similarity index 100% rename from tests/app/src/com/android/settings/tests/KeepOnScreenTest.java rename to tests/unit/src/com/android/settings/tests/KeepOnScreenTest.java diff --git a/tests/app/src/com/android/settings/tests/Manufacturer.java b/tests/unit/src/com/android/settings/tests/Manufacturer.java similarity index 95% rename from tests/app/src/com/android/settings/tests/Manufacturer.java rename to tests/unit/src/com/android/settings/tests/Manufacturer.java index 692e6a8c287..a708d1b3d97 100644 --- a/tests/app/src/com/android/settings/tests/Manufacturer.java +++ b/tests/unit/src/com/android/settings/tests/Manufacturer.java @@ -18,6 +18,7 @@ package com.android.settings.tests; import android.app.Activity; import android.os.Bundle; +import com.android.settings.tests.unit.R; public class Manufacturer extends Activity { diff --git a/tests/app/src/com/android/settings/tests/Operator.java b/tests/unit/src/com/android/settings/tests/Operator.java similarity index 95% rename from tests/app/src/com/android/settings/tests/Operator.java rename to tests/unit/src/com/android/settings/tests/Operator.java index 8a34363da2a..94bcc78441b 100644 --- a/tests/app/src/com/android/settings/tests/Operator.java +++ b/tests/unit/src/com/android/settings/tests/Operator.java @@ -18,6 +18,7 @@ package com.android.settings.tests; import android.app.Activity; import android.os.Bundle; +import com.android.settings.tests.unit.R; public class Operator extends Activity { diff --git a/tests/app/src/com/android/settings/tests/SettingsLaunchPerformance.java b/tests/unit/src/com/android/settings/tests/SettingsLaunchPerformance.java similarity index 100% rename from tests/app/src/com/android/settings/tests/SettingsLaunchPerformance.java rename to tests/unit/src/com/android/settings/tests/SettingsLaunchPerformance.java diff --git a/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java index 26a711b863e..b311816c82f 100644 --- a/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java +++ b/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java @@ -66,15 +66,15 @@ public class WifiTetherSettingsTest { @Test public void launchTetherSettings_shouldHaveAllFields() { launchWifiTetherActivity(); - onView(withText("Network name")).check(matches(isDisplayed())); - onView(withText("Password")).check(matches(isDisplayed())); - onView(withText("Select AP Band")).check(matches(isDisplayed())); + onView(withText("Hotspot name")).check(matches(isDisplayed())); + onView(withText("Hotspot password")).check(matches(isDisplayed())); + onView(withText("AP Band")).check(matches(isDisplayed())); } private void launchWifiTetherActivity() { mInstrumentation.startActivitySync(mTetherActivityIntent); - onView(withText("Portable Wi‑Fi hotspot")).perform(); - UiObject2 item = mDevice.wait(Until.findObject(By.text("Portable Wi‑Fi hotspot")), TIMEOUT); + onView(withText("Wi‑Fi hotspot")).perform(); + UiObject2 item = mDevice.wait(Until.findObject(By.text("Wi‑Fi hotspot")), TIMEOUT); item.click(); } }