Commit b926c707 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Support PlzNavigate in Chrome v63

Update ChromeDriver to support PlzNavigate in Chrome v63. (v64 is
already supported.)

Bug: chromedriver:2025
Change-Id: I9efcda03d24c5475b01e2736992624a3dffd687b
Reviewed-on: https://chromium-review.googlesource.com/798801Reviewed-by: default avatarShuotao Gao <stgao@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520635}
parent da228726
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "chrome/test/chromedriver/chrome/devtools_client.h" #include "chrome/test/chromedriver/chrome/devtools_client.h"
#include "chrome/test/chromedriver/chrome/javascript_dialog_manager.h" #include "chrome/test/chromedriver/chrome/javascript_dialog_manager.h"
#include "chrome/test/chromedriver/chrome/status.h" #include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/net/timeout.h"
namespace { namespace {
...@@ -243,7 +244,7 @@ Status NavigationTracker::OnEvent(DevToolsClient* client, ...@@ -243,7 +244,7 @@ Status NavigationTracker::OnEvent(DevToolsClient* client,
pending_frame_set_.insert(frame_id); pending_frame_set_.insert(frame_id);
loading_state_ = kLoading; loading_state_ = kLoading;
if (browser_info_->major_version >= 64) { if (browser_info_->major_version >= 63) {
// Check if the document is really loading. // Check if the document is really loading.
base::DictionaryValue params; base::DictionaryValue params;
params.SetString("expression", "document.readyState"); params.SetString("expression", "document.readyState");
...@@ -427,8 +428,11 @@ Status NavigationTracker::OnCommandSuccess( ...@@ -427,8 +428,11 @@ Status NavigationTracker::OnCommandSuccess(
const std::string& method, const std::string& method,
const base::DictionaryValue& result, const base::DictionaryValue& result,
const Timeout& command_timeout) { const Timeout& command_timeout) {
// Check for start of navigation. In some case response to navigate is delayed
// until after the command has already timed out, in which case it has already
// been cancelled or will be cancelled soon, and should be ignored.
if ((method == "Page.navigate" || method == "Page.navigateToHistoryEntry") && if ((method == "Page.navigate" || method == "Page.navigateToHistoryEntry") &&
loading_state_ != kLoading) { loading_state_ != kLoading && !command_timeout.IsExpired()) {
// At this point the browser has initiated the navigation, but besides that, // At this point the browser has initiated the navigation, but besides that,
// it is unknown what will happen. // it is unknown what will happen.
// //
......
...@@ -185,11 +185,11 @@ Status WebViewImpl::Load(const std::string& url, const Timeout* timeout) { ...@@ -185,11 +185,11 @@ Status WebViewImpl::Load(const std::string& url, const Timeout* timeout) {
return Status(kUnknownError, "unsupported protocol"); return Status(kUnknownError, "unsupported protocol");
base::DictionaryValue params; base::DictionaryValue params;
params.SetString("url", url); params.SetString("url", url);
if (browser_info_->major_version >= 64 && if (browser_info_->major_version >= 63 &&
navigation_tracker_->IsNonBlocking()) { navigation_tracker_->IsNonBlocking()) {
// With non-bloakcing navigation tracker, the previous navigation might // With non-bloakcing navigation tracker, the previous navigation might
// still be in progress, and this can cause the new navigate command to be // still be in progress, and this can cause the new navigate command to be
// ignored on Chrome v64 and above. Stop previous navigation first. // ignored on Chrome v63 and above. Stop previous navigation first.
client_->SendCommand("Page.stopLoading", base::DictionaryValue()); client_->SendCommand("Page.stopLoading", base::DictionaryValue());
// Use SendCommandAndIgnoreResponse to ensure no blocking occurs. // Use SendCommandAndIgnoreResponse to ensure no blocking occurs.
return client_->SendCommandAndIgnoreResponse("Page.navigate", params); return client_->SendCommandAndIgnoreResponse("Page.navigate", params);
...@@ -516,7 +516,7 @@ Status WebViewImpl::WaitForPendingNavigations(const std::string& frame_id, ...@@ -516,7 +516,7 @@ Status WebViewImpl::WaitForPendingNavigations(const std::string& frame_id,
if (status.code() == kTimeout && stop_load_on_timeout) { if (status.code() == kTimeout && stop_load_on_timeout) {
VLOG(0) << "Timed out. Stopping navigation..."; VLOG(0) << "Timed out. Stopping navigation...";
navigation_tracker_->set_timed_out(true); navigation_tracker_->set_timed_out(true);
if (browser_info_->major_version >= 64) { if (browser_info_->major_version >= 63) {
client_->SendCommand("Page.stopLoading", base::DictionaryValue()); client_->SendCommand("Page.stopLoading", base::DictionaryValue());
} else { } else {
std::unique_ptr<base::Value> unused_value; std::unique_ptr<base::Value> unused_value;
......
...@@ -113,6 +113,14 @@ _REVISION_NEGATIVE_FILTER['HEAD'] = [ ...@@ -113,6 +113,14 @@ _REVISION_NEGATIVE_FILTER['HEAD'] = [
'PageLoadingTest.testShouldBeAbleToGetAFragmentOnTheCurrentPage', 'PageLoadingTest.testShouldBeAbleToGetAFragmentOnTheCurrentPage',
] ]
_REVISION_NEGATIVE_FILTER['63'] = (
_REVISION_NEGATIVE_FILTER['HEAD'] + [
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=2025
'MiscTest.testStimulatesStrangeOnloadInteractionInFirefox',
'PageLoadingTest.testShouldNotHangIfDocumentOpenCallIsNeverFollowedByDocumentCloseCall',
]
)
_OS_NEGATIVE_FILTER = {} _OS_NEGATIVE_FILTER = {}
_OS_NEGATIVE_FILTER['win'] = [ _OS_NEGATIVE_FILTER['win'] = [
# Flaky: https://bugs.chromium.org/p/chromedriver/issues/detail?id=373 # Flaky: https://bugs.chromium.org/p/chromedriver/issues/detail?id=373
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment