Index: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java |
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java |
index d37e9b403167ac66b2eb8782a79de154787a64a8..a0ce79258c0bc1371d46c89951fdd78220f55b23 100644 |
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java |
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java |
@@ -98,12 +98,18 @@ public class AwTestBase |
if (mBrowserContext != null) { |
throw new AndroidRuntimeException("There should only be one browser context."); |
} |
- Context appContext = getInstrumentation().getTargetContext().getApplicationContext(); |
- mBrowserContext = new AwBrowserContext(new InMemorySharedPreferences(), appContext); |
+ final InMemorySharedPreferences prefs = new InMemorySharedPreferences(); |
+ final Context appContext = getInstrumentation().getTargetContext().getApplicationContext(); |
+ getInstrumentation().runOnMainSync(new Runnable() { |
+ @Override |
+ public void run() { |
+ mBrowserContext = new AwBrowserContext(prefs, appContext); |
+ } |
+ }); |
} |
protected void startBrowserProcess() throws Exception { |
- // The activity must be launched in order for proper webview statics to be setup. |
+ // The Activity must be launched in order for proper webview statics to be setup. |
getActivity(); |
getInstrumentation().runOnMainSync(new Runnable() { |
@Override |