TestContentViewClient.java revision c5cede9ae108bb15f6b7a8aea21c7e1fefa2834c
1// Copyright 2012 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 5package org.chromium.content.browser.test.util; 6 7import android.content.Context; 8 9import org.chromium.content.browser.ContentViewClient; 10import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnStartContentIntentHelper; 11 12/** 13 * The default ContentViewClient used by ContentView tests. 14 * <p> 15 * Tests that need to supply their own ContentViewClient should do that 16 * by extending this one. 17 */ 18public class TestContentViewClient extends ContentViewClient { 19 20 private final OnStartContentIntentHelper mOnStartContentIntentHelper; 21 22 public TestContentViewClient() { 23 mOnStartContentIntentHelper = new OnStartContentIntentHelper(); 24 } 25 26 public OnStartContentIntentHelper getOnStartContentIntentHelper() { 27 return mOnStartContentIntentHelper; 28 } 29 30 /** 31 * ATTENTION!: When overriding the following method, be sure to call 32 * the corresponding method in the super class. Otherwise 33 * {@link CallbackHelper#waitForCallback()} methods will 34 * stop working! 35 */ 36 37 @Override 38 public void onStartContentIntent(Context context, String contentUrl) { 39 mOnStartContentIntentHelper.notifyCalled(contentUrl); 40 } 41} 42