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

Unified Diff: net/socket/websocket_transport_client_socket_pool_unittest.cc

Issue 436493002: Handle multiple simultanous wss: connections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/interator/iterator/ Created 6 years, 4 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/socket/websocket_transport_client_socket_pool.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/websocket_transport_client_socket_pool_unittest.cc
diff --git a/net/socket/websocket_transport_client_socket_pool_unittest.cc b/net/socket/websocket_transport_client_socket_pool_unittest.cc
index eddd9512a936db9e2917bf230f50ef4f56659fd7..38ad6f0588f59e3ed6e7e3086cd78bd5b16408d0 100644
--- a/net/socket/websocket_transport_client_socket_pool_unittest.cc
+++ b/net/socket/websocket_transport_client_socket_pool_unittest.cc
@@ -1110,6 +1110,25 @@ TEST_F(WebSocketTransportClientSocketPoolTest, CancelRequestReclaimsSockets) {
EXPECT_EQ(OK, StartRequest("a", kDefaultPriority));
}
+// A handshake completing and then the WebSocket closing should only release one
+// Endpoint, not two.
+TEST_F(WebSocketTransportClientSocketPoolTest, EndpointLockIsOnlyReleasedOnce) {
+ host_resolver_->set_synchronous_mode(true);
+ EXPECT_EQ(OK, StartRequest("a", kDefaultPriority));
+ EXPECT_EQ(ERR_IO_PENDING, StartRequest("a", kDefaultPriority));
+ EXPECT_EQ(ERR_IO_PENDING, StartRequest("a", kDefaultPriority));
+ // First socket completes handshake.
+ WebSocketTransportClientSocketPool::UnlockEndpoint(request(0)->handle());
+ // First socket is closed.
+ request(0)->handle()->Reset();
+ // Second socket should have been released.
+ EXPECT_EQ(OK, request(1)->WaitForResult());
+ // Third socket should still be waiting for endpoint.
+ ASSERT_FALSE(request(2)->handle()->is_initialized());
+ EXPECT_EQ(LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET,
+ request(2)->handle()->GetLoadState());
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/socket/websocket_transport_client_socket_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698