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

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java

Issue 2628863004: [Android WebView] Ensure we have user consent before uploading minidumps (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
8 8
9 import android.app.Instrumentation; 9 import android.app.Instrumentation;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 super.setUp(); 91 super.setUp();
92 if (needsBrowserProcessStarted()) { 92 if (needsBrowserProcessStarted()) {
93 startBrowserProcess(); 93 startBrowserProcess();
94 } 94 }
95 } 95 }
96 96
97 protected void createAwBrowserContext() { 97 protected void createAwBrowserContext() {
98 if (mBrowserContext != null) { 98 if (mBrowserContext != null) {
99 throw new AndroidRuntimeException("There should only be one browser context."); 99 throw new AndroidRuntimeException("There should only be one browser context.");
100 } 100 }
101 Context appContext = getInstrumentation().getTargetContext().getApplicat ionContext(); 101 getActivity(); // The Activity must be launched in order to load native code.
102 mBrowserContext = new AwBrowserContext(new InMemorySharedPreferences(), appContext); 102 final InMemorySharedPreferences prefs = new InMemorySharedPreferences();
103 final Context appContext = getInstrumentation().getTargetContext().getAp plicationContext();
104 getInstrumentation().runOnMainSync(new Runnable() {
105 @Override
106 public void run() {
107 mBrowserContext = new AwBrowserContext(prefs, appContext);
108 }
109 });
103 } 110 }
104 111
105 protected void startBrowserProcess() throws Exception { 112 protected void startBrowserProcess() throws Exception {
106 // The activity must be launched in order for proper webview statics to be setup. 113 // The Activity must be launched in order for proper webview statics to be setup.
107 getActivity(); 114 getActivity();
108 getInstrumentation().runOnMainSync(new Runnable() { 115 getInstrumentation().runOnMainSync(new Runnable() {
109 @Override 116 @Override
110 public void run() { 117 public void run() {
111 AwBrowserProcess.start(); 118 AwBrowserProcess.start();
112 } 119 }
113 }); 120 });
114 } 121 }
115 122
116 /** 123 /**
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 int titleCallCount = onReceivedTitleHelper.getCallCount(); 704 int titleCallCount = onReceivedTitleHelper.getCallCount();
698 705
699 onPageFinishedHelper.waitForCallback(finishCallCount, 1, WAIT_TIMEOUT_MS , 706 onPageFinishedHelper.waitForCallback(finishCallCount, 1, WAIT_TIMEOUT_MS ,
700 TimeUnit.MILLISECONDS); 707 TimeUnit.MILLISECONDS);
701 onReceivedTitleHelper.waitForCallback(titleCallCount, 1, WAIT_TIMEOUT_MS , 708 onReceivedTitleHelper.waitForCallback(titleCallCount, 1, WAIT_TIMEOUT_MS ,
702 TimeUnit.MILLISECONDS); 709 TimeUnit.MILLISECONDS);
703 710
704 return new PopupInfo(popupContentsClient, popupContainerView, popupConte nts); 711 return new PopupInfo(popupContentsClient, popupContainerView, popupConte nts);
705 } 712 }
706 } 713 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698