The correct target context should use the mActivity in MobileNetworkSettingsTest, so that the mocking for telephony service could correctly applied. Both AutoTimeZonePreferenceControllerTest and BasebandVersionPreferenceControllerTest refer to the lib implemented shadow Connectivitymanager but that does not the correct reference after utils class being updated. Update the test logic inside to refer to correct method. The reference to ShadowConnectivityManager does not needed anymore so remove it from the test. Fix: 183068151 Fix: 183067742 Fix: 183068139 Test: make RunSettingsRoboTests ROBOTEST_FILTER=\ com.android.settings.network.telephony.MobileNetworkSettingsTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=\ com.android.settings.datetime.AutoTimeZonePreferenceControllerTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings\ .deviceinfo.firmwareversion.BasebandVersionPreferenceControllerTest Change-Id: I15ecc6aab7d530d20cd23b06267cc184a2c62b40
Running Settings Robolectric tests
The full suite
$ croot
$ make RunSettingsRoboTests
Running a single test class
$ croot
$ make RunSettingsRoboTests ROBOTEST_FILTER=<ClassName>
For example:
make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest
You can also use partial class name in ROBOTEST_FILTER. If the partial class name matches multiple file names, all of them will be executed.