Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: net/dns/dns_config_service_win_unittest.cc

Issue 23522036: [net/dns] Treat Name Resolution Policy Table as unhandled option. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove histograms.xml until a later cl Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
mmenke 2013/09/16 16:34:46 Think we should be including basictypes.h for arra
szym 2013/09/16 19:17:35 Done.
11 11
12 namespace net { 12 namespace net {
13 13
14 namespace { 14 namespace {
15 15
16 TEST(DnsConfigServiceWinTest, ParseSearchList) { 16 TEST(DnsConfigServiceWinTest, ParseSearchList) {
17 const struct TestCase { 17 const struct TestCase {
18 const wchar_t* input; 18 const wchar_t* input;
19 const char* output[4]; // NULL-terminated, empty if expected false 19 const char* output[4]; // NULL-terminated, empty if expected false
20 } cases[] = { 20 } cases[] = {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 CreateAdapterAddresses(infos), 413 CreateAdapterAddresses(infos),
414 { false }, { false }, { false }, { false }, 414 { false }, { false }, { false }, { false },
415 { { false }, { false } }, 415 { { false }, { false } },
416 { { false }, { false } }, 416 { { false }, { false } },
417 { { false }, { false } }, 417 { { false }, { false } },
418 t.input, 418 t.input,
419 }; 419 };
420 DnsConfig config; 420 DnsConfig config;
421 EXPECT_EQ(internal::CONFIG_PARSE_WIN_OK, 421 EXPECT_EQ(internal::CONFIG_PARSE_WIN_OK,
422 internal::ConvertSettingsToDnsConfig(settings, &config)); 422 internal::ConvertSettingsToDnsConfig(settings, &config));
423 EXPECT_EQ(config.append_to_multi_label_name, t.expected_output); 423 EXPECT_EQ(t.expected_output, config.append_to_multi_label_name);
424 } 424 }
425 } 425 }
426 426
427 // Setting have_name_resolution_policy_table should set unhandled_options.
428 TEST(DnsConfigServiceWinTest, HaveNRPT) {
429 AdapterInfo infos[2] = {
430 { IF_TYPE_USB, IfOperStatusUp, L"connection.suffix", { "1.0.0.1" } },
431 { 0 },
432 };
433
434 const struct TestCase {
435 bool have_nrpt;
436 bool unhandled_options;
437 internal::ConfigParseWinResult result;
438 } cases[] = {
439 { false, false, internal::CONFIG_PARSE_WIN_OK },
440 { true, true, internal::CONFIG_PARSE_WIN_UNHANDLED_OPTIONS },
441 };
442
443 for (size_t i = 0; i < arraysize(cases); ++i) {
444 const TestCase& t = cases[i];
445 internal::DnsSystemSettings settings = {
446 CreateAdapterAddresses(infos),
447 { false }, { false }, { false }, { false },
448 { { false }, { false } },
449 { { false }, { false } },
450 { { false }, { false } },
451 { false },
452 t.have_nrpt,
453 };
454 DnsConfig config;
455 EXPECT_EQ(t.result,
456 internal::ConvertSettingsToDnsConfig(settings, &config));
457 EXPECT_EQ(t.unhandled_options, config.unhandled_options);
458 EXPECT_EQ(t.have_nrpt, config.use_local_ipv6);
459 }
460 }
461
462
427 } // namespace 463 } // namespace
428 464
429 } // namespace net 465 } // namespace net
430 466
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698