Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / content / public / test / android / javatests / src / org / chromium / content / browser / test / util / TestContentViewClientWrapper.java
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.
4
5 package org.chromium.content.browser.test.util;
6
7 import android.content.Context;
8 import android.view.ActionMode;
9 import android.view.KeyEvent;
10
11 import org.chromium.content.browser.ContentViewClient;
12 import org.chromium.content.browser.SelectActionModeCallback.ActionHandler;
13
14 /**
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.
19  */
20 public class TestContentViewClientWrapper extends TestContentViewClient {
21
22     private ContentViewClient mWrappedClient;
23
24     public TestContentViewClientWrapper(ContentViewClient wrappedClient) {
25         assert wrappedClient != null;
26         mWrappedClient = wrappedClient;
27     }
28
29     @Override
30     public void onUpdateTitle(String title) {
31         super.onUpdateTitle(title);
32         mWrappedClient.onUpdateTitle(title);
33     }
34
35     @Override
36     public boolean shouldOverrideKeyEvent(KeyEvent event) {
37         return mWrappedClient.shouldOverrideKeyEvent(event);
38     }
39
40     @Override
41     public void onImeEvent() {
42         super.onImeEvent();
43         mWrappedClient.onImeEvent();
44     }
45
46     @Override
47     public ActionMode.Callback getSelectActionModeCallback(
48             Context context, ActionHandler actionHandler, boolean incognito) {
49         return mWrappedClient.getSelectActionModeCallback(context, actionHandler, incognito);
50     }
51
52     @Override
53     public void onContextualActionBarShown() {
54         super.onContextualActionBarShown();
55         mWrappedClient.onContextualActionBarShown();
56     }
57
58     @Override
59     public void onContextualActionBarHidden() {
60         super.onContextualActionBarHidden();
61         mWrappedClient.onContextualActionBarHidden();
62     }
63
64     @Override
65     public void onStartContentIntent(Context context, String contentUrl) {
66         super.onStartContentIntent(context, contentUrl);
67         mWrappedClient.onStartContentIntent(context, contentUrl);
68     }
69 }