Update summary for AllInOneTetherPreference accordingly
The summary for AllInOneTetherPreference in NetworkDashboardFragment is updated according to tethering state and tether interface chosen by user. Bug: 149256198 Test: AllInOneTetherPreferenceControllerTest, TetherEnablerTest, CodeInspectionTest Change-Id: I24ba4deabbb02b203e76d32048040d7ccf1b2d22
This commit is contained in:
@@ -26,6 +26,7 @@ import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothPan;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.android.settings.widget.MasterSwitchPreference;
|
||||
|
||||
@@ -48,6 +49,8 @@ public class AllInOneTetherPreferenceControllerTest {
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
@Mock
|
||||
private MasterSwitchPreference mPreference;
|
||||
@Mock
|
||||
private SharedPreferences mSharedPreferences;
|
||||
|
||||
private AllInOneTetherPreferenceController mController;
|
||||
|
||||
@@ -58,10 +61,12 @@ public class AllInOneTetherPreferenceControllerTest {
|
||||
ReflectionHelpers.setField(mController, "mContext", mContext);
|
||||
ReflectionHelpers.setField(mController, "mBluetoothAdapter", mBluetoothAdapter);
|
||||
ReflectionHelpers.setField(mController, "mPreference", mPreference);
|
||||
ReflectionHelpers
|
||||
.setField(mController, "mTetherEnablerSharedPreferences", mSharedPreferences);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lifeCycle_onCreate_shouldInitBluetoothPan() {
|
||||
public void onCreate_shouldInitBluetoothPan() {
|
||||
when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_ON);
|
||||
mController.onCreate();
|
||||
|
||||
@@ -71,7 +76,7 @@ public class AllInOneTetherPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lifeCycle_onCreate_shouldNotInitBluetoothPanWhenBluetoothOff() {
|
||||
public void onCreate_shouldNotInitBluetoothPanWhenBluetoothOff() {
|
||||
when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_OFF);
|
||||
mController.onCreate();
|
||||
|
||||
|
Reference in New Issue
Block a user