From d0d6ab3c7a45d92598cce0a78ad91ddf364886c2 Mon Sep 17 00:00:00 2001 From: "tedv@chromium.org" Date: Thu, 29 Nov 2012 14:49:12 +0000 Subject: Update webkit unit test initialization of URLRequestJobFactory objects. The associated CR involves moving mutation interfaces of URLRequestJobFactory to URLRequestJobFactory. As such, their initializations need to maintain their type as URLRequestJobFactoryImpl before those interfaces can be removed. See CL https://codereview.chromium.org/11227017 for more information. BUG=146602 Review URL: https://chromiumcodereview.appspot.com/11280202 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170182 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/appcache/appcache_update_job_unittest.cc | 41 ++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'webkit/appcache/appcache_update_job_unittest.cc') diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 3eaed05..6873569 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -561,9 +561,11 @@ class IOThread : public base::Thread { } virtual void Init() { - job_factory_.reset(new net::URLRequestJobFactoryImpl); - job_factory_->SetProtocolHandler("http", new MockHttpServerJobFactory); - job_factory_->SetProtocolHandler("https", new MockHttpServerJobFactory); + scoped_ptr factory( + new net::URLRequestJobFactoryImpl()); + factory->SetProtocolHandler("http", new MockHttpServerJobFactory); + factory->SetProtocolHandler("https", new MockHttpServerJobFactory); + job_factory_ = factory.Pass(); request_context_.reset(new net::TestURLRequestContext()); request_context_->set_job_factory(job_factory_.get()); } @@ -773,7 +775,8 @@ class AppCacheUpdateJobTest : public testing::Test, void ManifestRedirectTest() { ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new RedirectFactory); io_thread_->SetNewJobFactory(new_factory); @@ -1636,7 +1639,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Set some large number of times to return retry. // Expect 1 manifest fetch and 3 retries. RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -1667,7 +1671,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Set some large number of times to return retry. // Expect 1 manifest fetch and 0 retries. RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -1699,7 +1704,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Expect 1 request and 0 retry attempts. RetryRequestTestJob::Initialize( 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -1730,7 +1736,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Set 2 as the retry limit (does not exceed the max). // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch. RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -1761,7 +1768,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Set 1 as the retry limit (does not exceed the max). // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch. RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -2603,7 +2611,8 @@ class AppCacheUpdateJobTest : public testing::Test, void IfModifiedSinceTest() { ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -2669,7 +2678,8 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", ""); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -2728,7 +2738,8 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -2787,7 +2798,8 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); io_thread_->SetNewJobFactory(new_factory); @@ -2822,7 +2834,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Verify that code is correct when building multiple extra headers. HttpHeadersRequestTestJob::Initialize( "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\""); - net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl); + net::URLRequestJobFactoryImpl* new_factory( + new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); io_thread_->SetNewJobFactory(new_factory); -- cgit v1.1