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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewTest.java

Issue 391813006: [Android] Add meta-data to point to implementations of SmartClipProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed "_VIEW" Created 6 years, 5 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
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewTest.java
deleted file mode 100644
index abfb6524e92efb28c7a469c4ceec5464c597f6d4..0000000000000000000000000000000000000000
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2014 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.chrome.browser;
-
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.Message;
-import android.test.suitebuilder.annotation.MediumTest;
-
-import org.chromium.base.ThreadUtils;
-import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.shell.ChromeShellActivity;
-import org.chromium.chrome.shell.ChromeShellTestBase;
-import org.chromium.content.browser.ContentView;
-import org.chromium.content.browser.test.util.CallbackHelper;
-
-import java.util.concurrent.TimeoutException;
-
-/**
- * Tests for the ContentView.
- */
-public class ContentViewTest extends ChromeShellTestBase implements Handler.Callback {
-
- private static class MyCallbackHelper extends CallbackHelper {
- public String getTitle() {
- return mTitle;
- }
-
- public String getUrl() {
- return mUrl;
- }
-
- public String getText() {
- return mText;
- }
-
- public String getHtml() {
- return mHtml;
- }
-
- public Rect getRect() {
- return mRect;
- }
-
- public void notifyCalled(String title, String url, String text, String html, Rect rect) {
- mTitle = title;
- mUrl = url;
- mText = text;
- mHtml = html;
- mRect = rect;
- super.notifyCalled();
- }
-
- private String mTitle;
- private String mUrl;
- private String mText;
- private String mHtml;
- private Rect mRect;
- }
-
- private ChromeShellActivity mActivity;
- private MyCallbackHelper mCallbackHelper;
- private HandlerThread mHandlerThread;
- private Handler mHandler;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- mActivity = launchChromeShellWithBlankPage();
- mCallbackHelper = new MyCallbackHelper();
- mHandlerThread = new HandlerThread("ContentViewTest thread");
- mHandlerThread.start();
- mHandler = new Handler(mHandlerThread.getLooper(), this);
- }
-
- @Override
- public void tearDown() throws Exception {
- try {
- mHandlerThread.quitSafely();
- } finally {
- super.tearDown();
- }
- }
-
- // Implements Handler.Callback
- @Override
- public boolean handleMessage(Message msg) {
- Bundle bundle = msg.getData();
- assertNotNull(bundle);
- String url = bundle.getString("url");
- String title = bundle.getString("title");
- String text = bundle.getString("text");
- String html = bundle.getString("html");
- Rect rect = bundle.getParcelable("rect");
- // We don't care about other values for now.
- mCallbackHelper.notifyCalled(title, url, text, html, rect);
- return true;
- }
-
- @MediumTest
- @Feature({"SmartClip"})
- public void testSmartClipDataCallback() throws InterruptedException, TimeoutException {
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- ContentView cv = (ContentView) getActivity().getActiveTab().getView();
- assertNotNull(cv);
- cv.setSmartClipResultHandler(mHandler);
- cv.extractSmartClipData(10, 20, 100, 70);
- }
- });
- mCallbackHelper.waitForCallback(0, 1); // call count: 0 --> 1
- assertEquals("about:blank", mCallbackHelper.getTitle());
- assertEquals("about:blank", mCallbackHelper.getUrl());
- assertNotNull(mCallbackHelper.getText());
- assertNotNull(mCallbackHelper.getHtml());
- assertNotNull(mCallbackHelper.getRect());
- }
-}
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698