diff --git a/tests/Android.mk b/tests/Android.mk index 204b8c3f390..fd297e35397 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -1,19 +1,5 @@ -LOCAL_PATH:= $(call my-dir) +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 - -# 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) +# Include all makefiles in subdirectories +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/tests/README b/tests/README deleted file mode 100644 index 9af7c8a4e9b..00000000000 --- a/tests/README +++ /dev/null @@ -1,17 +0,0 @@ -To build the tests you can use the following command at the root of your android source tree -$ make SettingsTests - -The test apk then needs to be installed onto your test device via for example -$ adb install -r out/target/product/shamu/data/app/SettingsTests/SettingsTests.apk - -To run all tests: -$ adb shell am instrument -w com.android.settings.tests/android.support.test.runner.AndroidJUnitRunner - -To run all tests in a specific class: -$ adb shell am instrument -w -e class com.android.managedprovisioning. com.android.managedprovisioning.tests/android.test.InstrumentationTestRunner - -To run a specific test: -$ adb shell am instrument -w -e class com.android.settings. com.android.settings.tests/android.support.test.runner.AndroidJUnitRunner - -More general information can be found at -http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html diff --git a/tests/app/Android.mk b/tests/app/Android.mk new file mode 100644 index 00000000000..bb31539d4ad --- /dev/null +++ b/tests/app/Android.mk @@ -0,0 +1,17 @@ +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 + +# 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/AndroidManifest.xml b/tests/app/AndroidManifest.xml similarity index 90% rename from tests/AndroidManifest.xml rename to tests/app/AndroidManifest.xml index fe9520ecf9d..2ef96cfcc64 100644 --- a/tests/AndroidManifest.xml +++ b/tests/app/AndroidManifest.xml @@ -51,9 +51,14 @@ - + android:label="Settings App Tests"> + + + diff --git a/tests/res/drawable-hdpi/ic_settings_applications.png b/tests/app/res/drawable-hdpi/ic_settings_applications.png similarity index 100% rename from tests/res/drawable-hdpi/ic_settings_applications.png rename to tests/app/res/drawable-hdpi/ic_settings_applications.png diff --git a/tests/res/drawable-mdpi/ic_settings_applications.png b/tests/app/res/drawable-mdpi/ic_settings_applications.png similarity index 100% rename from tests/res/drawable-mdpi/ic_settings_applications.png rename to tests/app/res/drawable-mdpi/ic_settings_applications.png diff --git a/tests/res/drawable-xhdpi/ic_settings_applications.png b/tests/app/res/drawable-xhdpi/ic_settings_applications.png similarity index 100% rename from tests/res/drawable-xhdpi/ic_settings_applications.png rename to tests/app/res/drawable-xhdpi/ic_settings_applications.png diff --git a/tests/res/layout/bluetooth_request_permission_test.xml b/tests/app/res/layout/bluetooth_request_permission_test.xml similarity index 100% rename from tests/res/layout/bluetooth_request_permission_test.xml rename to tests/app/res/layout/bluetooth_request_permission_test.xml diff --git a/tests/res/layout/manufacturer_main.xml b/tests/app/res/layout/manufacturer_main.xml similarity index 100% rename from tests/res/layout/manufacturer_main.xml rename to tests/app/res/layout/manufacturer_main.xml diff --git a/tests/res/layout/operator_main.xml b/tests/app/res/layout/operator_main.xml similarity index 100% rename from tests/res/layout/operator_main.xml rename to tests/app/res/layout/operator_main.xml diff --git a/tests/res/values-af/strings.xml b/tests/app/res/values-af/strings.xml similarity index 100% rename from tests/res/values-af/strings.xml rename to tests/app/res/values-af/strings.xml diff --git a/tests/res/values-am/strings.xml b/tests/app/res/values-am/strings.xml similarity index 100% rename from tests/res/values-am/strings.xml rename to tests/app/res/values-am/strings.xml diff --git a/tests/res/values-ar/strings.xml b/tests/app/res/values-ar/strings.xml similarity index 100% rename from tests/res/values-ar/strings.xml rename to tests/app/res/values-ar/strings.xml diff --git a/tests/res/values-az-rAZ/strings.xml b/tests/app/res/values-az-rAZ/strings.xml similarity index 100% rename from tests/res/values-az-rAZ/strings.xml rename to tests/app/res/values-az-rAZ/strings.xml diff --git a/tests/res/values-b+sr+Latn/strings.xml b/tests/app/res/values-b+sr+Latn/strings.xml similarity index 100% rename from tests/res/values-b+sr+Latn/strings.xml rename to tests/app/res/values-b+sr+Latn/strings.xml diff --git a/tests/res/values-bg/strings.xml b/tests/app/res/values-bg/strings.xml similarity index 100% rename from tests/res/values-bg/strings.xml rename to tests/app/res/values-bg/strings.xml diff --git a/tests/res/values-bn-rBD/strings.xml b/tests/app/res/values-bn-rBD/strings.xml similarity index 100% rename from tests/res/values-bn-rBD/strings.xml rename to tests/app/res/values-bn-rBD/strings.xml diff --git a/tests/res/values-ca/strings.xml b/tests/app/res/values-ca/strings.xml similarity index 100% rename from tests/res/values-ca/strings.xml rename to tests/app/res/values-ca/strings.xml diff --git a/tests/res/values-cs/strings.xml b/tests/app/res/values-cs/strings.xml similarity index 100% rename from tests/res/values-cs/strings.xml rename to tests/app/res/values-cs/strings.xml diff --git a/tests/res/values-da/strings.xml b/tests/app/res/values-da/strings.xml similarity index 100% rename from tests/res/values-da/strings.xml rename to tests/app/res/values-da/strings.xml diff --git a/tests/res/values-de/strings.xml b/tests/app/res/values-de/strings.xml similarity index 100% rename from tests/res/values-de/strings.xml rename to tests/app/res/values-de/strings.xml diff --git a/tests/res/values-el/strings.xml b/tests/app/res/values-el/strings.xml similarity index 100% rename from tests/res/values-el/strings.xml rename to tests/app/res/values-el/strings.xml diff --git a/tests/res/values-en-rAU/strings.xml b/tests/app/res/values-en-rAU/strings.xml similarity index 100% rename from tests/res/values-en-rAU/strings.xml rename to tests/app/res/values-en-rAU/strings.xml diff --git a/tests/res/values-en-rGB/strings.xml b/tests/app/res/values-en-rGB/strings.xml similarity index 100% rename from tests/res/values-en-rGB/strings.xml rename to tests/app/res/values-en-rGB/strings.xml diff --git a/tests/res/values-en-rIN/strings.xml b/tests/app/res/values-en-rIN/strings.xml similarity index 100% rename from tests/res/values-en-rIN/strings.xml rename to tests/app/res/values-en-rIN/strings.xml diff --git a/tests/res/values-es-rUS/strings.xml b/tests/app/res/values-es-rUS/strings.xml similarity index 100% rename from tests/res/values-es-rUS/strings.xml rename to tests/app/res/values-es-rUS/strings.xml diff --git a/tests/res/values-es/strings.xml b/tests/app/res/values-es/strings.xml similarity index 100% rename from tests/res/values-es/strings.xml rename to tests/app/res/values-es/strings.xml diff --git a/tests/res/values-et-rEE/strings.xml b/tests/app/res/values-et-rEE/strings.xml similarity index 100% rename from tests/res/values-et-rEE/strings.xml rename to tests/app/res/values-et-rEE/strings.xml diff --git a/tests/res/values-eu-rES/strings.xml b/tests/app/res/values-eu-rES/strings.xml similarity index 100% rename from tests/res/values-eu-rES/strings.xml rename to tests/app/res/values-eu-rES/strings.xml diff --git a/tests/res/values-fa/strings.xml b/tests/app/res/values-fa/strings.xml similarity index 100% rename from tests/res/values-fa/strings.xml rename to tests/app/res/values-fa/strings.xml diff --git a/tests/res/values-fi/strings.xml b/tests/app/res/values-fi/strings.xml similarity index 100% rename from tests/res/values-fi/strings.xml rename to tests/app/res/values-fi/strings.xml diff --git a/tests/res/values-fr-rCA/strings.xml b/tests/app/res/values-fr-rCA/strings.xml similarity index 100% rename from tests/res/values-fr-rCA/strings.xml rename to tests/app/res/values-fr-rCA/strings.xml diff --git a/tests/res/values-fr/strings.xml b/tests/app/res/values-fr/strings.xml similarity index 100% rename from tests/res/values-fr/strings.xml rename to tests/app/res/values-fr/strings.xml diff --git a/tests/res/values-gl-rES/strings.xml b/tests/app/res/values-gl-rES/strings.xml similarity index 100% rename from tests/res/values-gl-rES/strings.xml rename to tests/app/res/values-gl-rES/strings.xml diff --git a/tests/res/values-gu-rIN/strings.xml b/tests/app/res/values-gu-rIN/strings.xml similarity index 100% rename from tests/res/values-gu-rIN/strings.xml rename to tests/app/res/values-gu-rIN/strings.xml diff --git a/tests/res/values-hi/strings.xml b/tests/app/res/values-hi/strings.xml similarity index 100% rename from tests/res/values-hi/strings.xml rename to tests/app/res/values-hi/strings.xml diff --git a/tests/res/values-hr/strings.xml b/tests/app/res/values-hr/strings.xml similarity index 100% rename from tests/res/values-hr/strings.xml rename to tests/app/res/values-hr/strings.xml diff --git a/tests/res/values-hu/strings.xml b/tests/app/res/values-hu/strings.xml similarity index 100% rename from tests/res/values-hu/strings.xml rename to tests/app/res/values-hu/strings.xml diff --git a/tests/res/values-hy-rAM/strings.xml b/tests/app/res/values-hy-rAM/strings.xml similarity index 100% rename from tests/res/values-hy-rAM/strings.xml rename to tests/app/res/values-hy-rAM/strings.xml diff --git a/tests/res/values-in/strings.xml b/tests/app/res/values-in/strings.xml similarity index 100% rename from tests/res/values-in/strings.xml rename to tests/app/res/values-in/strings.xml diff --git a/tests/res/values-is-rIS/strings.xml b/tests/app/res/values-is-rIS/strings.xml similarity index 100% rename from tests/res/values-is-rIS/strings.xml rename to tests/app/res/values-is-rIS/strings.xml diff --git a/tests/res/values-it/strings.xml b/tests/app/res/values-it/strings.xml similarity index 100% rename from tests/res/values-it/strings.xml rename to tests/app/res/values-it/strings.xml diff --git a/tests/res/values-iw/strings.xml b/tests/app/res/values-iw/strings.xml similarity index 100% rename from tests/res/values-iw/strings.xml rename to tests/app/res/values-iw/strings.xml diff --git a/tests/res/values-ja/strings.xml b/tests/app/res/values-ja/strings.xml similarity index 100% rename from tests/res/values-ja/strings.xml rename to tests/app/res/values-ja/strings.xml diff --git a/tests/res/values-ka-rGE/strings.xml b/tests/app/res/values-ka-rGE/strings.xml similarity index 100% rename from tests/res/values-ka-rGE/strings.xml rename to tests/app/res/values-ka-rGE/strings.xml diff --git a/tests/res/values-kk-rKZ/strings.xml b/tests/app/res/values-kk-rKZ/strings.xml similarity index 100% rename from tests/res/values-kk-rKZ/strings.xml rename to tests/app/res/values-kk-rKZ/strings.xml diff --git a/tests/res/values-km-rKH/strings.xml b/tests/app/res/values-km-rKH/strings.xml similarity index 100% rename from tests/res/values-km-rKH/strings.xml rename to tests/app/res/values-km-rKH/strings.xml diff --git a/tests/res/values-kn-rIN/strings.xml b/tests/app/res/values-kn-rIN/strings.xml similarity index 100% rename from tests/res/values-kn-rIN/strings.xml rename to tests/app/res/values-kn-rIN/strings.xml diff --git a/tests/res/values-ko/strings.xml b/tests/app/res/values-ko/strings.xml similarity index 100% rename from tests/res/values-ko/strings.xml rename to tests/app/res/values-ko/strings.xml diff --git a/tests/res/values-lo-rLA/strings.xml b/tests/app/res/values-lo-rLA/strings.xml similarity index 100% rename from tests/res/values-lo-rLA/strings.xml rename to tests/app/res/values-lo-rLA/strings.xml diff --git a/tests/res/values-lt/strings.xml b/tests/app/res/values-lt/strings.xml similarity index 100% rename from tests/res/values-lt/strings.xml rename to tests/app/res/values-lt/strings.xml diff --git a/tests/res/values-lv/strings.xml b/tests/app/res/values-lv/strings.xml similarity index 100% rename from tests/res/values-lv/strings.xml rename to tests/app/res/values-lv/strings.xml diff --git a/tests/res/values-mk-rMK/strings.xml b/tests/app/res/values-mk-rMK/strings.xml similarity index 100% rename from tests/res/values-mk-rMK/strings.xml rename to tests/app/res/values-mk-rMK/strings.xml diff --git a/tests/res/values-ml-rIN/strings.xml b/tests/app/res/values-ml-rIN/strings.xml similarity index 100% rename from tests/res/values-ml-rIN/strings.xml rename to tests/app/res/values-ml-rIN/strings.xml diff --git a/tests/res/values-mn-rMN/strings.xml b/tests/app/res/values-mn-rMN/strings.xml similarity index 100% rename from tests/res/values-mn-rMN/strings.xml rename to tests/app/res/values-mn-rMN/strings.xml diff --git a/tests/res/values-mr-rIN/strings.xml b/tests/app/res/values-mr-rIN/strings.xml similarity index 100% rename from tests/res/values-mr-rIN/strings.xml rename to tests/app/res/values-mr-rIN/strings.xml diff --git a/tests/res/values-ms-rMY/strings.xml b/tests/app/res/values-ms-rMY/strings.xml similarity index 100% rename from tests/res/values-ms-rMY/strings.xml rename to tests/app/res/values-ms-rMY/strings.xml diff --git a/tests/res/values-my-rMM/strings.xml b/tests/app/res/values-my-rMM/strings.xml similarity index 100% rename from tests/res/values-my-rMM/strings.xml rename to tests/app/res/values-my-rMM/strings.xml diff --git a/tests/res/values-nb/strings.xml b/tests/app/res/values-nb/strings.xml similarity index 100% rename from tests/res/values-nb/strings.xml rename to tests/app/res/values-nb/strings.xml diff --git a/tests/res/values-ne-rNP/strings.xml b/tests/app/res/values-ne-rNP/strings.xml similarity index 100% rename from tests/res/values-ne-rNP/strings.xml rename to tests/app/res/values-ne-rNP/strings.xml diff --git a/tests/res/values-nl/strings.xml b/tests/app/res/values-nl/strings.xml similarity index 100% rename from tests/res/values-nl/strings.xml rename to tests/app/res/values-nl/strings.xml diff --git a/tests/res/values-pa-rIN/strings.xml b/tests/app/res/values-pa-rIN/strings.xml similarity index 100% rename from tests/res/values-pa-rIN/strings.xml rename to tests/app/res/values-pa-rIN/strings.xml diff --git a/tests/res/values-pl/strings.xml b/tests/app/res/values-pl/strings.xml similarity index 100% rename from tests/res/values-pl/strings.xml rename to tests/app/res/values-pl/strings.xml diff --git a/tests/res/values-pt-rBR/strings.xml b/tests/app/res/values-pt-rBR/strings.xml similarity index 100% rename from tests/res/values-pt-rBR/strings.xml rename to tests/app/res/values-pt-rBR/strings.xml diff --git a/tests/res/values-pt-rPT/strings.xml b/tests/app/res/values-pt-rPT/strings.xml similarity index 100% rename from tests/res/values-pt-rPT/strings.xml rename to tests/app/res/values-pt-rPT/strings.xml diff --git a/tests/res/values-pt/strings.xml b/tests/app/res/values-pt/strings.xml similarity index 100% rename from tests/res/values-pt/strings.xml rename to tests/app/res/values-pt/strings.xml diff --git a/tests/res/values-ro/strings.xml b/tests/app/res/values-ro/strings.xml similarity index 100% rename from tests/res/values-ro/strings.xml rename to tests/app/res/values-ro/strings.xml diff --git a/tests/res/values-ru/strings.xml b/tests/app/res/values-ru/strings.xml similarity index 100% rename from tests/res/values-ru/strings.xml rename to tests/app/res/values-ru/strings.xml diff --git a/tests/res/values-si-rLK/strings.xml b/tests/app/res/values-si-rLK/strings.xml similarity index 100% rename from tests/res/values-si-rLK/strings.xml rename to tests/app/res/values-si-rLK/strings.xml diff --git a/tests/res/values-sk/strings.xml b/tests/app/res/values-sk/strings.xml similarity index 100% rename from tests/res/values-sk/strings.xml rename to tests/app/res/values-sk/strings.xml diff --git a/tests/res/values-sl/strings.xml b/tests/app/res/values-sl/strings.xml similarity index 100% rename from tests/res/values-sl/strings.xml rename to tests/app/res/values-sl/strings.xml diff --git a/tests/res/values-sq-rAL/strings.xml b/tests/app/res/values-sq-rAL/strings.xml similarity index 100% rename from tests/res/values-sq-rAL/strings.xml rename to tests/app/res/values-sq-rAL/strings.xml diff --git a/tests/res/values-sr/strings.xml b/tests/app/res/values-sr/strings.xml similarity index 100% rename from tests/res/values-sr/strings.xml rename to tests/app/res/values-sr/strings.xml diff --git a/tests/res/values-sv/strings.xml b/tests/app/res/values-sv/strings.xml similarity index 100% rename from tests/res/values-sv/strings.xml rename to tests/app/res/values-sv/strings.xml diff --git a/tests/res/values-sw/strings.xml b/tests/app/res/values-sw/strings.xml similarity index 100% rename from tests/res/values-sw/strings.xml rename to tests/app/res/values-sw/strings.xml diff --git a/tests/res/values-ta-rIN/strings.xml b/tests/app/res/values-ta-rIN/strings.xml similarity index 100% rename from tests/res/values-ta-rIN/strings.xml rename to tests/app/res/values-ta-rIN/strings.xml diff --git a/tests/res/values-te-rIN/strings.xml b/tests/app/res/values-te-rIN/strings.xml similarity index 100% rename from tests/res/values-te-rIN/strings.xml rename to tests/app/res/values-te-rIN/strings.xml diff --git a/tests/res/values-th/strings.xml b/tests/app/res/values-th/strings.xml similarity index 100% rename from tests/res/values-th/strings.xml rename to tests/app/res/values-th/strings.xml diff --git a/tests/res/values-tl/strings.xml b/tests/app/res/values-tl/strings.xml similarity index 100% rename from tests/res/values-tl/strings.xml rename to tests/app/res/values-tl/strings.xml diff --git a/tests/res/values-tr/strings.xml b/tests/app/res/values-tr/strings.xml similarity index 100% rename from tests/res/values-tr/strings.xml rename to tests/app/res/values-tr/strings.xml diff --git a/tests/res/values-uk/strings.xml b/tests/app/res/values-uk/strings.xml similarity index 100% rename from tests/res/values-uk/strings.xml rename to tests/app/res/values-uk/strings.xml diff --git a/tests/res/values-ur-rPK/strings.xml b/tests/app/res/values-ur-rPK/strings.xml similarity index 100% rename from tests/res/values-ur-rPK/strings.xml rename to tests/app/res/values-ur-rPK/strings.xml diff --git a/tests/res/values-uz-rUZ/strings.xml b/tests/app/res/values-uz-rUZ/strings.xml similarity index 100% rename from tests/res/values-uz-rUZ/strings.xml rename to tests/app/res/values-uz-rUZ/strings.xml diff --git a/tests/res/values-vi/strings.xml b/tests/app/res/values-vi/strings.xml similarity index 100% rename from tests/res/values-vi/strings.xml rename to tests/app/res/values-vi/strings.xml diff --git a/tests/res/values-zh-rCN/strings.xml b/tests/app/res/values-zh-rCN/strings.xml similarity index 100% rename from tests/res/values-zh-rCN/strings.xml rename to tests/app/res/values-zh-rCN/strings.xml diff --git a/tests/res/values-zh-rHK/strings.xml b/tests/app/res/values-zh-rHK/strings.xml similarity index 100% rename from tests/res/values-zh-rHK/strings.xml rename to tests/app/res/values-zh-rHK/strings.xml diff --git a/tests/res/values-zh-rTW/strings.xml b/tests/app/res/values-zh-rTW/strings.xml similarity index 100% rename from tests/res/values-zh-rTW/strings.xml rename to tests/app/res/values-zh-rTW/strings.xml diff --git a/tests/res/values-zu/strings.xml b/tests/app/res/values-zu/strings.xml similarity index 100% rename from tests/res/values-zu/strings.xml rename to tests/app/res/values-zu/strings.xml diff --git a/tests/res/values/strings.xml b/tests/app/res/values/strings.xml similarity index 100% rename from tests/res/values/strings.xml rename to tests/app/res/values/strings.xml diff --git a/tests/src/com/android/settings/SettingsHookTests.java b/tests/app/src/com/android/settings/SettingsHookTests.java similarity index 100% rename from tests/src/com/android/settings/SettingsHookTests.java rename to tests/app/src/com/android/settings/SettingsHookTests.java diff --git a/tests/src/com/android/settings/tests/BluetoothRequestPermissionTest.java b/tests/app/src/com/android/settings/tests/BluetoothRequestPermissionTest.java similarity index 100% rename from tests/src/com/android/settings/tests/BluetoothRequestPermissionTest.java rename to tests/app/src/com/android/settings/tests/BluetoothRequestPermissionTest.java diff --git a/tests/src/com/android/settings/tests/Manufacturer.java b/tests/app/src/com/android/settings/tests/Manufacturer.java similarity index 100% rename from tests/src/com/android/settings/tests/Manufacturer.java rename to tests/app/src/com/android/settings/tests/Manufacturer.java diff --git a/tests/src/com/android/settings/tests/Operator.java b/tests/app/src/com/android/settings/tests/Operator.java similarity index 100% rename from tests/src/com/android/settings/tests/Operator.java rename to tests/app/src/com/android/settings/tests/Operator.java diff --git a/tests/src/com/android/settings/tests/SettingsLaunchPerformance.java b/tests/app/src/com/android/settings/tests/SettingsLaunchPerformance.java similarity index 100% rename from tests/src/com/android/settings/tests/SettingsLaunchPerformance.java rename to tests/app/src/com/android/settings/tests/SettingsLaunchPerformance.java diff --git a/tests/src/com/android/settings/vpn2/CertInstallerHelper.java b/tests/app/src/com/android/settings/vpn2/CertInstallerHelper.java similarity index 100% rename from tests/src/com/android/settings/vpn2/CertInstallerHelper.java rename to tests/app/src/com/android/settings/vpn2/CertInstallerHelper.java diff --git a/tests/src/com/android/settings/vpn2/VpnInfo.java b/tests/app/src/com/android/settings/vpn2/VpnInfo.java similarity index 100% rename from tests/src/com/android/settings/vpn2/VpnInfo.java rename to tests/app/src/com/android/settings/vpn2/VpnInfo.java diff --git a/tests/src/com/android/settings/vpn2/VpnProfileParser.java b/tests/app/src/com/android/settings/vpn2/VpnProfileParser.java similarity index 100% rename from tests/src/com/android/settings/vpn2/VpnProfileParser.java rename to tests/app/src/com/android/settings/vpn2/VpnProfileParser.java diff --git a/tests/src/com/android/settings/vpn2/VpnTests.java b/tests/app/src/com/android/settings/vpn2/VpnTests.java similarity index 100% rename from tests/src/com/android/settings/vpn2/VpnTests.java rename to tests/app/src/com/android/settings/vpn2/VpnTests.java diff --git a/tests/unit/Android.mk b/tests/unit/Android.mk new file mode 100644 index 00000000000..3ba4606e6e3 --- /dev/null +++ b/tests/unit/Android.mk @@ -0,0 +1,19 @@ +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 + +LOCAL_STATIC_JAVA_LIBRARIES := android-support-test mockito-target + +# Include all test java files. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := SettingsUnitTests + +LOCAL_INSTRUMENTATION_FOR := Settings + +include $(BUILD_PACKAGE) diff --git a/tests/unit/AndroidManifest.xml b/tests/unit/AndroidManifest.xml new file mode 100644 index 00000000000..c4cae0c3f87 --- /dev/null +++ b/tests/unit/AndroidManifest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + diff --git a/tests/unit/README b/tests/unit/README new file mode 100644 index 00000000000..5184b0724df --- /dev/null +++ b/tests/unit/README @@ -0,0 +1,17 @@ +To build the tests you can use the following command at the root of your android source tree +$ make SettingsUnitTests + +The test apk then needs to be installed onto your test device via for example +$ adb install -r out/target/product/shamu/data/app/SettingsUnitTests/SettingsUnitTests.apk + +To run all tests: +$ adb shell am instrument -w com.android.settings.tests.unit/android.support.test.runner.AndroidJUnitRunner + +To run all tests in a specific class: +$ adb shell am instrument -w -e class com.android.settings. com.android.settings.tests.unit/android.support.test.runner.AndroidJUnitRunner + +To run a specific test: +$ adb shell am instrument -w -e class com.android.settings.# com.android.settings.tests.unit/android.support.test.runner.AndroidJUnitRunner + +More general information can be found at +http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html diff --git a/tests/src/com/android/settings/DeviceInfoSettingsTest.java b/tests/unit/src/com/android/settings/DeviceInfoSettingsTest.java similarity index 96% rename from tests/src/com/android/settings/DeviceInfoSettingsTest.java rename to tests/unit/src/com/android/settings/DeviceInfoSettingsTest.java index abd4d767223..cec3f745441 100644 --- a/tests/src/com/android/settings/DeviceInfoSettingsTest.java +++ b/tests/unit/src/com/android/settings/DeviceInfoSettingsTest.java @@ -17,17 +17,20 @@ package com.android.settings; import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.SmallTest; import com.android.settingslib.DeviceInfoUtils; public class DeviceInfoSettingsTest extends AndroidTestCase { + @SmallTest public void testGetFormattedKernelVersion() throws Exception { if ("Unavailable".equals(DeviceInfoUtils.getFormattedKernelVersion())) { fail("formatKernelVersion can't cope with this device's /proc/version"); } } + @SmallTest public void testFormatKernelVersion() throws Exception { assertEquals("Unavailable", DeviceInfoUtils.formatKernelVersion("")); assertEquals("2.6.38.8-gg784\n" + diff --git a/tests/src/com/android/settings/UtilsTests.java b/tests/unit/src/com/android/settings/UtilsTest.java similarity index 98% rename from tests/src/com/android/settings/UtilsTests.java rename to tests/unit/src/com/android/settings/UtilsTest.java index 9d4a5b83b5f..20e701350a4 100644 --- a/tests/src/com/android/settings/UtilsTests.java +++ b/tests/unit/src/com/android/settings/UtilsTest.java @@ -33,7 +33,7 @@ import java.util.Arrays; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -public class UtilsTests extends AndroidTestCase { +public class UtilsTest extends AndroidTestCase { private static final int TEST_PRIMARY_USER_ID = 10; private static final int TEST_MANAGED_PROFILE_ID = 11; diff --git a/tests/src/com/android/settings/bluetooth/Utf8ByteLengthFilterTest.java b/tests/unit/src/com/android/settings/bluetooth/Utf8ByteLengthFilterTest.java similarity index 98% rename from tests/src/com/android/settings/bluetooth/Utf8ByteLengthFilterTest.java rename to tests/unit/src/com/android/settings/bluetooth/Utf8ByteLengthFilterTest.java index ecbd947fecb..220211ac19e 100644 --- a/tests/src/com/android/settings/bluetooth/Utf8ByteLengthFilterTest.java +++ b/tests/unit/src/com/android/settings/bluetooth/Utf8ByteLengthFilterTest.java @@ -17,6 +17,7 @@ package com.android.settings.bluetooth; import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.SmallTest; import android.text.InputFilter; import android.text.SpannableStringBuilder; @@ -24,6 +25,7 @@ import com.android.settings.bluetooth.Utf8ByteLengthFilter; public class Utf8ByteLengthFilterTest extends AndroidTestCase { + @SmallTest public void testFilter() { // Define the variables CharSequence source;