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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host_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 "content/browser/renderer_host/resource_dispatcher_host.h" 5 #include "content/browser/renderer_host/resource_dispatcher_host.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 delete msg; 266 delete msg;
267 return true; 267 return true;
268 } 268 }
269 269
270 protected: 270 protected:
271 // testing::Test 271 // testing::Test
272 virtual void SetUp() { 272 virtual void SetUp() {
273 DCHECK(!test_fixture_); 273 DCHECK(!test_fixture_);
274 test_fixture_ = this; 274 test_fixture_ = this;
275 ChildProcessSecurityPolicy::GetInstance()->Add(0); 275 ChildProcessSecurityPolicy::GetInstance()->Add(0);
276 net::URLRequest::RegisterProtocolFactory( 276 net::URLRequest::Deprecated::RegisterProtocolFactory(
277 "test", 277 "test",
278 &ResourceDispatcherHostTest::Factory); 278 &ResourceDispatcherHostTest::Factory);
279 EnsureTestSchemeIsAllowed(); 279 EnsureTestSchemeIsAllowed();
280 delay_start_ = false; 280 delay_start_ = false;
281 } 281 }
282 282
283 virtual void TearDown() { 283 virtual void TearDown() {
284 net::URLRequest::RegisterProtocolFactory("test", NULL); 284 net::URLRequest::Deprecated::RegisterProtocolFactory("test", NULL);
285 if (!scheme_.empty()) 285 if (!scheme_.empty())
286 net::URLRequest::RegisterProtocolFactory(scheme_, old_factory_); 286 net::URLRequest::Deprecated::RegisterProtocolFactory(
287 scheme_, old_factory_);
287 288
288 EXPECT_TRUE(URLRequestTestDelayedStartJob::DelayedStartQueueEmpty()); 289 EXPECT_TRUE(URLRequestTestDelayedStartJob::DelayedStartQueueEmpty());
289 URLRequestTestDelayedStartJob::ClearQueue(); 290 URLRequestTestDelayedStartJob::ClearQueue();
290 291
291 DCHECK(test_fixture_ == this); 292 DCHECK(test_fixture_ == this);
292 test_fixture_ = NULL; 293 test_fixture_ = NULL;
293 294
294 host_.Shutdown(); 295 host_.Shutdown();
295 296
296 ChildProcessSecurityPolicy::GetInstance()->Remove(0); 297 ChildProcessSecurityPolicy::GetInstance()->Remove(0);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Sets a particular resource type for any request from now on. 340 // Sets a particular resource type for any request from now on.
340 void SetResourceType(ResourceType::Type type) { 341 void SetResourceType(ResourceType::Type type) {
341 resource_type_ = type; 342 resource_type_ = type;
342 } 343 }
343 344
344 // Intercepts requests for the given protocol. 345 // Intercepts requests for the given protocol.
345 void HandleScheme(const std::string& scheme) { 346 void HandleScheme(const std::string& scheme) {
346 DCHECK(scheme_.empty()); 347 DCHECK(scheme_.empty());
347 DCHECK(!old_factory_); 348 DCHECK(!old_factory_);
348 scheme_ = scheme; 349 scheme_ = scheme;
349 old_factory_ = net::URLRequest::RegisterProtocolFactory( 350 old_factory_ = net::URLRequest::Deprecated::RegisterProtocolFactory(
350 scheme_, &ResourceDispatcherHostTest::Factory); 351 scheme_, &ResourceDispatcherHostTest::Factory);
351 } 352 }
352 353
353 // Our own net::URLRequestJob factory. 354 // Our own net::URLRequestJob factory.
354 static net::URLRequestJob* Factory(net::URLRequest* request, 355 static net::URLRequestJob* Factory(net::URLRequest* request,
355 const std::string& scheme) { 356 const std::string& scheme) {
356 if (test_fixture_->response_headers_.empty()) { 357 if (test_fixture_->response_headers_.empty()) {
357 if (delay_start_) { 358 if (delay_start_) {
358 return new URLRequestTestDelayedStartJob(request); 359 return new URLRequestTestDelayedStartJob(request);
359 } else { 360 } else {
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 const net::URLRequestStatus& status, 1201 const net::URLRequestStatus& status,
1201 const std::string& info) { 1202 const std::string& info) {
1202 return true; 1203 return true;
1203 } 1204 }
1204 1205
1205 void OnRequestClosed() {} 1206 void OnRequestClosed() {}
1206 1207
1207 private: 1208 private:
1208 DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler); 1209 DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler);
1209 }; 1210 };
OLDNEW
« no previous file with comments | « content/browser/child_process_security_policy_unittest.cc ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698