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/dns_config_service_win.h" | 5 #include "net/dns/dns_config_service_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
9 #include "net/dns/dns_protocol.h" | 9 #include "net/dns/dns_protocol.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 CHECK(ParseIPLiteralToNumber(info.dns_server_addresses[j], &ip)); | 100 CHECK(ParseIPLiteralToNumber(info.dns_server_addresses[j], &ip)); |
101 IPEndPoint ipe = IPEndPoint(ip, info.ports[j]); | 101 IPEndPoint ipe = IPEndPoint(ip, info.ports[j]); |
102 address->Address.lpSockaddr = | 102 address->Address.lpSockaddr = |
103 reinterpret_cast<LPSOCKADDR>(storage + num_addresses); | 103 reinterpret_cast<LPSOCKADDR>(storage + num_addresses); |
104 socklen_t length = sizeof(struct sockaddr_storage); | 104 socklen_t length = sizeof(struct sockaddr_storage); |
105 CHECK(ipe.ToSockAddr(address->Address.lpSockaddr, &length)); | 105 CHECK(ipe.ToSockAddr(address->Address.lpSockaddr, &length)); |
106 address->Address.iSockaddrLength = static_cast<int>(length); | 106 address->Address.iSockaddrLength = static_cast<int>(length); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 return heap.Pass(); | 110 return heap; |
111 } | 111 } |
112 | 112 |
113 TEST(DnsConfigServiceWinTest, ConvertAdapterAddresses) { | 113 TEST(DnsConfigServiceWinTest, ConvertAdapterAddresses) { |
114 // Check nameservers and connection-specific suffix. | 114 // Check nameservers and connection-specific suffix. |
115 const struct TestCase { | 115 const struct TestCase { |
116 AdapterInfo input_adapters[4]; // |if_type| == 0 indicates end. | 116 AdapterInfo input_adapters[4]; // |if_type| == 0 indicates end. |
117 std::string expected_nameservers[4]; // Empty string indicates end. | 117 std::string expected_nameservers[4]; // Empty string indicates end. |
118 std::string expected_suffix; | 118 std::string expected_suffix; |
119 uint16_t expected_ports[4]; | 119 uint16_t expected_ports[4]; |
120 } cases[] = { | 120 } cases[] = { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 EXPECT_EQ(t.unhandled_options, config.unhandled_options); | 442 EXPECT_EQ(t.unhandled_options, config.unhandled_options); |
443 EXPECT_EQ(t.have_nrpt, config.use_local_ipv6); | 443 EXPECT_EQ(t.have_nrpt, config.use_local_ipv6); |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 | 447 |
448 } // namespace | 448 } // namespace |
449 | 449 |
450 } // namespace net | 450 } // namespace net |
451 | 451 |
OLD | NEW |