| 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/basictypes.h" |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 9 #include "net/dns/dns_protocol.h" | 10 #include "net/dns/dns_protocol.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 12 |
| 12 namespace net { | 13 namespace net { |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 TEST(DnsConfigServiceWinTest, ParseSearchList) { | 17 TEST(DnsConfigServiceWinTest, ParseSearchList) { |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 CreateAdapterAddresses(infos), | 414 CreateAdapterAddresses(infos), |
| 414 { false }, { false }, { false }, { false }, | 415 { false }, { false }, { false }, { false }, |
| 415 { { false }, { false } }, | 416 { { false }, { false } }, |
| 416 { { false }, { false } }, | 417 { { false }, { false } }, |
| 417 { { false }, { false } }, | 418 { { false }, { false } }, |
| 418 t.input, | 419 t.input, |
| 419 }; | 420 }; |
| 420 DnsConfig config; | 421 DnsConfig config; |
| 421 EXPECT_EQ(internal::CONFIG_PARSE_WIN_OK, | 422 EXPECT_EQ(internal::CONFIG_PARSE_WIN_OK, |
| 422 internal::ConvertSettingsToDnsConfig(settings, &config)); | 423 internal::ConvertSettingsToDnsConfig(settings, &config)); |
| 423 EXPECT_EQ(config.append_to_multi_label_name, t.expected_output); | 424 EXPECT_EQ(t.expected_output, config.append_to_multi_label_name); |
| 424 } | 425 } |
| 425 } | 426 } |
| 426 | 427 |
| 428 // Setting have_name_resolution_policy_table should set unhandled_options. |
| 429 TEST(DnsConfigServiceWinTest, HaveNRPT) { |
| 430 AdapterInfo infos[2] = { |
| 431 { IF_TYPE_USB, IfOperStatusUp, L"connection.suffix", { "1.0.0.1" } }, |
| 432 { 0 }, |
| 433 }; |
| 434 |
| 435 const struct TestCase { |
| 436 bool have_nrpt; |
| 437 bool unhandled_options; |
| 438 internal::ConfigParseWinResult result; |
| 439 } cases[] = { |
| 440 { false, false, internal::CONFIG_PARSE_WIN_OK }, |
| 441 { true, true, internal::CONFIG_PARSE_WIN_UNHANDLED_OPTIONS }, |
| 442 }; |
| 443 |
| 444 for (size_t i = 0; i < arraysize(cases); ++i) { |
| 445 const TestCase& t = cases[i]; |
| 446 internal::DnsSystemSettings settings = { |
| 447 CreateAdapterAddresses(infos), |
| 448 { false }, { false }, { false }, { false }, |
| 449 { { false }, { false } }, |
| 450 { { false }, { false } }, |
| 451 { { false }, { false } }, |
| 452 { false }, |
| 453 t.have_nrpt, |
| 454 }; |
| 455 DnsConfig config; |
| 456 EXPECT_EQ(t.result, |
| 457 internal::ConvertSettingsToDnsConfig(settings, &config)); |
| 458 EXPECT_EQ(t.unhandled_options, config.unhandled_options); |
| 459 EXPECT_EQ(t.have_nrpt, config.use_local_ipv6); |
| 460 } |
| 461 } |
| 462 |
| 463 |
| 427 } // namespace | 464 } // namespace |
| 428 | 465 |
| 429 } // namespace net | 466 } // namespace net |
| 430 | 467 |
| OLD | NEW |