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

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

Issue 11778005: JavascriptAppModalDialog tests and necessary infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upstreamed pliard@'s click-after-dismiss regression test. Created 7 years, 11 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/TestContentViewClientWrapper.java
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestContentViewClientWrapper.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestContentViewClientWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..b92da936b6dfd54f209849273ced3b56de39bff9
--- /dev/null
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestContentViewClientWrapper.java
@@ -0,0 +1,94 @@
+// Copyright (c) 2013 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.test.util;
+
+import android.content.Context;
+import android.view.ActionMode;
+import android.view.KeyEvent;
+
+import org.chromium.content.browser.ContentViewClient;
+import org.chromium.content.browser.SelectActionModeCallback;
+import org.chromium.content.browser.SelectActionModeCallback.ActionHandler;
+import org.chromium.content.browser.test.util.TestContentViewClient;
+
+/**
+ * Simplistic {@link TestContentViewClient} for browser tests.
+ * Wraps around existing client so that specific methods can be overridden if needed.
+ * This class MUST override ALL METHODS OF the ContentViewClient and pass them
+ * to the wrapped client.
+ */
+public class TestContentViewClientWrapper extends TestContentViewClient {
+
+ private ContentViewClient mWrappedClient;
+
+ public TestContentViewClientWrapper(ContentViewClient wrappedClient) {
+ assert wrappedClient != null;
+ mWrappedClient = wrappedClient;
+ }
+
+ @Override
+ public void onUpdateTitle(String title) {
+ super.onUpdateTitle(title);
+ mWrappedClient.onUpdateTitle(title);
+ }
+
+ @Override
+ public void onScaleChanged(float oldScale, float newScale) {
+ super.onScaleChanged(oldScale, newScale);
+ mWrappedClient.onScaleChanged(oldScale, newScale);
+ }
+
+ @Override
+ public void onTabCrash() {
+ super.onTabCrash();
+ mWrappedClient.onTabCrash();
+ }
+
+ @Override
+ public boolean shouldOverrideKeyEvent(KeyEvent event) {
+ return mWrappedClient.shouldOverrideKeyEvent(event);
+ }
+
+ @Override
+ public void onImeEvent() {
+ super.onImeEvent();
+ mWrappedClient.onImeEvent();
+ }
+
+ @Override
+ public void onEvaluateJavaScriptResult(int id, String jsonResult) {
+ super.onEvaluateJavaScriptResult(id, jsonResult);
+ mWrappedClient.onEvaluateJavaScriptResult(id, jsonResult);
+ }
+
+ @Override
+ public boolean shouldOverrideScroll(float deltaX, float deltaY, float currX, float currY) {
+ return mWrappedClient.shouldOverrideScroll(deltaX, deltaY, currX, currX);
+ }
+
+ @Override
+ public ActionMode.Callback getSelectActionModeCallback(
+ Context context, ActionHandler actionHandler, boolean incognito) {
+ return mWrappedClient.getSelectActionModeCallback(context, actionHandler, incognito);
+ }
+
+ @Override
+ public void onContextualActionBarShown() {
+ super.onContextualActionBarShown();
+ mWrappedClient.onContextualActionBarShown();
+ }
+
+ @Override
+ public void onContextualActionBarHidden() {
+ super.onContextualActionBarHidden();
+ mWrappedClient.onContextualActionBarHidden();
+ }
+
+ @Override
+ public void onStartContentIntent(Context context, String contentUrl) {
+ super.onStartContentIntent(context, contentUrl);
+ mWrappedClient.onStartContentIntent(context, contentUrl);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698