// Copyright (c) 2013 mogoweb. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package com.mogoweb.chrome.shell.test;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageStartedHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnReceivedErrorHelper;
import android.graphics.Bitmap;
import com.mogoweb.chrome.WebView;
import com.mogoweb.chrome.WebViewClient;
public class TestWebViewClient extends WebViewClient {
private final OnPageStartedHelper mOnPageStartedHelper;
private final OnPageFinishedHelper mOnPageFinishedHelper;
private final OnReceivedErrorHelper mOnReceivedErrorHelper;
public TestWebViewClient() {
mOnPageStartedHelper = new OnPageStartedHelper();
mOnPageFinishedHelper = new OnPageFinishedHelper();
mOnReceivedErrorHelper = new OnReceivedErrorHelper();
}
public OnPageStartedHelper getOnPageStartedHelper() {
return mOnPageStartedHelper;
}
public OnPageFinishedHelper getOnPageFinishedHelper() {
return mOnPageFinishedHelper;
}
public OnReceivedErrorHelper getOnReceivedErrorHelper() {
return mOnReceivedErrorHelper;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
mOnPageStartedHelper.notifyCalled(url);
}
@Override
public void onPageFinished(WebView view, String url) {
mOnPageFinishedHelper.notifyCalled(url);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
mOnReceivedErrorHelper.notifyCalled(errorCode, description, failingUrl);
}
}