summaryrefslogtreecommitdiffstats
path: root/chrome/test/chromedriver
diff options
context:
space:
mode:
authorsamuong <samuong@chromium.org>2015-07-30 13:06:13 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-30 20:06:52 +0000
commit8f3f4770da896fd93adcc3fb43a5d878e5239938 (patch)
tree0f138b9abe8cd454b6edc40f597099fea98445b7 /chrome/test/chromedriver
parente21e153dafb0a37b8d86c125d3473a139ce8fe6e (diff)
downloadchromium_src-8f3f4770da896fd93adcc3fb43a5d878e5239938.zip
chromium_src-8f3f4770da896fd93adcc3fb43a5d878e5239938.tar.gz
chromium_src-8f3f4770da896fd93adcc3fb43a5d878e5239938.tar.bz2
[chromedriver] Don't evaluate document.readyState if we already know it is loading.
This saves a call to Runtime.evaluate, and also fixes a race condition where the Page.loadEventFired event happens while document.readyState is being evaluated. If this happens, we might incorrectly conclude that the page has not finished loading. I've also disabled MiscTest.testStimulatesStrangeOnloadInteractionInFirefox, due to issue 1167. BUG=chromedriver:1158,chromedriver:1167 TBR=stgao@chromium.org Review URL: https://codereview.chromium.org/1259713004 Cr-Commit-Position: refs/heads/master@{#341179}
Diffstat (limited to 'chrome/test/chromedriver')
-rw-r--r--chrome/test/chromedriver/chrome/navigation_tracker.cc20
-rw-r--r--chrome/test/chromedriver/test/test_expectations1
2 files changed, 12 insertions, 9 deletions
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker.cc b/chrome/test/chromedriver/chrome/navigation_tracker.cc
index 906347b..ae77138 100644
--- a/chrome/test/chromedriver/chrome/navigation_tracker.cc
+++ b/chrome/test/chromedriver/chrome/navigation_tracker.cc
@@ -32,15 +32,17 @@ NavigationTracker::~NavigationTracker() {}
Status NavigationTracker::IsPendingNavigation(const std::string& frame_id,
bool* is_pending) {
if (!IsExpectingFrameLoadingEvents()) {
- base::DictionaryValue params;
- params.SetString("expression", "document.readyState");
- scoped_ptr<base::DictionaryValue> result;
- Status status =
- client_->SendCommandAndGetResult("Runtime.evaluate", params, &result);
- std::string ready_state;
- if (status.IsError() || !result->GetString("result.value", &ready_state))
- return status;
- loading_state_ = ready_state == "complete" ? kNotLoading : kLoading;
+ if (loading_state_ != kLoading) {
+ base::DictionaryValue params;
+ params.SetString("expression", "document.readyState");
+ scoped_ptr<base::DictionaryValue> result;
+ Status status =
+ client_->SendCommandAndGetResult("Runtime.evaluate", params, &result);
+ std::string ready_state;
+ if (status.IsError() || !result->GetString("result.value", &ready_state))
+ return status;
+ loading_state_ = ready_state == "complete" ? kNotLoading : kLoading;
+ }
} else {
if (loading_state_ == kUnknown) {
scoped_ptr<base::DictionaryValue> result;
diff --git a/chrome/test/chromedriver/test/test_expectations b/chrome/test/chromedriver/test/test_expectations
index 00a93b6..d9818d1 100644
--- a/chrome/test/chromedriver/test/test_expectations
+++ b/chrome/test/chromedriver/test/test_expectations
@@ -97,6 +97,7 @@ _REVISION_NEGATIVE_FILTER['HEAD'] = [
'DragAndDropTest.testShouldAllowUsersToDragAndDropToElementsOffTheCurrentViewPort',
'DragAndDropTest.testElementInDiv',
# https://code.google.com/p/chromedriver/issues/detail?id=1167
+ 'MiscTest.testStimulatesStrangeOnloadInteractionInFirefox',
'PageLoadingTest.testShouldNotHangIfDocumentOpenCallIsNeverFollowedByDocumentCloseCall',
]