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

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

Issue 2380743003: Refactor ContentViewClient (2/6) (Closed)
Patch Set: tests Created 4 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/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java
index d97e1ef9f72e18d4e5706d6dba25f977cfc05192..e2a18f8396acf8a32b16de9c6b8f01e4475fbede 100644
--- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java
@@ -4,11 +4,13 @@
package org.chromium.content.browser.test.util;
+import android.content.Context;
import org.chromium.base.ThreadUtils;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content_public.browser.JavaScriptCallback;
import org.chromium.content_public.browser.WebContents;
+import org.chromium.ui.base.WindowAndroid;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -17,12 +19,27 @@ import java.util.concurrent.TimeoutException;
* This class is used to provide callback hooks for tests and related classes.
*/
public class TestCallbackHelperContainer {
- private final TestContentViewClient mTestContentViewClient;
private TestWebContentsObserver mTestWebContentsObserver;
- public TestCallbackHelperContainer(final ContentViewCore contentViewCore) {
- mTestContentViewClient = new TestContentViewClient();
- contentViewCore.setContentViewClient(mTestContentViewClient);
+ private static class ContentIntentHandler extends WindowAndroid.ActionDelegate {
+ private final OnStartContentIntentHelper mOnStartContentIntentHelper =
+ new OnStartContentIntentHelper();
+
+ public OnStartContentIntentHelper getOnStartContentIntentHelper() {
+ return mOnStartContentIntentHelper;
+ }
+
+ @Override
+ public void onStartContentIntent(Context context, String intentUrl, boolean isMainFrame) {
+ mOnStartContentIntentHelper.notifyCalled(intentUrl);
+ }
+ }
+
+ private final ContentIntentHandler mIntentHandler = new ContentIntentHandler();
+
+ public TestCallbackHelperContainer(WindowAndroid windowAndroid,
+ final ContentViewCore contentViewCore) {
+ windowAndroid.setActionDelegate(mIntentHandler);
// TODO(yfriedman): Change callers to be executed on the UI thread. Unfortunately this is
// super convenient as the caller is nearly always on the test thread which is fine to block
// and it's cumbersome to keep bouncing to the UI thread.
@@ -35,9 +52,7 @@ public class TestCallbackHelperContainer {
});
}
- protected TestCallbackHelperContainer(
- TestContentViewClient viewClient, TestWebContentsObserver contentsObserver) {
- mTestContentViewClient = viewClient;
+ protected TestCallbackHelperContainer(TestWebContentsObserver contentsObserver) {
boliu 2016/09/30 22:34:16 anything actually subclassing this and calling thi
mTestWebContentsObserver = contentsObserver;
}
@@ -220,6 +235,6 @@ public class TestCallbackHelperContainer {
}
public OnStartContentIntentHelper getOnStartContentIntentHelper() {
- return mTestContentViewClient.getOnStartContentIntentHelper();
+ return mIntentHandler.getOnStartContentIntentHelper();
}
}

Powered by Google App Engine
This is Rietveld 408576698