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

Unified Diff: net/websockets/websocket_throttle_unittest.cc

Issue 1750001: Don't process the same address for throttling. (Closed)
Patch Set: add test Created 10 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
« no previous file with comments | « net/websockets/websocket_throttle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_throttle_unittest.cc
diff --git a/net/websockets/websocket_throttle_unittest.cc b/net/websockets/websocket_throttle_unittest.cc
index 91d588f611f8283af92280a763dbcf43c40a1380..6c0dfbb2f69b411238aa76247d84a11a61b0ef54 100644
--- a/net/websockets/websocket_throttle_unittest.cc
+++ b/net/websockets/websocket_throttle_unittest.cc
@@ -279,4 +279,29 @@ TEST_F(WebSocketThrottleTest, Throttle) {
MessageLoopForIO::current()->RunAllPending();
}
+TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) {
+ DummySocketStreamDelegate delegate;
+
+ // For localhost: 127.0.0.1, 127.0.0.1
+ struct addrinfo* addr = AddAddr(127, 0, 0, 1, NULL);
+ addr = AddAddr(127, 0, 0, 1, addr);
+ scoped_refptr<WebSocketJob> w1 = new WebSocketJob(&delegate);
+ scoped_refptr<SocketStream> s1 =
+ new SocketStream(GURL("ws://localhost/"), w1.get());
+ w1->InitSocketStream(s1.get());
+ WebSocketThrottleTest::MockSocketStreamConnect(s1, addr);
+ DeleteAddrInfo(addr);
+
+ DLOG(INFO) << "socket1";
+ TestCompletionCallback callback_s1;
+ // Trying to open connection to localhost will start without wait.
+ EXPECT_EQ(OK, w1->OnStartOpenConnection(s1, &callback_s1));
+
+ DLOG(INFO) << "socket1 close";
+ w1->OnClose(s1.get());
+ s1->DetachDelegate();
+ DLOG(INFO) << "Done";
+ MessageLoopForIO::current()->RunAllPending();
+}
+
}
« no previous file with comments | « net/websockets/websocket_throttle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698