diff options
author | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 23:32:53 +0000 |
---|---|---|
committer | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 23:32:53 +0000 |
commit | 21dae9b9628a3a7ef481c1871d69e9b48ed90158 (patch) | |
tree | da091a8ff8222d6bfbde888972752d289644b4f7 /chrome/browser/net/dns_master_unittest.cc | |
parent | a2633667fc8bf1429fe33f5dd89b550e484a03c9 (diff) | |
download | chromium_src-21dae9b9628a3a7ef481c1871d69e9b48ed90158.zip chromium_src-21dae9b9628a3a7ef481c1871d69e9b48ed90158.tar.gz chromium_src-21dae9b9628a3a7ef481c1871d69e9b48ed90158.tar.bz2 |
Adaptively identify URL subresources and pre-resolve hosts via DNS
Use the HTTP "referer" header to identify subresources used during a
page load. Store that info, and use it when next visiting the referenced
hosts to pre-resolve the (probably) needed subresources.
This set of changes will surely evolve as we see how it plays out
on broader distribution (via histogram measurments), but this should be
the foundation of the change.
In design specs, this was previously referred to as "adaptive correlated
DNS prefetching."
r=mbelshe
Review URL: http://codereview.chromium.org/9168
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4929 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/dns_master_unittest.cc')
-rw-r--r-- | chrome/browser/net/dns_master_unittest.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/chrome/browser/net/dns_master_unittest.cc b/chrome/browser/net/dns_master_unittest.cc index c843b36..228c764 100644 --- a/chrome/browser/net/dns_master_unittest.cc +++ b/chrome/browser/net/dns_master_unittest.cc @@ -197,7 +197,7 @@ TEST(DnsMasterTest, BenefitLookupTest) { // First only cause a minimal set of threads to start up. // Currently we actually start 4 threads when we get called with an array - testing_master.ResolveList(names); + testing_master.ResolveList(names, DnsHostInfo::PAGE_SCAN_MOTIVATED); // Wait for some resoultion for each google. SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(0 <= @@ -223,16 +223,16 @@ TEST(DnsMasterTest, BenefitLookupTest) { // Simulate actual navigation, and acrue the benefit for "helping" the DNS // part of the navigation. - EXPECT_TRUE(testing_master.AcruePrefetchBenefits(&goog_info)); - EXPECT_TRUE(testing_master.AcruePrefetchBenefits(&goog2_info)); - EXPECT_TRUE(testing_master.AcruePrefetchBenefits(&goog3_info)); - EXPECT_TRUE(testing_master.AcruePrefetchBenefits(&goog4_info)); + EXPECT_TRUE(testing_master.AccruePrefetchBenefits(GURL(), &goog_info)); + EXPECT_TRUE(testing_master.AccruePrefetchBenefits(GURL(), &goog2_info)); + EXPECT_TRUE(testing_master.AccruePrefetchBenefits(GURL(), &goog3_info)); + EXPECT_TRUE(testing_master.AccruePrefetchBenefits(GURL(), &goog4_info)); // Benefits can ONLY be reported once (for the first navigation). - EXPECT_FALSE(testing_master.AcruePrefetchBenefits(&goog_info)); - EXPECT_FALSE(testing_master.AcruePrefetchBenefits(&goog2_info)); - EXPECT_FALSE(testing_master.AcruePrefetchBenefits(&goog3_info)); - EXPECT_FALSE(testing_master.AcruePrefetchBenefits(&goog4_info)); + EXPECT_FALSE(testing_master.AccruePrefetchBenefits(GURL(), &goog_info)); + EXPECT_FALSE(testing_master.AccruePrefetchBenefits(GURL(), &goog2_info)); + EXPECT_FALSE(testing_master.AccruePrefetchBenefits(GURL(), &goog3_info)); + EXPECT_FALSE(testing_master.AccruePrefetchBenefits(GURL(), &goog4_info)); // Ensure a clean shutdown. EXPECT_TRUE(testing_master.ShutdownSlaves()); @@ -260,7 +260,7 @@ TEST(DnsMasterTest, DISABLED_SingleSlaveLookupTest) { names.insert(names.end(), bad2); // First only cause a single thread to start up - testing_master.ResolveList(names); + testing_master.ResolveList(names, DnsHostInfo::PAGE_SCAN_MOTIVATED); // Wait for some resoultion for google. SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(0 <= @@ -320,7 +320,7 @@ TEST(DnsMasterTest, DISABLED_MultiThreadedLookupTest) { // Get all 8 threads running by calling many times before queue is handled. for (int i = 0; i < 10; i++) { - testing_master.ResolveList(names); + testing_master.ResolveList(names, DnsHostInfo::PAGE_SCAN_MOTIVATED); } Sleep(10); // Allow time for async DNS to get answers. @@ -363,7 +363,7 @@ TEST(DnsMasterTest, DISABLED_MultiThreadedSpeedupTest) { names.insert(names.end(), goog4); // First cause a lookup using a single thread. - testing_master.ResolveList(names); + testing_master.ResolveList(names, DnsHostInfo::PAGE_SCAN_MOTIVATED); // Wait for some resoultion for google. SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(0 <= @@ -383,7 +383,8 @@ TEST(DnsMasterTest, DISABLED_MultiThreadedSpeedupTest) { // Get all 8 threads running by calling many times before queue is handled. names.clear(); for (int i = 0; i < 10; i++) - testing_master.Resolve(GetNonexistantDomain()); + testing_master.Resolve(GetNonexistantDomain(), + DnsHostInfo::PAGE_SCAN_MOTIVATED); // Wait long enough for all the goog's to be resolved. // They should all take about the same time, and run in parallel. |