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/dns/address_sorter_posix.h" | 5 #include "net/dns/address_sorter_posix.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
12 #include "net/socket/client_socket_factory.h" | 12 #include "net/socket/client_socket_factory.h" |
13 #include "net/socket/ssl_client_socket.h" | 13 #include "net/socket/ssl_client_socket.h" |
14 #include "net/socket/stream_socket.h" | 14 #include "net/socket/stream_socket.h" |
15 #include "net/udp/datagram_client_socket.h" | 15 #include "net/udp/datagram_client_socket.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
| 19 |
| 20 class SocketPerformanceWatcherFactory; |
| 21 |
19 namespace { | 22 namespace { |
20 | 23 |
21 // Used to map destination address to source address. | 24 // Used to map destination address to source address. |
22 typedef std::map<IPAddressNumber, IPAddressNumber> AddressMapping; | 25 typedef std::map<IPAddressNumber, IPAddressNumber> AddressMapping; |
23 | 26 |
24 IPAddressNumber ParseIP(const std::string& str) { | 27 IPAddressNumber ParseIP(const std::string& str) { |
25 IPAddressNumber addr; | 28 IPAddressNumber addr; |
26 CHECK(ParseIPLiteralToNumber(str, &addr)); | 29 CHECK(ParseIPLiteralToNumber(str, &addr)); |
27 return addr; | 30 return addr; |
28 } | 31 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 103 |
101 scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket( | 104 scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
102 DatagramSocket::BindType, | 105 DatagramSocket::BindType, |
103 const RandIntCallback&, | 106 const RandIntCallback&, |
104 NetLog*, | 107 NetLog*, |
105 const NetLog::Source&) override { | 108 const NetLog::Source&) override { |
106 return scoped_ptr<DatagramClientSocket>(new TestUDPClientSocket(&mapping_)); | 109 return scoped_ptr<DatagramClientSocket>(new TestUDPClientSocket(&mapping_)); |
107 } | 110 } |
108 scoped_ptr<StreamSocket> CreateTransportClientSocket( | 111 scoped_ptr<StreamSocket> CreateTransportClientSocket( |
109 const AddressList&, | 112 const AddressList&, |
| 113 SocketPerformanceWatcherFactory*, |
110 NetLog*, | 114 NetLog*, |
111 const NetLog::Source&) override { | 115 const NetLog::Source&) override { |
112 NOTIMPLEMENTED(); | 116 NOTIMPLEMENTED(); |
113 return scoped_ptr<StreamSocket>(); | 117 return scoped_ptr<StreamSocket>(); |
114 } | 118 } |
115 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( | 119 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( |
116 scoped_ptr<ClientSocketHandle>, | 120 scoped_ptr<ClientSocketHandle>, |
117 const HostPortPair&, | 121 const HostPortPair&, |
118 const SSLConfig&, | 122 const SSLConfig&, |
119 const SSLClientSocketContext&) override { | 123 const SSLClientSocketContext&) override { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 AddMapping("4000::1", "4000::10"); // global unicast | 326 AddMapping("4000::1", "4000::10"); // global unicast |
323 AddMapping("ff32::2", "fe81::20"); // deprecated link-local multicast | 327 AddMapping("ff32::2", "fe81::20"); // deprecated link-local multicast |
324 GetSourceInfo("fe81::20")->deprecated = true; | 328 GetSourceInfo("fe81::20")->deprecated = true; |
325 const char* const addresses[] = { "ff3e::1", "ff32::2", "4000::1", "ff32::1", | 329 const char* const addresses[] = { "ff3e::1", "ff32::2", "4000::1", "ff32::1", |
326 "::1", "8.0.0.1", NULL }; | 330 "::1", "8.0.0.1", NULL }; |
327 const int order[] = { 4, 3, 0, 2, 1, -1 }; | 331 const int order[] = { 4, 3, 0, 2, 1, -1 }; |
328 Verify(addresses, order); | 332 Verify(addresses, order); |
329 } | 333 } |
330 | 334 |
331 } // namespace net | 335 } // namespace net |
OLD | NEW |