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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "net/base/ip_endpoint.h" | 18 #include "net/base/ip_endpoint.h" |
19 #include "net/base/load_timing_info.h" | 19 #include "net/base/load_timing_info.h" |
20 #include "net/base/load_timing_info_test_util.h" | 20 #include "net/base/load_timing_info_test_util.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
23 #include "net/base/test_completion_callback.h" | 23 #include "net/base/test_completion_callback.h" |
24 #include "net/dns/mock_host_resolver.h" | 24 #include "net/dns/mock_host_resolver.h" |
25 #include "net/log/capturing_net_log.h" | 25 #include "net/log/test_net_log.h" |
26 #include "net/socket/client_socket_handle.h" | 26 #include "net/socket/client_socket_handle.h" |
27 #include "net/socket/socket_test_util.h" | 27 #include "net/socket/socket_test_util.h" |
28 #include "net/socket/stream_socket.h" | 28 #include "net/socket/stream_socket.h" |
29 #include "net/socket/transport_client_socket_pool_test_util.h" | 29 #include "net/socket/transport_client_socket_pool_test_util.h" |
30 #include "net/socket/websocket_endpoint_lock_manager.h" | 30 #include "net/socket/websocket_endpoint_lock_manager.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 | 34 |
35 namespace { | 35 namespace { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 void ReleaseAllConnections(ClientSocketPoolTest::KeepAlive keep_alive) { | 97 void ReleaseAllConnections(ClientSocketPoolTest::KeepAlive keep_alive) { |
98 test_base_.ReleaseAllConnections(keep_alive); | 98 test_base_.ReleaseAllConnections(keep_alive); |
99 } | 99 } |
100 | 100 |
101 TestSocketRequest* request(int i) { return test_base_.request(i); } | 101 TestSocketRequest* request(int i) { return test_base_.request(i); } |
102 | 102 |
103 ScopedVector<TestSocketRequest>* requests() { return test_base_.requests(); } | 103 ScopedVector<TestSocketRequest>* requests() { return test_base_.requests(); } |
104 size_t completion_count() const { return test_base_.completion_count(); } | 104 size_t completion_count() const { return test_base_.completion_count(); } |
105 | 105 |
106 CapturingNetLog net_log_; | 106 TestNetLog net_log_; |
107 scoped_refptr<TransportSocketParams> params_; | 107 scoped_refptr<TransportSocketParams> params_; |
108 scoped_ptr<MockHostResolver> host_resolver_; | 108 scoped_ptr<MockHostResolver> host_resolver_; |
109 MockTransportClientSocketFactory client_socket_factory_; | 109 MockTransportClientSocketFactory client_socket_factory_; |
110 WebSocketTransportClientSocketPool pool_; | 110 WebSocketTransportClientSocketPool pool_; |
111 ClientSocketPoolTest test_base_; | 111 ClientSocketPoolTest test_base_; |
112 ScopedWebSocketEndpointZeroUnlockDelay zero_unlock_delay_; | 112 ScopedWebSocketEndpointZeroUnlockDelay zero_unlock_delay_; |
113 | 113 |
114 private: | 114 private: |
115 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportClientSocketPoolTest); | 115 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportClientSocketPoolTest); |
116 }; | 116 }; |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 EXPECT_EQ(OK, request(1)->WaitForResult()); | 1132 EXPECT_EQ(OK, request(1)->WaitForResult()); |
1133 // Third socket should still be waiting for endpoint. | 1133 // Third socket should still be waiting for endpoint. |
1134 ASSERT_FALSE(request(2)->handle()->is_initialized()); | 1134 ASSERT_FALSE(request(2)->handle()->is_initialized()); |
1135 EXPECT_EQ(LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET, | 1135 EXPECT_EQ(LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET, |
1136 request(2)->handle()->GetLoadState()); | 1136 request(2)->handle()->GetLoadState()); |
1137 } | 1137 } |
1138 | 1138 |
1139 } // namespace | 1139 } // namespace |
1140 | 1140 |
1141 } // namespace net | 1141 } // namespace net |
OLD | NEW |