Merge "Hide memory setting in app detail unless dev option is on."

This commit is contained in:
TreeHugger Robot
2017-07-14 20:09:30 +00:00
committed by Android (Google) Code Review
3 changed files with 31 additions and 9 deletions

View File

@@ -16,12 +16,14 @@
package com.android.settings.development;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.content.SharedPreferences;
import android.provider.Settings;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
@@ -33,8 +35,6 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class DevelopmentSettingsEnablerTest {
@@ -52,6 +52,16 @@ public class DevelopmentSettingsEnablerTest {
ReflectionHelpers.setField(mEnabler, "mDevelopmentPreferences", mDevelopmentPreferences);
}
@Test
public void constructor_shouldInitEnabledState() {
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
mEnabler = new DevelopmentSettingsEnabler(mContext, null);
assertThat(mEnabler.getLastEnabledState()).isTrue();
}
@Test
public void onResume_shouldReadStateFromSettingProvider() {
Settings.Global.putInt(mContext.getContentResolver(),