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

Unified Diff: content/browser/renderer_host/websocket_dispatcher_host_unittest.cc

Issue 972963002: Per-renderer WebSocket throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix content_unittests Created 5 years, 10 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: content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc b/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
index 0d2e7057bbcef5c0d90dadebc580843114e208bd..939092efa508187b430a70758d365c1b5390bc43 100644
--- a/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
@@ -11,6 +11,7 @@
#include "base/bind_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/message_loop/message_loop.h"
#include "content/browser/renderer_host/websocket_host.h"
#include "content/common/websocket.h"
#include "content/common/websocket_messages.h"
@@ -33,6 +34,7 @@ class MockWebSocketHost : public WebSocketHost {
MockWebSocketHost(int routing_id,
WebSocketDispatcherHost* dispatcher,
net::URLRequestContext* url_request_context,
+ base::TimeDelta delay,
WebSocketDispatcherHostTest* owner);
~MockWebSocketHost() override {}
@@ -82,6 +84,8 @@ class WebSocketDispatcherHostTest : public ::testing::Test {
std::vector<MockWebSocketHost*> mock_hosts_;
std::vector<int> gone_hosts_;
+ base::MessageLoop message_loop_;
+
base::WeakPtrFactory<WebSocketDispatcherHostTest> weak_ptr_factory_;
private:
@@ -89,9 +93,9 @@ class WebSocketDispatcherHostTest : public ::testing::Test {
return NULL;
}
- WebSocketHost* CreateWebSocketHost(int routing_id) {
- MockWebSocketHost* host =
- new MockWebSocketHost(routing_id, dispatcher_host_.get(), NULL, this);
+ WebSocketHost* CreateWebSocketHost(int routing_id, base::TimeDelta delay) {
+ MockWebSocketHost* host = new MockWebSocketHost(
+ routing_id, dispatcher_host_.get(), NULL, delay, this);
mock_hosts_.push_back(host);
return host;
}
@@ -101,8 +105,9 @@ MockWebSocketHost::MockWebSocketHost(
int routing_id,
WebSocketDispatcherHost* dispatcher,
net::URLRequestContext* url_request_context,
+ base::TimeDelta delay,
WebSocketDispatcherHostTest* owner)
- : WebSocketHost(routing_id, dispatcher, url_request_context),
+ : WebSocketHost(routing_id, dispatcher, url_request_context, delay),
owner_(owner->GetWeakPtr()) {}
void MockWebSocketHost::GoAway() {

Powered by Google App Engine
This is Rietveld 408576698