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

Unified Diff: chrome/browser/net/dns_master_unittest.cc

Issue 147215: Refactor DNS A/B experient, and add test of congestion time limits... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/dns_master.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/dns_master_unittest.cc
===================================================================
--- chrome/browser/net/dns_master_unittest.cc (revision 19463)
+++ chrome/browser/net/dns_master_unittest.cc (working copy)
@@ -60,6 +60,8 @@
public:
DnsMasterTest()
: mapper_(new net::RuleBasedHostMapper()),
+ default_max_queueing_delay_(TimeDelta::FromMilliseconds(
+ DnsPrefetcherInit::kMaxQueueingDelayMs)),
scoped_mapper_(mapper_.get()) {
}
@@ -84,6 +86,10 @@
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, 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 @@
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, 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 @@
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 @@
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 @@
// 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 @@
// 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 @@
// 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";
« no previous file with comments | « chrome/browser/net/dns_master.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698