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

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

Issue 2790893004: Delete Android content detectors. (Closed)
Patch Set: Rebase Created 3 years, 8 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/ContentDetectionTestCommon.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestCommon.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestCommon.java
deleted file mode 100644
index 0d8d96b42b76a5d2f93cd00a1a6b82135e6f3dd3..0000000000000000000000000000000000000000
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestCommon.java
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.browser;
-
-import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
-
-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_shell_apk.ContentShellActivity;
-import org.chromium.content_shell_apk.ContentShellTestCommon.TestCommonCallback;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class ContentDetectionTestCommon {
- private static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(10);
-
- private final TestCommonCallback<ContentShellActivity> mCallback;
-
- private TestCallbackHelperContainer mCallbackHelper;
- private TestContentIntentHandler mContentIntentHandler;
-
- public ContentDetectionTestCommon(TestCommonCallback<ContentShellActivity> callback) {
- mCallback = callback;
- }
-
- /**
- * 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.
- */
- public 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);
- }
- }
-
- static String urlForContent(String content) {
- return Uri.encode(content).replaceAll("%20", "+");
- }
-
- TestCallbackHelperContainer getTestCallbackHelperContainer() {
- if (mCallbackHelper == null) {
- mCallbackHelper =
- new TestCallbackHelperContainer(mCallback.getContentViewCoreForTestCommon());
- }
- return mCallbackHelper;
- }
-
- void createTestContentIntentHandler() {
- mContentIntentHandler = new TestContentIntentHandler();
- }
-
- void setContentHandler() {
- mCallback.getActivityForTestCommon()
- .getShellManager()
- .getActiveShell()
- .getViewAndroidDelegate()
- .setContentIntentHandler(mContentIntentHandler);
- }
-
- boolean isCurrentTestUrl(String testUrl) {
- return UrlUtils.getIsolatedTestFileUrl(testUrl).equals(
- mCallback.getContentViewCoreForTestCommon().getWebContents().getUrl());
- }
-
- String scrollAndTapExpectingIntent(String id) throws InterruptedException, TimeoutException {
- OnStartContentIntentHelper onStartContentIntentHelper =
- mContentIntentHandler.getOnStartContentIntentHelper();
- int currentCallCount = onStartContentIntentHelper.getCallCount();
-
- DOMUtils.clickNode(mCallback.getContentViewCoreForTestCommon(), id);
-
- onStartContentIntentHelper.waitForCallback(
- currentCallCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
- mCallback.getInstrumentationForTestCommon().waitForIdleSync();
- return onStartContentIntentHelper.getIntentUrl();
- }
-
- void scrollAndTapNavigatingOut(String id) throws InterruptedException, TimeoutException {
- TestCallbackHelperContainer callbackHelperContainer = getTestCallbackHelperContainer();
- OnPageFinishedHelper onPageFinishedHelper =
- callbackHelperContainer.getOnPageFinishedHelper();
- int currentCallCount = onPageFinishedHelper.getCallCount();
-
- DOMUtils.clickNode(mCallback.getContentViewCoreForTestCommon(), id);
-
- onPageFinishedHelper.waitForCallback(
- currentCallCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
- mCallback.getInstrumentationForTestCommon().waitForIdleSync();
- }
-}

Powered by Google App Engine
This is Rietveld 408576698