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