| 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/ip_address.h" | 10 #include "net/base/ip_address.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/base/test_completion_callback.h" | 12 #include "net/base/test_completion_callback.h" |
| 13 #include "net/log/net_log_with_source.h" |
| 13 #include "net/socket/client_socket_factory.h" | 14 #include "net/socket/client_socket_factory.h" |
| 14 #include "net/socket/socket_performance_watcher.h" | 15 #include "net/socket/socket_performance_watcher.h" |
| 15 #include "net/socket/ssl_client_socket.h" | 16 #include "net/socket/ssl_client_socket.h" |
| 16 #include "net/socket/stream_socket.h" | 17 #include "net/socket/stream_socket.h" |
| 17 #include "net/udp/datagram_client_socket.h" | 18 #include "net/udp/datagram_client_socket.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Creates TestUDPClientSockets and maintains an AddressMapping. | 100 // Creates TestUDPClientSockets and maintains an AddressMapping. |
| 100 class TestSocketFactory : public ClientSocketFactory { | 101 class TestSocketFactory : public ClientSocketFactory { |
| 101 public: | 102 public: |
| 102 TestSocketFactory() {} | 103 TestSocketFactory() {} |
| 103 ~TestSocketFactory() override {} | 104 ~TestSocketFactory() override {} |
| 104 | 105 |
| 105 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( | 106 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
| 106 DatagramSocket::BindType, | 107 DatagramSocket::BindType, |
| 107 const RandIntCallback&, | 108 const RandIntCallback&, |
| 108 NetLog*, | 109 NetLog*, |
| 109 const NetLog::Source&) override { | 110 const NetLogSource&) override { |
| 110 return std::unique_ptr<DatagramClientSocket>( | 111 return std::unique_ptr<DatagramClientSocket>( |
| 111 new TestUDPClientSocket(&mapping_)); | 112 new TestUDPClientSocket(&mapping_)); |
| 112 } | 113 } |
| 113 std::unique_ptr<StreamSocket> CreateTransportClientSocket( | 114 std::unique_ptr<StreamSocket> CreateTransportClientSocket( |
| 114 const AddressList&, | 115 const AddressList&, |
| 115 std::unique_ptr<SocketPerformanceWatcher>, | 116 std::unique_ptr<SocketPerformanceWatcher>, |
| 116 NetLog*, | 117 NetLog*, |
| 117 const NetLog::Source&) override { | 118 const NetLogSource&) override { |
| 118 NOTIMPLEMENTED(); | 119 NOTIMPLEMENTED(); |
| 119 return std::unique_ptr<StreamSocket>(); | 120 return std::unique_ptr<StreamSocket>(); |
| 120 } | 121 } |
| 121 std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( | 122 std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( |
| 122 std::unique_ptr<ClientSocketHandle>, | 123 std::unique_ptr<ClientSocketHandle>, |
| 123 const HostPortPair&, | 124 const HostPortPair&, |
| 124 const SSLConfig&, | 125 const SSLConfig&, |
| 125 const SSLClientSocketContext&) override { | 126 const SSLClientSocketContext&) override { |
| 126 NOTIMPLEMENTED(); | 127 NOTIMPLEMENTED(); |
| 127 return std::unique_ptr<SSLClientSocket>(); | 128 return std::unique_ptr<SSLClientSocket>(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 AddMapping("4000::1", "4000::10"); // global unicast | 329 AddMapping("4000::1", "4000::10"); // global unicast |
| 329 AddMapping("ff32::2", "fe81::20"); // deprecated link-local multicast | 330 AddMapping("ff32::2", "fe81::20"); // deprecated link-local multicast |
| 330 GetSourceInfo("fe81::20")->deprecated = true; | 331 GetSourceInfo("fe81::20")->deprecated = true; |
| 331 const char* const addresses[] = { "ff3e::1", "ff32::2", "4000::1", "ff32::1", | 332 const char* const addresses[] = { "ff3e::1", "ff32::2", "4000::1", "ff32::1", |
| 332 "::1", "8.0.0.1", NULL }; | 333 "::1", "8.0.0.1", NULL }; |
| 333 const int order[] = { 4, 3, 0, 2, 1, -1 }; | 334 const int order[] = { 4, 3, 0, 2, 1, -1 }; |
| 334 Verify(addresses, order); | 335 Verify(addresses, order); |
| 335 } | 336 } |
| 336 | 337 |
| 337 } // namespace net | 338 } // namespace net |
| OLD | NEW |