Merge "Fix tethering summary when airplane mode is off" into pi-dev am: a07b1f83a8
am: 8ed6b5dabf
Change-Id: I27bd8d85f0c22207336f8bf632280a5bfd243658
This commit is contained in:
@@ -123,7 +123,7 @@ public class WifiTetherPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReceiver_goingToAirplaneMode_shouldClearPreferenceSummary() {
|
||||
public void testReceiver_turnOnAirplaneMode_clearPreferenceSummary() {
|
||||
final ContentResolver cr = mock(ContentResolver.class);
|
||||
when(mContext.getContentResolver()).thenReturn(cr);
|
||||
Settings.Global.putInt(cr, Settings.Global.AIRPLANE_MODE_ON, 1);
|
||||
@@ -137,6 +137,21 @@ public class WifiTetherPreferenceControllerTest {
|
||||
"Unavailable because airplane mode is turned on");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReceiver_turnOffAirplaneMode_displayOffSummary() {
|
||||
final ContentResolver cr = mock(ContentResolver.class);
|
||||
when(mContext.getContentResolver()).thenReturn(cr);
|
||||
Settings.Global.putInt(cr, Settings.Global.AIRPLANE_MODE_ON, 0);
|
||||
mController.displayPreference(mScreen);
|
||||
final BroadcastReceiver receiver = ReflectionHelpers.getField(mController, "mReceiver");
|
||||
final Intent broadcast = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||
|
||||
receiver.onReceive(RuntimeEnvironment.application, broadcast);
|
||||
|
||||
assertThat(mPreference.getSummary().toString()).isEqualTo(
|
||||
"Not sharing internet or content with other devices");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleWifiApStateChanged_stateEnabling_showEnablingSummary() {
|
||||
mController.handleWifiApStateChanged(WifiManager.WIFI_AP_STATE_ENABLING, 0 /* reason */);
|
||||
|
Reference in New Issue
Block a user