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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « net/socket/websocket_transport_client_socket_pool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/socket/websocket_transport_client_socket_pool.h" 5 #include "net/socket/websocket_transport_client_socket_pool.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1103
1104 connect_trigger.Run(); // Calls InvokeUserCallbackLater() 1104 connect_trigger.Run(); // Calls InvokeUserCallbackLater()
1105 1105
1106 request(0)->handle()->Reset(); // calls CancelRequest() 1106 request(0)->handle()->Reset(); // calls CancelRequest()
1107 1107
1108 // We should now be able to create a new connection without blocking on the 1108 // We should now be able to create a new connection without blocking on the
1109 // endpoint lock. 1109 // endpoint lock.
1110 EXPECT_EQ(OK, StartRequest("a", kDefaultPriority)); 1110 EXPECT_EQ(OK, StartRequest("a", kDefaultPriority));
1111 } 1111 }
1112 1112
1113 // A handshake completing and then the WebSocket closing should only release one
1114 // Endpoint, not two.
1115 TEST_F(WebSocketTransportClientSocketPoolTest, EndpointLockIsOnlyReleasedOnce) {
1116 host_resolver_->set_synchronous_mode(true);
1117 EXPECT_EQ(OK, StartRequest("a", kDefaultPriority));
1118 EXPECT_EQ(ERR_IO_PENDING, StartRequest("a", kDefaultPriority));
1119 EXPECT_EQ(ERR_IO_PENDING, StartRequest("a", kDefaultPriority));
1120 // First socket completes handshake.
1121 WebSocketTransportClientSocketPool::UnlockEndpoint(request(0)->handle());
1122 // First socket is closed.
1123 request(0)->handle()->Reset();
1124 // Second socket should have been released.
1125 EXPECT_EQ(OK, request(1)->WaitForResult());
1126 // Third socket should still be waiting for endpoint.
1127 ASSERT_FALSE(request(2)->handle()->is_initialized());
1128 EXPECT_EQ(LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET,
1129 request(2)->handle()->GetLoadState());
1130 }
1131
1113 } // namespace 1132 } // namespace
1114 1133
1115 } // namespace net 1134 } // namespace net
OLDNEW
« 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