| OLD | NEW |
| 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 Loading... |
| 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, NULL); | 116 net::HostResolver::RequestInfo info(hostname, 80); |
| 117 resolver.Resolve(info, &addresses, NULL, NULL); |
| 117 | 118 |
| 118 return Time::Now() - start; | 119 return Time::Now() - start; |
| 119 } | 120 } |
| 120 | 121 |
| 121 //------------------------------------------------------------------------------ | 122 //------------------------------------------------------------------------------ |
| 122 | 123 |
| 123 // First test to be sure the OS is caching lookups, which is the whole premise | 124 // First test to be sure the OS is caching lookups, which is the whole premise |
| 124 // of DNS prefetching. | 125 // of DNS prefetching. |
| 125 TEST_F(DnsMasterTest, OsCachesLookupsTest) { | 126 TEST_F(DnsMasterTest, OsCachesLookupsTest) { |
| 126 mapper_->AllowDirectLookup("*.google.com"); | 127 mapper_->AllowDirectLookup("*.google.com"); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 EXPECT_EQ(queue.Pop(), "startup"); | 609 EXPECT_EQ(queue.Pop(), "startup"); |
| 609 EXPECT_EQ(queue.Pop(), "omni"); | 610 EXPECT_EQ(queue.Pop(), "omni"); |
| 610 | 611 |
| 611 EXPECT_TRUE(queue.IsEmpty()); | 612 EXPECT_TRUE(queue.IsEmpty()); |
| 612 } | 613 } |
| 613 | 614 |
| 614 | 615 |
| 615 | 616 |
| 616 | 617 |
| 617 } // namespace chrome_browser_net | 618 } // namespace chrome_browser_net |
| OLD | NEW |