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

Unified Diff: net/socket/socket_test_util.cc

Issue 835623003: Add a delay when unlocking WebSocket endpoints. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a "Scoped" prefix to WebSocketEndpointZeroUnlockDela Created 5 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: net/socket/socket_test_util.cc
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index 308de2eaf6fe4de73868d8cec17f84748a570b89..2b51e2a927d852ba1566f5f5777731d33a4a925f 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -24,6 +24,7 @@
#include "net/http/http_response_headers.h"
#include "net/socket/client_socket_pool_histograms.h"
#include "net/socket/socket.h"
+#include "net/socket/websocket_endpoint_lock_manager.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "net/ssl/ssl_info.h"
@@ -1983,6 +1984,19 @@ void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name,
return transport_pool_->ReleaseSocket(group_name, socket.Pass(), id);
}
+ScopedWebSocketEndpointZeroUnlockDelay::
+ ScopedWebSocketEndpointZeroUnlockDelay() {
+ old_delay_ =
+ WebSocketEndpointLockManager::GetInstance()->SetUnlockDelayForTesting(
+ base::TimeDelta());
+}
+
+ScopedWebSocketEndpointZeroUnlockDelay::
+ ~ScopedWebSocketEndpointZeroUnlockDelay() {
+ WebSocketEndpointLockManager::GetInstance()->SetUnlockDelayForTesting(
+ old_delay_);
mmenke 2015/01/20 15:50:53 Suggest adding protection against having two of th
Adam Rice 2015/01/21 08:54:02 Done.
+}
+
const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 };
const int kSOCKS5GreetRequestLength = arraysize(kSOCKS5GreetRequest);

Powered by Google App Engine
This is Rietveld 408576698