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

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

Issue 2694273002: Revert of Refactor ContentViewClient (4/6) (Closed)
Patch Set: Created 3 years, 10 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 701106ec2f7148d81cf2ede3c5f2fd217dca445d..c06fa6c0658d4374a04085dd645dcc05feb92d87 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
@@ -17,9 +17,12 @@
* 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);
// 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.
@@ -32,6 +35,12 @@
});
}
+ protected TestCallbackHelperContainer(
+ TestContentViewClient viewClient, TestWebContentsObserver contentsObserver) {
+ mTestContentViewClient = viewClient;
+ mTestWebContentsObserver = contentsObserver;
+ }
+
/**
* CallbackHelper for OnPageCommitVisible.
*/
@@ -172,6 +181,21 @@
}
}
+ /**
+ * CallbackHelper for OnStartContentIntent.
+ */
+ public static class OnStartContentIntentHelper extends CallbackHelper {
+ private String mIntentUrl;
+ public void notifyCalled(String intentUrl) {
+ mIntentUrl = intentUrl;
+ notifyCalled();
+ }
+ public String getIntentUrl() {
+ assert getCallCount() > 0;
+ return mIntentUrl;
+ }
+ }
+
public OnPageStartedHelper getOnPageStartedHelper() {
return mTestWebContentsObserver.getOnPageStartedHelper();
}
@@ -183,4 +207,8 @@
public OnReceivedErrorHelper getOnReceivedErrorHelper() {
return mTestWebContentsObserver.getOnReceivedErrorHelper();
}
+
+ public OnStartContentIntentHelper getOnStartContentIntentHelper() {
+ return mTestContentViewClient.getOnStartContentIntentHelper();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698