| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 address = adapter->FirstDnsServerAddress = addresses + num_addresses; | 97 address = adapter->FirstDnsServerAddress = addresses + num_addresses; |
| 98 } else { | 98 } else { |
| 99 // Note that |address| is moving backwards. | 99 // Note that |address| is moving backwards. |
| 100 address = address->Next = address - 1; | 100 address = address->Next = address - 1; |
| 101 } | 101 } |
| 102 IPAddressNumber ip; | 102 IPAddressNumber ip; |
| 103 CHECK(ParseIPLiteralToNumber(info.dns_server_addresses[j], &ip)); | 103 CHECK(ParseIPLiteralToNumber(info.dns_server_addresses[j], &ip)); |
| 104 IPEndPoint ipe(ip, info.ports[j]); | 104 IPEndPoint ipe(ip, info.ports[j]); |
| 105 address->Address.lpSockaddr = | 105 address->Address.lpSockaddr = |
| 106 reinterpret_cast<LPSOCKADDR>(storage + num_addresses); | 106 reinterpret_cast<LPSOCKADDR>(storage + num_addresses); |
| 107 size_t length = sizeof(struct sockaddr_storage); | 107 socklen_t length = sizeof(struct sockaddr_storage); |
| 108 CHECK(ipe.ToSockAddr(address->Address.lpSockaddr, &length)); | 108 CHECK(ipe.ToSockAddr(address->Address.lpSockaddr, &length)); |
| 109 address->Address.iSockaddrLength = static_cast<int>(length); | 109 address->Address.iSockaddrLength = static_cast<int>(length); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 return heap.Pass(); | 113 return heap.Pass(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 TEST(DnsConfigServiceWinTest, ConvertAdapterAddresses) { | 116 TEST(DnsConfigServiceWinTest, ConvertAdapterAddresses) { |
| 117 // Check nameservers and connection-specific suffix. | 117 // Check nameservers and connection-specific suffix. |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 DnsConfig config; | 416 DnsConfig config; |
| 417 ASSERT_TRUE(internal::ConvertSettingsToDnsConfig(settings, &config)); | 417 ASSERT_TRUE(internal::ConvertSettingsToDnsConfig(settings, &config)); |
| 418 EXPECT_EQ(config.append_to_multi_label_name, t.expected_output); | 418 EXPECT_EQ(config.append_to_multi_label_name, t.expected_output); |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace | 422 } // namespace |
| 423 | 423 |
| 424 } // namespace net | 424 } // namespace net |
| 425 | 425 |
| OLD | NEW |