Add missing settings strings.
Also re-enable and fix tests. Test: manual Fixes: 226183482 Fixes: 218799125 Fixes: 219375624 Change-Id: I9605f1f4e2e834baf63e015e96639567c5481b5f
This commit is contained in:
@@ -19,15 +19,18 @@ package com.android.settings.fuelgauge;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settingslib.widget.MainSwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -42,6 +45,7 @@ public class SmartBatteryPreferenceControllerTest {
|
||||
private static final int ON = 1;
|
||||
private static final int OFF = 0;
|
||||
|
||||
private Context mContext = spy(RuntimeEnvironment.application);
|
||||
private SmartBatteryPreferenceController mController;
|
||||
private SwitchPreference mPreference;
|
||||
private ContentResolver mContentResolver;
|
||||
@@ -50,11 +54,13 @@ public class SmartBatteryPreferenceControllerTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
doReturn(mock(DevicePolicyManager.class)).when(mContext)
|
||||
.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
|
||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||
mContentResolver = RuntimeEnvironment.application.getContentResolver();
|
||||
mController = new SmartBatteryPreferenceController(RuntimeEnvironment.application);
|
||||
mPreference = new SwitchPreference(RuntimeEnvironment.application);
|
||||
mContentResolver = mContext.getContentResolver();
|
||||
mController = new SmartBatteryPreferenceController(mContext);
|
||||
mPreference = new SwitchPreference(mContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -118,7 +124,7 @@ public class SmartBatteryPreferenceControllerTest {
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final SmartBatteryPreferenceController controller =
|
||||
new SmartBatteryPreferenceController(null);
|
||||
new SmartBatteryPreferenceController(mContext);
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user