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; |