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

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

Issue 10941015: [Android] Upstream the WebView find-in-page API implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes + command line switch for synchronous APIs Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 android.app.Instrumentation; 7 import android.app.Instrumentation;
8 import android.content.Context; 8 import android.content.Context;
9 import android.test.ActivityInstrumentationTestCase2; 9 import android.test.ActivityInstrumentationTestCase2;
10 import android.view.View; 10 import android.view.View;
11 import android.view.ViewGroup;
12 11
13 import junit.framework.Assert; 12 import junit.framework.Assert;
14 13
15 import org.chromium.android_webview.AndroidWebViewUtil; 14 import org.chromium.android_webview.AndroidWebViewUtil;
16 import org.chromium.android_webview.AwContents; 15 import org.chromium.android_webview.AwContents;
17 import org.chromium.android_webview.AwContentsClient; 16 import org.chromium.android_webview.AwContentsClient;
18 import org.chromium.content.browser.ContentSettings; 17 import org.chromium.content.browser.ContentSettings;
19 import org.chromium.content.browser.ContentView; 18 import org.chromium.content.browser.ContentView;
20 import org.chromium.content.browser.ContentViewClient; 19 import org.chromium.content.browser.ContentViewClient;
21 import org.chromium.content.browser.ContentViewCore; 20 import org.chromium.content.browser.ContentViewCore;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 final Context context = getActivity(); 164 final Context context = getActivity();
166 getInstrumentation().runOnMainSync(new Runnable() { 165 getInstrumentation().runOnMainSync(new Runnable() {
167 @Override 166 @Override
168 public void run() { 167 public void run() {
169 testContainerView.set(createAwTestContainerView(incognito, clien t)); 168 testContainerView.set(createAwTestContainerView(incognito, clien t));
170 } 169 }
171 }); 170 });
172 return testContainerView.get(); 171 return testContainerView.get();
173 } 172 }
174 173
174 protected void destroyAwContentsOnMainSync(final AwContents contents) {
175 if (contents == null) return;
176 getInstrumentation().runOnMainSync(new Runnable() {
177 @Override
178 public void run() {
179 contents.destroy();
180 }
181 });
182 }
183
175 protected String getTitleOnUiThread(final ContentViewCore contentViewCore) t hrows Throwable { 184 protected String getTitleOnUiThread(final ContentViewCore contentViewCore) t hrows Throwable {
176 return runTestOnUiThreadAndGetResult(new Callable<String>() { 185 return runTestOnUiThreadAndGetResult(new Callable<String>() {
177 @Override 186 @Override
178 public String call() throws Exception { 187 public String call() throws Exception {
179 return contentViewCore.getTitle(); 188 return contentViewCore.getTitle();
180 } 189 }
181 }); 190 });
182 } 191 }
183 192
184 protected ContentSettings getContentSettingsOnUiThread( 193 protected ContentSettings getContentSettingsOnUiThread(
(...skipping 21 matching lines...) Expand all
206 public void run() { 215 public void run() {
207 requestId.set(core.evaluateJavaScript(code)); 216 requestId.set(core.evaluateJavaScript(code));
208 } 217 }
209 }); 218 });
210 onEvaluateJavaScriptResultHelper.waitForCallback(currentCallCount); 219 onEvaluateJavaScriptResultHelper.waitForCallback(currentCallCount);
211 Assert.assertEquals("Response ID mismatch when evaluating JavaScript.", 220 Assert.assertEquals("Response ID mismatch when evaluating JavaScript.",
212 requestId.get(), onEvaluateJavaScriptResultHelper.getId()); 221 requestId.get(), onEvaluateJavaScriptResultHelper.getId());
213 return onEvaluateJavaScriptResultHelper.getJsonResult(); 222 return onEvaluateJavaScriptResultHelper.getJsonResult();
214 } 223 }
215 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698