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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/util/TestWebContentsObserver.java

Issue 10963041: Revert "Revert 158067 - Remove native side of content_view_client" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add additional_input_paths as a variable and input to java.gypi 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/javatests/src/org/chromium/content/browser/util/TestWebContentsObserver.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java b/content/public/android/javatests/src/org/chromium/content/browser/util/TestWebContentsObserver.java
similarity index 59%
copy from android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java
copy to content/public/android/javatests/src/org/chromium/content/browser/util/TestWebContentsObserver.java
index 5e761b8c325799f9795aa0f880423e926124b66d..503ab4e23705fd765501e8dff156c31692dbca14 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/util/TestWebContentsObserver.java
@@ -2,24 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.android_webview.test;
+package org.chromium.content.browser.util;
-import org.chromium.content.browser.util.TestCallbackHelperContainer.OnPageStartedHelper;
+import org.chromium.content.browser.ContentViewCore;
+import org.chromium.content.browser.WebContentsObserverAndroid;
import org.chromium.content.browser.util.TestCallbackHelperContainer.OnPageFinishedHelper;
+import org.chromium.content.browser.util.TestCallbackHelperContainer.OnPageStartedHelper;
import org.chromium.content.browser.util.TestCallbackHelperContainer.OnReceivedErrorHelper;
-import org.chromium.content.browser.util.TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper;
-class TestAwContentsClient extends NullContentsClient {
+/**
+ * The default WebContentsObserverAndroid used by ContentView tests. The below callbacks can be
+ * accessed by using {@link TestCallbackHelperContainer} or extending this class.
+ */
+public class TestWebContentsObserver extends WebContentsObserverAndroid {
+
private OnPageStartedHelper mOnPageStartedHelper;
private OnPageFinishedHelper mOnPageFinishedHelper;
private OnReceivedErrorHelper mOnReceivedErrorHelper;
- private OnEvaluateJavaScriptResultHelper mOnEvaluateJavaScriptResultHelper;
- public TestAwContentsClient() {
+ public TestWebContentsObserver(ContentViewCore contentViewCore) {
+ super(contentViewCore);
mOnPageStartedHelper = new OnPageStartedHelper();
mOnPageFinishedHelper = new OnPageFinishedHelper();
mOnReceivedErrorHelper = new OnReceivedErrorHelper();
- mOnEvaluateJavaScriptResultHelper = new OnEvaluateJavaScriptResultHelper();
}
public OnPageStartedHelper getOnPageStartedHelper() {
@@ -34,10 +39,6 @@ class TestAwContentsClient extends NullContentsClient {
return mOnReceivedErrorHelper;
}
- public OnEvaluateJavaScriptResultHelper getOnEvaluateJavaScriptResultHelper() {
- return mOnEvaluateJavaScriptResultHelper;
- }
-
/**
* ATTENTION!: When overriding the following methods, be sure to call
* the corresponding methods in the super class. Otherwise
@@ -45,26 +46,21 @@ class TestAwContentsClient extends NullContentsClient {
* stop working!
*/
@Override
- public void onPageStarted(String url) {
- super.onPageStarted(url);
+ public void didStartLoading(String url) {
+ super.didStartLoading(url);
mOnPageStartedHelper.notifyCalled(url);
}
@Override
- public void onPageFinished(String url) {
- super.onPageFinished(url);
+ public void didStopLoading(String url) {
+ super.didStopLoading(url);
mOnPageFinishedHelper.notifyCalled(url);
}
@Override
- public void onReceivedError(int errorCode, String description, String failingUrl) {
- super.onReceivedError(errorCode, description, failingUrl);
+ public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame,
+ int errorCode, String description, String failingUrl) {
+ super.didFailLoad(isProvisionalLoad, isMainFrame, errorCode, description, failingUrl);
mOnReceivedErrorHelper.notifyCalled(errorCode, description, failingUrl);
}
-
- @Override
- public void onEvaluateJavaScriptResult(int id, String jsonResult) {
- super.onEvaluateJavaScriptResult(id, jsonResult);
- mOnEvaluateJavaScriptResultHelper.notifyCalled(id, jsonResult);
- }
}

Powered by Google App Engine
This is Rietveld 408576698