Index: base/android/java/src/org/chromium/base/ContextUtils.java |
diff --git a/base/android/java/src/org/chromium/base/ContextUtils.java b/base/android/java/src/org/chromium/base/ContextUtils.java |
index 266e8eb8805d31acfad8fcfa74be2143aab7899c..51adcff8f67375a4bf0507fedfeecf72daa07396 100644 |
--- a/base/android/java/src/org/chromium/base/ContextUtils.java |
+++ b/base/android/java/src/org/chromium/base/ContextUtils.java |
@@ -41,14 +41,22 @@ public class ContextUtils { |
* both sides. |
*/ |
public static void initApplicationContext(Context appContext) { |
+ assert appContext != null; |
+ assert sApplicationContext == null || sApplicationContext == appContext; |
initJavaSideApplicationContext(appContext); |
nativeInitNativeSideApplicationContext(appContext); |
} |
+ /** |
+ * JUnit Robolectric tests run without native code; allow them to set just the Java-side |
+ * context. Do not use in configurations that actually run on Android! |
+ */ |
+ public static void initApplicationContextForJUnitTests(Context appContext) { |
+ initJavaSideApplicationContext(appContext); |
+ } |
+ |
@CalledByNative |
private static void initJavaSideApplicationContext(Context appContext) { |
- assert appContext != null; |
- assert sApplicationContext == null || sApplicationContext == appContext; |
sApplicationContext = appContext; |
} |