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

Side by Side Diff: chrome/test/unit/chrome_test_suite.h

Issue 1629005: Revert 43826 - HostResolver now adds AI_CANONNAME to the hint flags if a requ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 8 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
« no previous file with comments | « chrome/browser/net/view_net_internals_job_factory.cc ('k') | net/base/address_family.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_TEST_UNIT_CHROME_TEST_SUITE_H_ 5 #ifndef CHROME_TEST_UNIT_CHROME_TEST_SUITE_H_
6 #define CHROME_TEST_UNIT_CHROME_TEST_SUITE_H_ 6 #define CHROME_TEST_UNIT_CHROME_TEST_SUITE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 // In many cases it may be not obvious that a test makes a real DNS lookup. 53 // In many cases it may be not obvious that a test makes a real DNS lookup.
54 // We generally don't want to rely on external DNS servers for our tests, 54 // We generally don't want to rely on external DNS servers for our tests,
55 // so this host resolver procedure catches external queries. 55 // so this host resolver procedure catches external queries.
56 class WarningHostResolverProc : public net::HostResolverProc { 56 class WarningHostResolverProc : public net::HostResolverProc {
57 public: 57 public:
58 WarningHostResolverProc() : HostResolverProc(NULL) {} 58 WarningHostResolverProc() : HostResolverProc(NULL) {}
59 59
60 virtual int Resolve(const std::string& host, 60 virtual int Resolve(const std::string& host,
61 net::AddressFamily address_family, 61 net::AddressFamily address_family,
62 net::HostResolverFlags host_resolver_flags,
63 net::AddressList* addrlist) { 62 net::AddressList* addrlist) {
64 const char* kLocalHostNames[] = {"localhost", "127.0.0.1"}; 63 const char* kLocalHostNames[] = {"localhost", "127.0.0.1"};
65 bool local = false; 64 bool local = false;
66 65
67 if (host == net::GetHostName()) { 66 if (host == net::GetHostName()) {
68 local = true; 67 local = true;
69 } else { 68 } else {
70 for (size_t i = 0; i < arraysize(kLocalHostNames); i++) 69 for (size_t i = 0; i < arraysize(kLocalHostNames); i++)
71 if (host == kLocalHostNames[i]) { 70 if (host == kLocalHostNames[i]) {
72 local = true; 71 local = true;
73 break; 72 break;
74 } 73 }
75 } 74 }
76 75
77 // Make the test fail so it's harder to ignore. 76 // Make the test fail so it's harder to ignore.
78 // If you really need to make real DNS query, use 77 // If you really need to make real DNS query, use
79 // net::RuleBasedHostResolverProc and its AllowDirectLookup method. 78 // net::RuleBasedHostResolverProc and its AllowDirectLookup method.
80 EXPECT_TRUE(local) << "Making external DNS lookup of " << host; 79 EXPECT_TRUE(local) << "Making external DNS lookup of " << host;
81 80
82 return ResolveUsingPrevious(host, address_family, host_resolver_flags, 81 return ResolveUsingPrevious(host, address_family, addrlist);
83 addrlist);
84 } 82 }
85 }; 83 };
86 84
87 class ChromeTestSuite : public TestSuite { 85 class ChromeTestSuite : public TestSuite {
88 public: 86 public:
89 ChromeTestSuite(int argc, char** argv) 87 ChromeTestSuite(int argc, char** argv)
90 : TestSuite(argc, argv), 88 : TestSuite(argc, argv),
91 stats_table_(NULL) { 89 stats_table_(NULL) {
92 } 90 }
93 91
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 182
185 // Alternative path to browser binaries. 183 // Alternative path to browser binaries.
186 FilePath browser_dir_; 184 FilePath browser_dir_;
187 185
188 ScopedOleInitializer ole_initializer_; 186 ScopedOleInitializer ole_initializer_;
189 scoped_refptr<WarningHostResolverProc> host_resolver_proc_; 187 scoped_refptr<WarningHostResolverProc> host_resolver_proc_;
190 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; 188 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_;
191 }; 189 };
192 190
193 #endif // CHROME_TEST_UNIT_CHROME_TEST_SUITE_H_ 191 #endif // CHROME_TEST_UNIT_CHROME_TEST_SUITE_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/view_net_internals_job_factory.cc ('k') | net/base/address_family.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698