This source file includes following definitions.
- getOnPageStartedHelper
- getOnPageFinishedHelper
- getOnReceivedErrorHelper
- didStartLoading
- didStopLoading
- didFailLoad
package org.chromium.content.browser.test.util;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.WebContentsObserverAndroid;
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;
public class TestWebContentsObserver extends WebContentsObserverAndroid {
private OnPageStartedHelper mOnPageStartedHelper;
private OnPageFinishedHelper mOnPageFinishedHelper;
private OnReceivedErrorHelper mOnReceivedErrorHelper;
public TestWebContentsObserver(ContentViewCore contentViewCore) {
super(contentViewCore);
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 didStartLoading(String url) {
super.didStartLoading(url);
mOnPageStartedHelper.notifyCalled(url);
}
@Override
public void didStopLoading(String url) {
super.didStopLoading(url);
mOnPageFinishedHelper.notifyCalled(url);
}
@Override
public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame,
int errorCode, String description, String failingUrl) {
super.didFailLoad(isProvisionalLoad, isMainFrame, errorCode, description, failingUrl);
mOnReceivedErrorHelper.notifyCalled(errorCode, description, failingUrl);
}
}