Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: components/policy/android/junit/src/org/chromium/policy/AbstractAppRestrictionsProviderTest.java

Issue 1965093002: 🎾 Migrate more shared preferences to ContextUtils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/policy/android/junit/src/org/chromium/policy/AbstractAppRestrictionsProviderTest.java
diff --git a/components/policy/android/junit/src/org/chromium/policy/AbstractAppRestrictionsProviderTest.java b/components/policy/android/junit/src/org/chromium/policy/AbstractAppRestrictionsProviderTest.java
index 61d203dbb0142af06ba3e35d709b0f1fa4cd6f8b..33f26cf3a6a48840b823c010c897156e4d73735d 100644
--- a/components/policy/android/junit/src/org/chromium/policy/AbstractAppRestrictionsProviderTest.java
+++ b/components/policy/android/junit/src/org/chromium/policy/AbstractAppRestrictionsProviderTest.java
@@ -18,10 +18,9 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.os.Bundle;
-import android.preference.PreferenceManager;
+import org.chromium.base.ContextUtils;
import org.chromium.testing.local.LocalRobolectricTestRunner;
import org.junit.Assert;
import org.junit.Test;
@@ -81,12 +80,10 @@ public class AbstractAppRestrictionsProviderTest {
Robolectric.getBackgroundScheduler().pause();
Context context = Robolectric.application;
+ ContextUtils.initApplicationContextForTests(context);
// Clear the preferences
- SharedPreferences sharedPreferences = PreferenceManager
- .getDefaultSharedPreferences(context);
- SharedPreferences.Editor ed = sharedPreferences.edit();
- ed.clear();
+ ContextUtils.getAppSharedPreferences().edit().clear();
// Set up a bundle for testing.
Bundle b1 = new Bundle();

Powered by Google App Engine
This is Rietveld 408576698