OLD | NEW |
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 class RequestSocketCallback : public TestCompletionCallbackBase { | 375 class RequestSocketCallback : public TestCompletionCallbackBase { |
376 public: | 376 public: |
377 RequestSocketCallback(ClientSocketHandle* handle, | 377 RequestSocketCallback(ClientSocketHandle* handle, |
378 WebSocketTransportClientSocketPool* pool) | 378 WebSocketTransportClientSocketPool* pool) |
379 : handle_(handle), | 379 : handle_(handle), |
380 pool_(pool), | 380 pool_(pool), |
381 within_callback_(false), | 381 within_callback_(false), |
382 callback_(base::Bind(&RequestSocketCallback::OnComplete, | 382 callback_(base::Bind(&RequestSocketCallback::OnComplete, |
383 base::Unretained(this))) {} | 383 base::Unretained(this))) {} |
384 | 384 |
385 virtual ~RequestSocketCallback() {} | 385 ~RequestSocketCallback() override {} |
386 | 386 |
387 const CompletionCallback& callback() const { return callback_; } | 387 const CompletionCallback& callback() const { return callback_; } |
388 | 388 |
389 private: | 389 private: |
390 void OnComplete(int result) { | 390 void OnComplete(int result) { |
391 SetResult(result); | 391 SetResult(result); |
392 ASSERT_EQ(OK, result); | 392 ASSERT_EQ(OK, result); |
393 | 393 |
394 if (!within_callback_) { | 394 if (!within_callback_) { |
395 // Don't allow reuse of the socket. Disconnect it and then release it and | 395 // Don't allow reuse of the socket. Disconnect it and then release it and |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 EXPECT_EQ(OK, request(1)->WaitForResult()); | 1134 EXPECT_EQ(OK, request(1)->WaitForResult()); |
1135 // Third socket should still be waiting for endpoint. | 1135 // Third socket should still be waiting for endpoint. |
1136 ASSERT_FALSE(request(2)->handle()->is_initialized()); | 1136 ASSERT_FALSE(request(2)->handle()->is_initialized()); |
1137 EXPECT_EQ(LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET, | 1137 EXPECT_EQ(LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET, |
1138 request(2)->handle()->GetLoadState()); | 1138 request(2)->handle()->GetLoadState()); |
1139 } | 1139 } |
1140 | 1140 |
1141 } // namespace | 1141 } // namespace |
1142 | 1142 |
1143 } // namespace net | 1143 } // namespace net |
OLD | NEW |