// Copyright 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.ActionHandler;

/**
 * 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 boolean shouldOverrideKeyEvent(KeyEvent event) {
        return mWrappedClient.shouldOverrideKeyEvent(event);
    }

    @Override
    public void onImeEvent() {
        super.onImeEvent();
        mWrappedClient.onImeEvent();
    }

    @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);
    }
}

@@ -303,16 +303,76 @@
 Event;%0A%0A
+import org.chromium.content.browser.ContentVideoViewClient;%0A
 import o
@@ -410,32 +410,32 @@
 tentViewClient;%0A
-
 import org.chrom
@@ -561,19 +561,16 @@
 r tests.
-%0A *
  Wraps a
@@ -598,16 +598,19 @@
  so that
+%0A *
  specifi
@@ -647,19 +647,16 @@
  needed.
-%0A *
  This cl
@@ -691,16 +691,19 @@
 S OF the
+%0A *
  Content
@@ -726,19 +726,16 @@
 ass them
-%0A *
  to the 
@@ -1520,21 +1520,8 @@
 ack(
-%0A            
 Cont
@@ -1532,16 +1532,28 @@
 context,
+%0A           
  ActionH
@@ -2241,16 +2241,1580 @@
 ntUrl);%0A
-
     %7D%0A
+%0A    @Override%0A    public boolean doesPerformWebSearch() %7B%0A        return mWrappedClient.doesPerformWebSearch();%0A    %7D%0A%0A    @Override%0A    public ContentVideoViewClient getContentVideoViewClient() %7B%0A        return mWrappedClient.getContentVideoViewClient();%0A    %7D%0A%0A    @Override%0A    public void onBackgroundColorChanged(int color) %7B%0A        super.onBackgroundColorChanged(color);%0A        mWrappedClient.onBackgroundColorChanged(color);%0A    %7D%0A%0A    @Override%0A    public void onOffsetsForFullscreenChanged(float topControlsOffsetYPix, float contentOffsetYPix,%0A            float overdrawBottomHeightPix) %7B%0A        super.onOffsetsForFullscreenChanged(topControlsOffsetYPix, contentOffsetYPix,%0A                overdrawBottomHeightPix);%0A        mWrappedClient.onOffsetsForFullscreenChanged(topControlsOffsetYPix, contentOffsetYPix,%0A                overdrawBottomHeightPix);%0A    %7D%0A%0A    @Override%0A    public void onImeStateChangeRequested(boolean requestShow) %7B%0A        super.onImeStateChangeRequested(requestShow);%0A        mWrappedClient.onImeStateChangeRequested(requestShow);%0A    %7D%0A%0A    @Override%0A    public void performWebSearch(String searchQuery) %7B%0A        super.performWebSearch(searchQuery);%0A        mWrappedClient.performWebSearch(searchQuery);%0A    %7D%0A%0A    @Override%0A    public void onSelectionChanged(String selection) %7B%0A        super.onSelectionChanged(selection);%0A        mWrappedClient.onSelectionChanged(selection);%0A    %7D%0A%0A    @Override%0A    public boolean shouldBlockMediaRequest(String url) %7B%0A        return mWrappedClient.shouldBlockMediaRequest(url);%0A    %7D%0A%0A
 %7D%0A

Add missing functions to TestContentViewClientWrapper.java