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

Side by Side Diff: webkit/appcache/appcache_request_handler_unittest.cc

Issue 7397008: Deprecate RegisterProtocolFactory/(Un)RegisterInterceptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix indent. Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stack> 5 #include <stack>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 template <class Method> 162 template <class Method>
163 void RunTestOnIOThread(Method method) { 163 void RunTestOnIOThread(Method method) {
164 test_finished_event_ .reset(new base::WaitableEvent(false, false)); 164 test_finished_event_ .reset(new base::WaitableEvent(false, false));
165 io_thread_->message_loop()->PostTask( 165 io_thread_->message_loop()->PostTask(
166 FROM_HERE, new WrapperTask<Method>(this, method)); 166 FROM_HERE, new WrapperTask<Method>(this, method));
167 test_finished_event_->Wait(); 167 test_finished_event_->Wait();
168 } 168 }
169 169
170 void SetUpTest() { 170 void SetUpTest() {
171 DCHECK(MessageLoop::current() == io_thread_->message_loop()); 171 DCHECK(MessageLoop::current() == io_thread_->message_loop());
172 orig_http_factory_ = net::URLRequest::RegisterProtocolFactory( 172 orig_http_factory_ = net::URLRequest::Deprecated::RegisterProtocolFactory(
173 "http", MockHttpJobFactory); 173 "http", MockHttpJobFactory);
174 mock_service_.reset(new MockAppCacheService); 174 mock_service_.reset(new MockAppCacheService);
175 mock_frontend_.reset(new MockFrontend); 175 mock_frontend_.reset(new MockFrontend);
176 backend_impl_.reset(new AppCacheBackendImpl); 176 backend_impl_.reset(new AppCacheBackendImpl);
177 backend_impl_->Initialize(mock_service_.get(), mock_frontend_.get(), 177 backend_impl_->Initialize(mock_service_.get(), mock_frontend_.get(),
178 kMockProcessId); 178 kMockProcessId);
179 const int kHostId = 1; 179 const int kHostId = 1;
180 backend_impl_->RegisterHost(kHostId); 180 backend_impl_->RegisterHost(kHostId);
181 host_ = backend_impl_->GetHost(kHostId); 181 host_ = backend_impl_->GetHost(kHostId);
182 } 182 }
183 183
184 void TearDownTest() { 184 void TearDownTest() {
185 DCHECK(MessageLoop::current() == io_thread_->message_loop()); 185 DCHECK(MessageLoop::current() == io_thread_->message_loop());
186 DCHECK(!mock_factory_job_); 186 DCHECK(!mock_factory_job_);
187 net::URLRequest::RegisterProtocolFactory("http", orig_http_factory_); 187 net::URLRequest::Deprecated::RegisterProtocolFactory(
188 "http", orig_http_factory_);
188 orig_http_factory_ = NULL; 189 orig_http_factory_ = NULL;
189 job_ = NULL; 190 job_ = NULL;
190 handler_.reset(); 191 handler_.reset();
191 request_.reset(); 192 request_.reset();
192 backend_impl_.reset(); 193 backend_impl_.reset();
193 mock_frontend_.reset(); 194 mock_frontend_.reset();
194 mock_service_.reset(); 195 mock_service_.reset();
195 host_ = NULL; 196 host_ = NULL;
196 } 197 }
197 198
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 842
842 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { 843 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) {
843 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); 844 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest);
844 } 845 }
845 846
846 } // namespace appcache 847 } // namespace appcache
847 848
848 // AppCacheRequestHandlerTest is expected to always live longer than the 849 // AppCacheRequestHandlerTest is expected to always live longer than the
849 // runnable methods. This lets us call NewRunnableMethod on its instances. 850 // runnable methods. This lets us call NewRunnableMethod on its instances.
850 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheRequestHandlerTest); 851 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheRequestHandlerTest);
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_interceptor.cc ('k') | webkit/appcache/appcache_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698