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

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

Issue 9721002: [net/dns] Removes locking from DnsConfigServiceWin and adds local computer name. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move lowercasing to ServeFromHosts, add test. Reorganize OnHostsRead. Created 8 years, 9 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
« no previous file with comments | « net/dns/dns_hosts.cc ('k') | net/dns/file_path_watcher_wrapper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_hosts.h" 5 #include "net/dns/dns_hosts.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 namespace { 11 namespace {
12 12
13 TEST(DnsHostsTest, ParseHosts) { 13 TEST(DnsHostsTest, ParseHosts) {
14 std::string contents = 14 std::string contents =
15 "127.0.0.1 localhost\tlocalhost.localdomain # standard\n" 15 "127.0.0.1 localhost\tlocalhost.localdomain # standard\n"
16 "\n" 16 "\n"
17 "1.0.0.1 localhost # ignored, first hit above\n" 17 "1.0.0.1 localhost # ignored, first hit above\n"
18 "fe00::x example company # ignored, malformed IPv6\n" 18 "fe00::x example company # ignored, malformed IPv6\n"
19 "1.0.0.300 company # ignored, malformed IPv4\n" 19 "1.0.0.300 company # ignored, malformed IPv4\n"
20 "1.0.0.1 # ignored, missing hostname\n" 20 "1.0.0.1 # ignored, missing hostname\n"
21 "1.0.0.1\t company \n" 21 "1.0.0.1\t CoMpANy # normalized to 'company' \n"
22 "::1\tlocalhost ip6-localhost ip6-loopback # comment # within a comment\n" 22 "::1\tlocalhost ip6-localhost ip6-loopback # comment # within a comment\n"
23 "\t fe00::0 ip6-localnet\r\n" 23 "\t fe00::0 ip6-localnet\r\n"
24 "2048::2 example\n" 24 "2048::2 example\n"
25 "2048::1 company example # ignored for 'example' \n" 25 "2048::1 company example # ignored for 'example' \n"
26 "gibberish"; 26 "gibberish";
27 27
28 const struct { 28 const struct {
29 const char* host; 29 const char* host;
30 AddressFamily family; 30 AddressFamily family;
31 const char* ip; 31 const char* ip;
(...skipping 20 matching lines...) Expand all
52 52
53 DnsHosts hosts; 53 DnsHosts hosts;
54 ParseHosts(contents, &hosts); 54 ParseHosts(contents, &hosts);
55 ASSERT_EQ(expected, hosts); 55 ASSERT_EQ(expected, hosts);
56 } 56 }
57 57
58 } // namespace 58 } // namespace
59 59
60 } // namespace net 60 } // namespace net
61 61
OLDNEW
« no previous file with comments | « net/dns/dns_hosts.cc ('k') | net/dns/file_path_watcher_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698