OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser.test.util; | 5 package org.chromium.content.browser.test.util; |
6 | 6 |
7 import org.chromium.content.browser.WebContentsObserverAndroid; | 7 import org.chromium.content.browser.WebContentsObserver; |
8 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
FinishedHelper; | 8 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
FinishedHelper; |
9 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
StartedHelper; | 9 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
StartedHelper; |
10 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnRece
ivedErrorHelper; | 10 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnRece
ivedErrorHelper; |
11 import org.chromium.content_public.browser.WebContents; | 11 import org.chromium.content_public.browser.WebContents; |
12 | 12 |
13 /** | 13 /** |
14 * The default WebContentsObserverAndroid used by ContentView tests. The below c
allbacks can be | 14 * The default WebContentsObserver used by ContentView tests. The below callback
s can be |
15 * accessed by using {@link TestCallbackHelperContainer} or extending this class
. | 15 * accessed by using {@link TestCallbackHelperContainer} or extending this class
. |
16 */ | 16 */ |
17 public class TestWebContentsObserver extends WebContentsObserverAndroid { | 17 public class TestWebContentsObserver extends WebContentsObserver { |
18 | 18 |
19 private final OnPageStartedHelper mOnPageStartedHelper; | 19 private final OnPageStartedHelper mOnPageStartedHelper; |
20 private final OnPageFinishedHelper mOnPageFinishedHelper; | 20 private final OnPageFinishedHelper mOnPageFinishedHelper; |
21 private final OnReceivedErrorHelper mOnReceivedErrorHelper; | 21 private final OnReceivedErrorHelper mOnReceivedErrorHelper; |
22 | 22 |
23 public TestWebContentsObserver(WebContents webContents) { | 23 public TestWebContentsObserver(WebContents webContents) { |
24 super(webContents); | 24 super(webContents); |
25 mOnPageStartedHelper = new OnPageStartedHelper(); | 25 mOnPageStartedHelper = new OnPageStartedHelper(); |
26 mOnPageFinishedHelper = new OnPageFinishedHelper(); | 26 mOnPageFinishedHelper = new OnPageFinishedHelper(); |
27 mOnReceivedErrorHelper = new OnReceivedErrorHelper(); | 27 mOnReceivedErrorHelper = new OnReceivedErrorHelper(); |
(...skipping 29 matching lines...) Expand all Loading... |
57 mOnPageFinishedHelper.notifyCalled(url); | 57 mOnPageFinishedHelper.notifyCalled(url); |
58 } | 58 } |
59 | 59 |
60 @Override | 60 @Override |
61 public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, | 61 public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, |
62 int errorCode, String description, String failingUrl) { | 62 int errorCode, String description, String failingUrl) { |
63 super.didFailLoad(isProvisionalLoad, isMainFrame, errorCode, description
, failingUrl); | 63 super.didFailLoad(isProvisionalLoad, isMainFrame, errorCode, description
, failingUrl); |
64 mOnReceivedErrorHelper.notifyCalled(errorCode, description, failingUrl); | 64 mOnReceivedErrorHelper.notifyCalled(errorCode, description, failingUrl); |
65 } | 65 } |
66 } | 66 } |
OLD | NEW |