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

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

Issue 1102753002: [Android] Refactor Java Bridge tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayCoercionTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java
deleted file mode 100644
index 825be84d322195f7428ccff80844b152090fdbbd..0000000000000000000000000000000000000000
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2012 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 android.util.Log;
-
-import org.chromium.base.test.util.UrlUtils;
-import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
-import org.chromium.content_public.browser.LoadUrlParams;
-import org.chromium.content_public.browser.NavigationController;
-import org.chromium.content_shell_apk.ContentShellActivity;
-import org.chromium.content_shell_apk.ContentShellTestBase;
-
-/**
- * Provides test environment for ContentView Test Shell.
- * This is a helper class for Content Shell tests.
-*/
-public class ContentViewTestBase extends ContentShellTestBase {
-
- protected TestCallbackHelperContainer mTestCallbackHelperContainer;
-
- /**
- * Sets up the ContentView and injects the supplied object. Intended to be called from setUp().
- */
- protected void setUpContentView(final Object object, final String name) throws Exception {
- // This starts the activity, so must be called on the test thread.
- final ContentShellActivity activity = launchContentShellWithUrl(
- UrlUtils.encodeHtmlDataUri("<html><head></head><body>test</body></html>"));
-
- waitForActiveShellToBeDoneLoading();
-
- // On the UI thread, load an empty page and wait for it to finish
- // loading so that the Java object is injected.
- try {
- runTestOnUiThread(new Runnable() {
- @Override
- public void run() {
- ContentViewCore viewCore = activity.getActiveContentViewCore();
- viewCore.addPossiblyUnsafeJavascriptInterface(object, name, null);
- mTestCallbackHelperContainer = new TestCallbackHelperContainer(viewCore);
- }
- });
-
- loadDataSync(activity.getActiveContentViewCore().getWebContents()
- .getNavigationController(), "<!DOCTYPE html><title></title>", "text/html",
- false);
- } catch (Throwable e) {
- throw new RuntimeException(
- "Failed to set up ContentView: " + Log.getStackTraceString(e));
- }
- }
-
- /**
- * Loads data on the UI thread and blocks until onPageFinished is called.
- * TODO(cramya): Move method to a separate util file once UiUtils.java moves into base.
- */
- protected void loadDataSync(final NavigationController navigationController, final String data,
- final String mimeType, final boolean isBase64Encoded) throws Throwable {
- loadUrl(navigationController, mTestCallbackHelperContainer,
- LoadUrlParams.createLoadDataParams(data, mimeType, isBase64Encoded));
- }
-}
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayCoercionTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698