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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.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/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
index 9144b5674c214524d0ddf1bfe808a10c5c57f0dd..3ecf1a251036709d6a5353eba086b99bbd9279de 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
@@ -6,15 +6,13 @@
import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
-import android.app.Activity;
import android.net.Uri;
-import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.content.browser.test.util.DOMUtils;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
-import org.chromium.content_shell.ShellViewAndroidDelegate.ContentIntentHandler;
+import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnStartContentIntentHelper;
import org.chromium.content_shell_apk.ContentShellTestBase;
import java.util.concurrent.TimeUnit;
@@ -27,41 +25,6 @@
private static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(10);
private TestCallbackHelperContainer mCallbackHelper;
- private TestContentIntentHandler mContentIntentHandler;
-
- /**
- * CallbackHelper for OnStartContentIntent.
- */
- private static class OnStartContentIntentHelper extends CallbackHelper {
- private String mIntentUrl;
- public void notifyCalled(String intentUrl) {
- mIntentUrl = intentUrl;
- notifyCalled();
- }
- public String getIntentUrl() {
- assert getCallCount() > 0;
- return mIntentUrl;
- }
- }
-
- /**
- * ContentIntentHandler impl to test content detection.
- */
- private static class TestContentIntentHandler implements ContentIntentHandler {
- private OnStartContentIntentHelper mOnStartContentIntentHelper;
-
- public OnStartContentIntentHelper getOnStartContentIntentHelper() {
- if (mOnStartContentIntentHelper == null) {
- mOnStartContentIntentHelper = new OnStartContentIntentHelper();
- }
- return mOnStartContentIntentHelper;
- }
-
- @Override
- public void onIntentUrlReceived(String intentUrl) {
- mOnStartContentIntentHelper.notifyCalled(intentUrl);
- }
- }
/**
* Returns the TestCallbackHelperContainer associated with this ContentView,
@@ -74,25 +37,12 @@
return mCallbackHelper;
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mContentIntentHandler = new TestContentIntentHandler();
- }
-
- @Override
- protected void setActivity(Activity activity) {
- super.setActivity(activity);
- getActivity().getShellManager().getActiveShell().getViewAndroidDelegate()
- .setContentIntentHandler(mContentIntentHandler);
- }
-
/**
* Encodes the provided content string into an escaped url as intents do.
* @param content Content to escape into a url.
* @return Escaped url.
*/
- protected static String urlForContent(String content) {
+ protected String urlForContent(String content) {
return Uri.encode(content).replaceAll("%20", "+");
}
@@ -112,8 +62,9 @@
* @return The content url of the received intent or null if none.
*/
protected String scrollAndTapExpectingIntent(String id) throws Throwable {
+ TestCallbackHelperContainer callbackHelperContainer = getTestCallbackHelperContainer();
OnStartContentIntentHelper onStartContentIntentHelper =
- mContentIntentHandler.getOnStartContentIntentHelper();
+ callbackHelperContainer.getOnStartContentIntentHelper();
int currentCallCount = onStartContentIntentHelper.getCallCount();
DOMUtils.clickNode(this, getContentViewCore(), id);
@@ -142,4 +93,4 @@
TimeUnit.SECONDS);
getInstrumentation().waitForIdleSync();
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698