diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 23:57:54 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 23:57:54 +0000 |
commit | 73c4532bd7f5b84bc822a4acca5c5b8affef4129 (patch) | |
tree | dc2a525aab1bda568b52ea78e72c8be79b9165dc /chrome/browser/net/predictor_unittest.cc | |
parent | 3209e71131849f3e0d513cd3fd8dca881f05d531 (diff) | |
download | chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.zip chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.tar.gz chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.tar.bz2 |
Stop refcounting HostResolver.
BUG=46049
TEST=none
Review URL: http://codereview.chromium.org/3601002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/predictor_unittest.cc')
-rw-r--r-- | chrome/browser/net/predictor_unittest.cc | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/chrome/browser/net/predictor_unittest.cc b/chrome/browser/net/predictor_unittest.cc index fd8bd9a..071c66f 100644 --- a/chrome/browser/net/predictor_unittest.cc +++ b/chrome/browser/net/predictor_unittest.cc @@ -99,7 +99,7 @@ class PredictorTest : public testing::Test { ChromeThread io_thread_; protected: - scoped_refptr<net::MockCachingHostResolver> host_resolver_; + scoped_ptr<net::MockCachingHostResolver> host_resolver_; // Shorthand to access TimeDelta of PredictorInit::kMaxQueueingDelayMs. // (It would be a static constant... except style rules preclude that :-/ ). @@ -109,10 +109,11 @@ class PredictorTest : public testing::Test { //------------------------------------------------------------------------------ TEST_F(PredictorTest, StartupShutdownTest) { - scoped_refptr<Predictor> testing_master = new Predictor(host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> testing_master = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); testing_master->Shutdown(); } @@ -122,10 +123,11 @@ TEST_F(PredictorTest, ShutdownWhenResolutionIsPendingTest) { new net::WaitingHostResolverProc(NULL); host_resolver_->Reset(resolver_proc); - scoped_refptr<Predictor> testing_master = new Predictor(host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> testing_master = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); GURL localhost("http://localhost:80"); UrlList names; @@ -147,10 +149,11 @@ TEST_F(PredictorTest, ShutdownWhenResolutionIsPendingTest) { } TEST_F(PredictorTest, SingleLookupTest) { - scoped_refptr<Predictor> testing_master = new Predictor(host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> testing_master = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); GURL goog("http://www.google.com:80"); @@ -178,10 +181,11 @@ TEST_F(PredictorTest, SingleLookupTest) { TEST_F(PredictorTest, ConcurrentLookupTest) { host_resolver_->rules()->AddSimulatedFailure("*.notfound"); - scoped_refptr<Predictor> testing_master = new Predictor(host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> testing_master = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); GURL goog("http://www.google.com:80"), goog2("http://gmail.google.com.com:80"), @@ -228,11 +232,11 @@ TEST_F(PredictorTest, ConcurrentLookupTest) { TEST_F(PredictorTest, MassiveConcurrentLookupTest) { host_resolver_->rules()->AddSimulatedFailure("*.notfound"); - scoped_refptr<Predictor> testing_master = new Predictor( - host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> testing_master = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); UrlList names; for (int i = 0; i < 100; i++) @@ -348,10 +352,11 @@ static bool GetDataFromSerialization(const GURL& motivation, // Make sure nil referral lists really have no entries, and no latency listed. TEST_F(PredictorTest, ReferrerSerializationNilTest) { - scoped_refptr<Predictor> predictor = new Predictor(host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> predictor = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); scoped_ptr<ListValue> referral_list(NewEmptySerializationList()); predictor->SerializeReferrers(referral_list.get()); EXPECT_EQ(1U, referral_list->GetSize()); @@ -366,10 +371,11 @@ TEST_F(PredictorTest, ReferrerSerializationNilTest) { // deserialized into the database, and can be extracted back out via // serialization without being changed. TEST_F(PredictorTest, ReferrerSerializationSingleReferrerTest) { - scoped_refptr<Predictor> predictor = new Predictor(host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> predictor = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); const GURL motivation_url("http://www.google.com:91"); const GURL subresource_url("http://icons.google.com:90"); const double kUseRate = 23.4; @@ -393,10 +399,11 @@ TEST_F(PredictorTest, ReferrerSerializationSingleReferrerTest) { // Make sure the Trim() functionality works as expected. TEST_F(PredictorTest, ReferrerSerializationTrimTest) { - scoped_refptr<Predictor> predictor = new Predictor(host_resolver_, - default_max_queueing_delay_, - PredictorInit::kMaxPrefetchConcurrentLookups, - false); + scoped_refptr<Predictor> predictor = + new Predictor(host_resolver_.get(), + default_max_queueing_delay_, + PredictorInit::kMaxPrefetchConcurrentLookups, + false); GURL motivation_url("http://www.google.com:110"); GURL icon_subresource_url("http://icons.google.com:111"); |