Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabLoadObserver.java

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.test.util.browser; 5 package org.chromium.chrome.test.util.browser;
6 6
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 8
9 import org.chromium.base.ThreadUtils; 9 import org.chromium.base.ThreadUtils;
10 import org.chromium.chrome.browser.tab.EmptyTabObserver; 10 import org.chromium.chrome.browser.tab.EmptyTabObserver;
(...skipping 26 matching lines...) Expand all
37 mTab.addObserver(this); 37 mTab.addObserver(this);
38 ThreadUtils.runOnUiThread(new Runnable() { 38 ThreadUtils.runOnUiThread(new Runnable() {
39 @Override 39 @Override
40 public void run() { 40 public void run() {
41 mTab.loadUrl(new LoadUrlParams(url)); 41 mTab.loadUrl(new LoadUrlParams(url));
42 } 42 }
43 }); 43 });
44 } 44 }
45 45
46 @Override 46 @Override
47 public void onLoadStarted(Tab tab) { 47 public void onLoadStarted(Tab tab, boolean toDifferentDocument) {
48 mTabLoadStarted = true; 48 mTabLoadStarted = true;
49 } 49 }
50 50
51 @Override 51 @Override
52 public void onLoadStopped(Tab tab) { 52 public void onLoadStopped(Tab tab, boolean toDifferentDocument) {
53 mTabLoadStopped = true; 53 mTabLoadStopped = true;
54 } 54 }
55 55
56 @Override 56 @Override
57 public boolean isSatisfied() { 57 public boolean isSatisfied() {
58 if (!mTabLoadStarted) return false; 58 if (!mTabLoadStarted) return false;
59 if (!mTabLoadStopped) return false; 59 if (!mTabLoadStopped) return false;
60 if (!mTab.isLoadingAndRenderingDone()) return false; 60 if (!mTab.isLoadingAndRenderingDone()) return false;
61 61
62 if (mExpectedTitle != null && !TextUtils.equals(mExpectedTitle, mTab.get Title())) { 62 if (mExpectedTitle != null && !TextUtils.equals(mExpectedTitle, mTab.get Title())) {
63 return false; 63 return false;
64 } 64 }
65 if (mExpectedScale != null) { 65 if (mExpectedScale != null) {
66 if (mTab.getContentViewCore() == null) return false; 66 if (mTab.getContentViewCore() == null) return false;
67 if (Math.abs(mExpectedScale - mTab.getContentViewCore().getScale()) >= FLOAT_EPSILON) { 67 if (Math.abs(mExpectedScale - mTab.getContentViewCore().getScale()) >= FLOAT_EPSILON) {
68 return false; 68 return false;
69 } 69 }
70 } 70 }
71 return true; 71 return true;
72 } 72 }
73 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698