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

Unified Diff: chrome/test/chromedriver/net/sync_websocket_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: pure virtual Created 4 years, 8 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/net/sync_websocket_impl.cc
diff --git a/chrome/test/chromedriver/net/sync_websocket_impl.cc b/chrome/test/chromedriver/net/sync_websocket_impl.cc
index 2451fcaf23722727e3c583f263825a4a3d3fecfd..3650ef0df0b574b2a74bc3423ba93e91df969981 100644
--- a/chrome/test/chromedriver/net/sync_websocket_impl.cc
+++ b/chrome/test/chromedriver/net/sync_websocket_impl.cc
@@ -9,6 +9,7 @@
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
+#include "chrome/test/chromedriver/net/timeout.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_context_getter.h"
#include "url/gurl.h"
@@ -32,7 +33,7 @@ bool SyncWebSocketImpl::Send(const std::string& message) {
}
SyncWebSocket::StatusCode SyncWebSocketImpl::ReceiveNextMessage(
- std::string* message, const base::TimeDelta& timeout) {
+ std::string* message, const Timeout& timeout) {
return core_->ReceiveNextMessage(message, timeout);
}
@@ -74,15 +75,13 @@ bool SyncWebSocketImpl::Core::Send(const std::string& message) {
SyncWebSocket::StatusCode SyncWebSocketImpl::Core::ReceiveNextMessage(
std::string* message,
- const base::TimeDelta& timeout) {
+ const Timeout& timeout) {
base::AutoLock lock(lock_);
- base::TimeTicks deadline = base::TimeTicks::Now() + timeout;
- base::TimeDelta next_wait = timeout;
while (received_queue_.empty() && is_connected_) {
+ base::TimeDelta next_wait = timeout.GetRemainingTime();
if (next_wait <= base::TimeDelta())
return SyncWebSocket::kTimeout;
on_update_event_.TimedWait(next_wait);
- next_wait = deadline - base::TimeTicks::Now();
}
if (!is_connected_)
return SyncWebSocket::kDisconnected;
« no previous file with comments | « chrome/test/chromedriver/net/sync_websocket_impl.h ('k') | chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698