summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/dns_master_unittest.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-27 01:50:14 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-27 01:50:14 +0000
commit94a0d3d91b7200e66a4d23bb49b38cae7e74f7db (patch)
tree7f6b01af9e6e2a741dc4938d8e524be9f277aa3a /chrome/browser/net/dns_master_unittest.cc
parentafef5e483bc3782ecaf2572493442e0a2bd22bac (diff)
downloadchromium_src-94a0d3d91b7200e66a4d23bb49b38cae7e74f7db.zip
chromium_src-94a0d3d91b7200e66a4d23bb49b38cae7e74f7db.tar.gz
chromium_src-94a0d3d91b7200e66a4d23bb49b38cae7e74f7db.tar.bz2
Make net::HostResolver refcounted.
This way it can be properly shared between the url request contexts, and the dns prefetcher, and dns observer. BUG=http://crbug.com/14664 TEST=existing unit tests. Review URL: http://codereview.chromium.org/149053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/dns_master_unittest.cc')
-rw-r--r--chrome/browser/net/dns_master_unittest.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/net/dns_master_unittest.cc b/chrome/browser/net/dns_master_unittest.cc
index e056555..da720fe 100644
--- a/chrome/browser/net/dns_master_unittest.cc
+++ b/chrome/browser/net/dns_master_unittest.cc
@@ -82,7 +82,6 @@ class DnsMasterTest : public testing::Test {
MessageLoop::current()->Run();
}
- net::HostResolver host_resolver_;
scoped_refptr<net::RuleBasedHostMapper> mapper_;
private:
@@ -111,10 +110,10 @@ static std::string GetNonexistantDomain() {
TimeDelta BlockingDnsLookup(const std::string& hostname) {
Time start = Time::Now();
- net::HostResolver resolver;
+ scoped_refptr<net::HostResolver> resolver(new net::HostResolver);
net::AddressList addresses;
net::HostResolver::RequestInfo info(hostname, 80);
- resolver.Resolve(info, &addresses, NULL, NULL);
+ resolver->Resolve(info, &addresses, NULL, NULL);
return Time::Now() - start;
}
@@ -163,13 +162,13 @@ TEST_F(DnsMasterTest, OsCachesLookupsTest) {
}
TEST_F(DnsMasterTest, StartupShutdownTest) {
- scoped_refptr<DnsMaster> testing_master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
testing_master->Shutdown();
}
TEST_F(DnsMasterTest, BenefitLookupTest) {
- scoped_refptr<DnsMaster> testing_master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
std::string goog("www.google.com"),
@@ -232,7 +231,7 @@ TEST_F(DnsMasterTest, ShutdownWhenResolutionIsPendingTest) {
scoped_refptr<net::WaitingHostMapper> mapper = new net::WaitingHostMapper();
net::ScopedHostMapper scoped_mapper(mapper.get());
- scoped_refptr<DnsMaster> testing_master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
std::string localhost("127.0.0.1");
@@ -255,7 +254,7 @@ TEST_F(DnsMasterTest, ShutdownWhenResolutionIsPendingTest) {
}
TEST_F(DnsMasterTest, SingleLookupTest) {
- scoped_refptr<DnsMaster> testing_master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
std::string goog("www.google.com");
@@ -284,7 +283,7 @@ TEST_F(DnsMasterTest, SingleLookupTest) {
TEST_F(DnsMasterTest, ConcurrentLookupTest) {
mapper_->AddSimulatedFailure("*.notfound");
- scoped_refptr<DnsMaster> testing_master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
std::string goog("www.google.com"),
@@ -338,7 +337,7 @@ TEST_F(DnsMasterTest, ConcurrentLookupTest) {
TEST_F(DnsMasterTest, DISABLED_MassiveConcurrentLookupTest) {
mapper_->AddSimulatedFailure("*.notfound");
- scoped_refptr<DnsMaster> testing_master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
NameList names;
@@ -442,7 +441,7 @@ 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(&host_resolver_,
+ scoped_refptr<DnsMaster> master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
ListValue referral_list;
master->SerializeReferrers(&referral_list);
@@ -457,7 +456,7 @@ TEST_F(DnsMasterTest, ReferrerSerializationNilTest) {
// deserialized into the database, and can be extracted back out via
// serialization without being changed.
TEST_F(DnsMasterTest, ReferrerSerializationSingleReferrerTest) {
- scoped_refptr<DnsMaster> master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
std::string motivation_hostname = "www.google.com";
std::string subresource_hostname = "icons.google.com";
@@ -481,7 +480,7 @@ TEST_F(DnsMasterTest, ReferrerSerializationSingleReferrerTest) {
// Make sure the Trim() functionality works as expected.
TEST_F(DnsMasterTest, ReferrerSerializationTrimTest) {
- scoped_refptr<DnsMaster> master = new DnsMaster(&host_resolver_,
+ scoped_refptr<DnsMaster> master = new DnsMaster(new net::HostResolver,
MessageLoop::current(), DnsPrefetcherInit::kMaxConcurrentLookups);
std::string motivation_hostname = "www.google.com";
std::string icon_subresource_hostname = "icons.google.com";