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

Side by Side Diff: chrome/browser/net/dns_master_unittest.cc

Issue 118100: Avoid doing concurrent DNS resolves of the same hostname (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Get compiling on mac Created 11 years, 6 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) 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 #include <time.h> 5 #include <time.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 //------------------------------------------------------------------------------ 108 //------------------------------------------------------------------------------
109 // Use a blocking function to contrast results we get via async services. 109 // Use a blocking function to contrast results we get via async services.
110 //------------------------------------------------------------------------------ 110 //------------------------------------------------------------------------------
111 TimeDelta BlockingDnsLookup(const std::string& hostname) { 111 TimeDelta BlockingDnsLookup(const std::string& hostname) {
112 Time start = Time::Now(); 112 Time start = Time::Now();
113 113
114 net::HostResolver resolver; 114 net::HostResolver resolver;
115 net::AddressList addresses; 115 net::AddressList addresses;
116 resolver.Resolve(hostname, 80, &addresses, NULL); 116 resolver.Resolve(hostname, 80, &addresses, NULL, NULL);
117 117
118 return Time::Now() - start; 118 return Time::Now() - start;
119 } 119 }
120 120
121 //------------------------------------------------------------------------------ 121 //------------------------------------------------------------------------------
122 122
123 // First test to be sure the OS is caching lookups, which is the whole premise 123 // First test to be sure the OS is caching lookups, which is the whole premise
124 // of DNS prefetching. 124 // of DNS prefetching.
125 TEST_F(DnsMasterTest, OsCachesLookupsTest) { 125 TEST_F(DnsMasterTest, OsCachesLookupsTest) {
126 mapper_->AllowDirectLookup("*.google.com"); 126 mapper_->AllowDirectLookup("*.google.com");
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 EXPECT_EQ(queue.Pop(), "startup"); 608 EXPECT_EQ(queue.Pop(), "startup");
609 EXPECT_EQ(queue.Pop(), "omni"); 609 EXPECT_EQ(queue.Pop(), "omni");
610 610
611 EXPECT_TRUE(queue.IsEmpty()); 611 EXPECT_TRUE(queue.IsEmpty());
612 } 612 }
613 613
614 614
615 615
616 616
617 } // namespace chrome_browser_net 617 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698