Merge "Update summary for AllInOneTetherPreference accordingly"

This commit is contained in:
Zhen Zhang
2020-02-17 05:50:55 +00:00
committed by Android (Google) Code Review
5 changed files with 117 additions and 13 deletions

View File

@@ -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();