1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.content.browser.test.util;
7 import android.content.Context;
8 import android.view.ActionMode;
9 import android.view.KeyEvent;
11 import org.chromium.content.browser.ContentViewClient;
12 import org.chromium.content.browser.SelectActionModeCallback.ActionHandler;
15 * Simplistic {@link TestContentViewClient} for browser tests.
16 * Wraps around existing client so that specific methods can be overridden if needed.
17 * This class MUST override ALL METHODS OF the ContentViewClient and pass them
18 * to the wrapped client.
20 public class TestContentViewClientWrapper extends TestContentViewClient {
22 private ContentViewClient mWrappedClient;
24 public TestContentViewClientWrapper(ContentViewClient wrappedClient) {
25 assert wrappedClient != null;
26 mWrappedClient = wrappedClient;
30 public void onUpdateTitle(String title) {
31 super.onUpdateTitle(title);
32 mWrappedClient.onUpdateTitle(title);
36 public boolean shouldOverrideKeyEvent(KeyEvent event) {
37 return mWrappedClient.shouldOverrideKeyEvent(event);
41 public void onImeEvent() {
43 mWrappedClient.onImeEvent();
47 public ActionMode.Callback getSelectActionModeCallback(
48 Context context, ActionHandler actionHandler, boolean incognito) {
49 return mWrappedClient.getSelectActionModeCallback(context, actionHandler, incognito);
53 public void onContextualActionBarShown() {
54 super.onContextualActionBarShown();
55 mWrappedClient.onContextualActionBarShown();
59 public void onContextualActionBarHidden() {
60 super.onContextualActionBarHidden();
61 mWrappedClient.onContextualActionBarHidden();
65 public void onStartContentIntent(Context context, String contentUrl) {
66 super.onStartContentIntent(context, contentUrl);
67 mWrappedClient.onStartContentIntent(context, contentUrl);