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

Unified Diff: chrome/test/chromedriver/chrome/chrome_desktop_impl.cc

Issue 1669453002: [chromedriver] Apply page load timeout to slow cross-process navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
diff --git a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
index 834e721c47f8d5f8cd2e31b0f6b5e54d743da6f1..a8ecbd1ba01ad2aa9fa73e7c1501fca0030e5ba8 100644
--- a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
+++ b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
@@ -21,6 +21,7 @@
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/chrome/web_view_impl.h"
#include "chrome/test/chromedriver/net/port_server.h"
+#include "chrome/test/chromedriver/util.h"
#if defined(OS_POSIX)
#include <errno.h>
@@ -101,12 +102,12 @@ ChromeDesktopImpl::~ChromeDesktopImpl() {
}
Status ChromeDesktopImpl::WaitForPageToLoad(const std::string& url,
- const base::TimeDelta& timeout,
+ const base::TimeDelta& timeout_raw,
scoped_ptr<WebView>* web_view) {
- base::TimeTicks deadline = base::TimeTicks::Now() + timeout;
+ Timeout timeout(timeout_raw);
std::string id;
WebViewInfo::Type type = WebViewInfo::Type::kPage;
- while (base::TimeTicks::Now() < deadline) {
+ while (timeout.GetRemainingTime() > base::TimeDelta()) {
WebViewsInfo views_info;
Status status = devtools_http_client_->GetWebViewsInfo(&views_info);
if (status.IsError())
@@ -146,7 +147,7 @@ Status ChromeDesktopImpl::WaitForPageToLoad(const std::string& url,
return status;
status = web_view_tmp->WaitForPendingNavigations(
- std::string(), deadline - base::TimeTicks::Now(), false);
+ std::string(), timeout, false);
if (status.IsOk())
*web_view = std::move(web_view_tmp);
return status;

Powered by Google App Engine
This is Rietveld 408576698