Files
app_Settings/tests/unit
Gil Cukierman a2ddff3865 Honor DISALLOW_CELLULAR_2G User Restriction in Enable2gPreferenceController
When 2g is disallowed by a device admin the 2g toggle in the preference
screen will implement the following behaviors as a result of being
changed to a RestrictedSwitchPreference:
1. become disabled (greyed out)
2. show a summary message explaining that the preference was disabled by
   an admin
3 show a pop up when a user tries to click on the preference informing
  them that the setting is unusable because it was disabled by an admin.

Additionally, the toggle will show as unchecked (off) when admins
disable 2g.

When 2g is re-enabled by a device admin, the preference screen will go back
to its previous state.

Test: atest Enable2gPreferenceControllerTest
Bug: b/248250240
Change-Id: I7af901f2d9f62ebfe884e01724d8eff845c2968e
2022-10-19 21:01:17 +00:00
..
2022-01-27 08:46:18 +00:00

The simplest way to run all SettingsUnitTests is with atest
$ atest SettingsUnitTests

A single class can also be tested with the following command
$ atest -c <YourClassName>

// The following instructions show how to run the test suite using make + adb //

To build the tests you can use the following command at the root of your android source tree
$ make -j SettingsUnitTests

The test apk then needs to be installed onto your test device. The apk's location will vary
depending on your device model and architecture. At the end of the make command's output, there
should be a line similar to the following:
"Copy: ${ANDROID_PRODUCT_OUT}/testcases/SettingsUnitTests/arm64/SettingsUnitTests.apk"
Install via the following command:
$ adb install -r ${ANDROID_PRODUCT_OUT}/testcases/SettingsUnitTests/arm64/SettingsUnitTests.apk

To run all tests:
$ adb shell am instrument -w com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner

To run all tests in a specific class:
$ adb shell am instrument -w -e class com.android.settings.<class> com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner

To run a specific test:
$ adb shell am instrument -w -e class com.android.settings.<class>#<test> com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner

More general information can be found at
http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html