OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.chrome.browser.externalnav; | 5 package org.chromium.chrome.browser.externalnav; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.Instrumentation; | 8 import android.app.Instrumentation; |
9 import android.app.Instrumentation.ActivityMonitor; | 9 import android.app.Instrumentation.ActivityMonitor; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 private final CallbackHelper mLoadFailCallback; | 75 private final CallbackHelper mLoadFailCallback; |
76 | 76 |
77 TestTabObserver(final CallbackHelper finishCallback, final CallbackHelpe
r pageFailCallback, | 77 TestTabObserver(final CallbackHelper finishCallback, final CallbackHelpe
r pageFailCallback, |
78 final CallbackHelper loadFailCallback) { | 78 final CallbackHelper loadFailCallback) { |
79 mFinishCallback = finishCallback; | 79 mFinishCallback = finishCallback; |
80 mPageFailCallback = pageFailCallback; | 80 mPageFailCallback = pageFailCallback; |
81 mLoadFailCallback = loadFailCallback; | 81 mLoadFailCallback = loadFailCallback; |
82 } | 82 } |
83 | 83 |
84 @Override | 84 @Override |
| 85 public void onDidFinishNavigation(Tab tab, String url, boolean isInMainF
rame, |
| 86 boolean isErrorPage, boolean hasCommitted, boolean isSamePage, |
| 87 boolean isFragmentNavigation, Integer pageTransition, int errorC
ode, |
| 88 int httpStatusCode) { |
| 89 if (errorCode != 0) { |
| 90 mLoadFailCallback.notifyCalled(); |
| 91 } |
| 92 } |
| 93 |
| 94 @Override |
85 public void onPageLoadFinished(Tab tab) { | 95 public void onPageLoadFinished(Tab tab) { |
86 mFinishCallback.notifyCalled(); | 96 mFinishCallback.notifyCalled(); |
87 } | 97 } |
88 | 98 |
89 @Override | 99 @Override |
90 public void onPageLoadFailed(Tab tab, int errorCode) { | 100 public void onPageLoadFailed(Tab tab, int errorCode) { |
91 mPageFailCallback.notifyCalled(); | 101 mPageFailCallback.notifyCalled(); |
92 } | 102 } |
93 | 103 |
94 @Override | 104 @Override |
95 public void onDidFailLoad(Tab tab, boolean isProvisionalLoad, boolean is
MainFrame, | 105 public void onDidFailLoad(Tab tab, boolean isMainFrame, int errorCode, S
tring description, |
96 int errorCode, String description, String failingUrl) { | 106 String failingUrl) { |
97 mLoadFailCallback.notifyCalled(); | 107 mLoadFailCallback.notifyCalled(); |
98 } | 108 } |
99 | 109 |
100 @Override | 110 @Override |
101 public void onDestroyed(Tab tab) { | 111 public void onDestroyed(Tab tab) { |
102 // A new tab is destroyed when loading is overridden while opening i
t. | 112 // A new tab is destroyed when loading is overridden while opening i
t. |
103 mPageFailCallback.notifyCalled(); | 113 mPageFailCallback.notifyCalled(); |
104 } | 114 } |
105 } | 115 } |
106 | 116 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return mActivityMonitor.getHits(); | 349 return mActivityMonitor.getHits(); |
340 } | 350 } |
341 })); | 351 })); |
342 } | 352 } |
343 | 353 |
344 @Override | 354 @Override |
345 public void startMainActivity() throws InterruptedException { | 355 public void startMainActivity() throws InterruptedException { |
346 startMainActivityOnBlankPage(); | 356 startMainActivityOnBlankPage(); |
347 } | 357 } |
348 } | 358 } |
OLD | NEW |