Use external/robolectric-shadows/run_robotests.mk
This allows Settings to test against the latest framework changes. Also replaced TestConfig with traditional robolectric.properties. Bug: 73173204 Bug: 73892008 Test: make -j56 RunSettingsRoboTests Change-Id: I3135b4fa5f095ba79b282a76f45dd9baa2584bc7
This commit is contained in:
@@ -18,37 +18,34 @@ package com.android.settings.fuelgauge;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContentResolver;
|
||||
import android.provider.Settings;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.TestConfig;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class SmartBatteryPreferenceControllerTest {
|
||||
|
||||
private static final int ON = 1;
|
||||
private static final int OFF = 0;
|
||||
|
||||
private SmartBatteryPreferenceController mController;
|
||||
private SwitchPreference mPreference;
|
||||
private Context mContext;
|
||||
private ContentResolver mContentResolver;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new SmartBatteryPreferenceController(mContext);
|
||||
mPreference = new SwitchPreference(mContext);
|
||||
mContentResolver = RuntimeEnvironment.application.getContentResolver();
|
||||
mController = new SmartBatteryPreferenceController(RuntimeEnvironment.application);
|
||||
mPreference = new SwitchPreference(RuntimeEnvironment.application);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -84,12 +81,10 @@ public class SmartBatteryPreferenceControllerTest {
|
||||
}
|
||||
|
||||
private void putSmartBatteryValue(int value) {
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.APP_STANDBY_ENABLED,
|
||||
value);
|
||||
Settings.Global.putInt(mContentResolver, Settings.Global.APP_STANDBY_ENABLED, value);
|
||||
}
|
||||
|
||||
private int getSmartBatteryValue() {
|
||||
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.APP_STANDBY_ENABLED, ON);
|
||||
return Settings.Global.getInt(mContentResolver, Settings.Global.APP_STANDBY_ENABLED, ON);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user