When we're failing to connect to a wifi access point due to an incorrect password, we want to allow an intent from a notification to open up the wifi settings page and bring up the dialog for entering a different password. We already have code in settings to do this for not-yet-saved access points, so this CL just changes it slightly to also allow it for saved access points. Unfortunately WifiSettings can't be tested with Robolectric due to it not supporting PreferenceScreen, so this adds a test to WifiSettingsUiTest. There were some existing test failures in that file which I've fixed while I was in there: -The TestAccessPointBuilder class wasn't being found at runtime because it was getting stripped out at build time due to not being used in settings. -The changingSecurityStateOnApShouldNotCauseMultipleListItems test was asserting that we don't end up with multiple entries for the same SSID in the access point list when changing the security state for the AP, but it was accidentally passing multiple AP's with the same name the first time. Bug: 33245941 Test: runtest --path WifiSettingsUiTest.java Change-Id: I929ca6892242059df157c01d6e9ea30e8d1c5e78
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 via for example $ adb install -r ${ANDROID_PRODUCT_OUT}/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.<class> 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.<class>#<test> 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