diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-27 14:35:44 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-27 14:35:44 +0000 |
commit | 602faf3ca5a9b1753d1f4f10639b134555d60352 (patch) | |
tree | 3533436e773b9648f1f9660f97cb14656f0f756c /chrome/browser/net/dns_master_unittest.cc | |
parent | a1e646a13a0041b19b9e55fef1d7d228835cde3d (diff) | |
download | chromium_src-602faf3ca5a9b1753d1f4f10639b134555d60352.zip chromium_src-602faf3ca5a9b1753d1f4f10639b134555d60352.tar.gz chromium_src-602faf3ca5a9b1753d1f4f10639b134555d60352.tar.bz2 |
Refactor DNS A/B experient, and add test of congestion time limits
I added another option in the DNS experiment: user 2 seconds or 500ms
for the congestion limit (that causes pre-resolutions to be discarded
from the queue.
The code in browser_main.cc was getting toooo large, so I pulled all
the experiment code into dns_global.cc.
BUG=15479
r=eroman
Review URL: http://codereview.chromium.org/147215
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19464 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 | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/chrome/browser/net/dns_master_unittest.cc b/chrome/browser/net/dns_master_unittest.cc index da720fe..921b43b 100644 --- a/chrome/browser/net/dns_master_unittest.cc +++ b/chrome/browser/net/dns_master_unittest.cc @@ -60,6 +60,8 @@ class DnsMasterTest : public testing::Test { public: DnsMasterTest() : mapper_(new net::RuleBasedHostMapper()), + default_max_queueing_delay_(TimeDelta::FromMilliseconds( + DnsPrefetcherInit::kMaxQueueingDelayMs)), scoped_mapper_(mapper_.get()) { } @@ -84,6 +86,10 @@ class DnsMasterTest : public testing::Test { scoped_refptr<net::RuleBasedHostMapper> mapper_; + // Shorthand to access TimeDelta of DnsPrefetcherInit::kMaxQueueingDelayMs. + // (It would be a static constant... except style rules preclude that :-/ ). + const TimeDelta default_max_queueing_delay_; + private: MessageLoop loop; net::ScopedHostMapper scoped_mapper_; @@ -163,13 +169,15 @@ TEST_F(DnsMasterTest, OsCachesLookupsTest) { TEST_F(DnsMasterTest, StartupShutdownTest) { scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); testing_master->Shutdown(); } TEST_F(DnsMasterTest, BenefitLookupTest) { scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); std::string goog("www.google.com"), goog2("gmail.google.com.com"), @@ -232,7 +240,8 @@ TEST_F(DnsMasterTest, ShutdownWhenResolutionIsPendingTest) { net::ScopedHostMapper scoped_mapper(mapper.get()); scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); std::string localhost("127.0.0.1"); NameList names; @@ -255,7 +264,8 @@ TEST_F(DnsMasterTest, ShutdownWhenResolutionIsPendingTest) { TEST_F(DnsMasterTest, SingleLookupTest) { scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); std::string goog("www.google.com"); @@ -284,7 +294,8 @@ TEST_F(DnsMasterTest, ConcurrentLookupTest) { mapper_->AddSimulatedFailure("*.notfound"); scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); std::string goog("www.google.com"), goog2("gmail.google.com.com"), @@ -338,7 +349,8 @@ TEST_F(DnsMasterTest, DISABLED_MassiveConcurrentLookupTest) { mapper_->AddSimulatedFailure("*.notfound"); scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); NameList names; for (int i = 0; i < 100; i++) @@ -442,7 +454,8 @@ int GetLatencyFromSerialization(const std::string& motivation, // Make sure nil referral lists really have no entries, and no latency listed. TEST_F(DnsMasterTest, ReferrerSerializationNilTest) { scoped_refptr<DnsMaster> master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); ListValue referral_list; master->SerializeReferrers(&referral_list); EXPECT_EQ(0U, referral_list.GetSize()); @@ -457,7 +470,8 @@ TEST_F(DnsMasterTest, ReferrerSerializationNilTest) { // serialization without being changed. TEST_F(DnsMasterTest, ReferrerSerializationSingleReferrerTest) { scoped_refptr<DnsMaster> master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); std::string motivation_hostname = "www.google.com"; std::string subresource_hostname = "icons.google.com"; const int kLatency = 3; @@ -481,7 +495,8 @@ TEST_F(DnsMasterTest, ReferrerSerializationSingleReferrerTest) { // Make sure the Trim() functionality works as expected. TEST_F(DnsMasterTest, ReferrerSerializationTrimTest) { scoped_refptr<DnsMaster> master = new DnsMaster(new net::HostResolver, - MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups); + MessageLoop::current(), default_max_queueing_delay_, + DnsPrefetcherInit::kMaxConcurrentLookups); std::string motivation_hostname = "www.google.com"; std::string icon_subresource_hostname = "icons.google.com"; std::string img_subresource_hostname = "img.google.com"; |