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