OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/socks_client_socket_pool.h" | 5 #include "net/socket/socks_client_socket_pool.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "net/base/load_timing_info.h" | 11 #include "net/base/load_timing_info.h" |
12 #include "net/base/load_timing_info_test_util.h" | 12 #include "net/base/load_timing_info_test_util.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 #include "net/base/test_completion_callback.h" | 14 #include "net/base/test_completion_callback.h" |
15 #include "net/dns/mock_host_resolver.h" | 15 #include "net/dns/mock_host_resolver.h" |
| 16 #include "net/log/net_log_source.h" |
| 17 #include "net/log/net_log_with_source.h" |
16 #include "net/socket/client_socket_factory.h" | 18 #include "net/socket/client_socket_factory.h" |
17 #include "net/socket/client_socket_handle.h" | 19 #include "net/socket/client_socket_handle.h" |
18 #include "net/socket/socket_test_util.h" | 20 #include "net/socket/socket_test_util.h" |
19 #include "net/test/gtest_util.h" | 21 #include "net/test/gtest_util.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
22 | 24 |
23 using net::test::IsError; | 25 using net::test::IsError; |
24 using net::test::IsOk; | 26 using net::test::IsOk; |
25 | 27 |
26 namespace net { | 28 namespace net { |
27 | 29 |
28 namespace { | 30 namespace { |
29 | 31 |
30 const int kMaxSockets = 32; | 32 const int kMaxSockets = 32; |
31 const int kMaxSocketsPerGroup = 6; | 33 const int kMaxSocketsPerGroup = 6; |
32 | 34 |
33 // Make sure |handle|'s load times are set correctly. Only connect times should | 35 // Make sure |handle|'s load times are set correctly. Only connect times should |
34 // be set. | 36 // be set. |
35 void TestLoadTimingInfo(const ClientSocketHandle& handle) { | 37 void TestLoadTimingInfo(const ClientSocketHandle& handle) { |
36 LoadTimingInfo load_timing_info; | 38 LoadTimingInfo load_timing_info; |
37 EXPECT_TRUE(handle.GetLoadTimingInfo(false, &load_timing_info)); | 39 EXPECT_TRUE(handle.GetLoadTimingInfo(false, &load_timing_info)); |
38 | 40 |
39 // None of these tests use a NetLog. | 41 // None of these tests use a NetLog. |
40 EXPECT_EQ(NetLog::Source::kInvalidId, load_timing_info.socket_log_id); | 42 EXPECT_EQ(NetLogSource::kInvalidId, load_timing_info.socket_log_id); |
41 | 43 |
42 EXPECT_FALSE(load_timing_info.socket_reused); | 44 EXPECT_FALSE(load_timing_info.socket_reused); |
43 | 45 |
44 ExpectConnectTimingHasTimes(load_timing_info.connect_timing, | 46 ExpectConnectTimingHasTimes(load_timing_info.connect_timing, |
45 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); | 47 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); |
46 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); | 48 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); |
47 } | 49 } |
48 | 50 |
49 | 51 |
50 scoped_refptr<TransportSocketParams> CreateProxyHostParams() { | 52 scoped_refptr<TransportSocketParams> CreateProxyHostParams() { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 352 |
351 (*requests())[0]->handle()->Reset(); | 353 (*requests())[0]->handle()->Reset(); |
352 (*requests())[1]->handle()->Reset(); | 354 (*requests())[1]->handle()->Reset(); |
353 } | 355 } |
354 | 356 |
355 // It would be nice to also test the timeouts in SOCKSClientSocketPool. | 357 // It would be nice to also test the timeouts in SOCKSClientSocketPool. |
356 | 358 |
357 } // namespace | 359 } // namespace |
358 | 360 |
359 } // namespace net | 361 } // namespace net |
OLD | NEW |