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

Unified Diff: net/url_request/url_request_job_factory_unittest.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | net/url_request/url_request_job_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_job_factory_unittest.cc
diff --git a/net/url_request/url_request_job_factory_unittest.cc b/net/url_request/url_request_job_factory_unittest.cc
index 12732566564e0acc37e56d89b0d6049f0e7e4368..d385e7ff2870d5e0103efe3ac69a680de7a09075 100644
--- a/net/url_request/url_request_job_factory_unittest.cc
+++ b/net/url_request/url_request_job_factory_unittest.cc
@@ -87,9 +87,9 @@ class DummyInterceptor : public URLRequestJobFactory::Interceptor {
TEST(URLRequestJobFactoryTest, NoProtocolHandler) {
TestDelegate delegate;
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
+ TestURLRequestContext request_context;
TestURLRequest request(GURL("foo://bar"), &delegate);
- request.set_context(request_context);
+ request.set_context(&request_context);
request.Start();
MessageLoop::current()->Run();
@@ -99,12 +99,12 @@ TEST(URLRequestJobFactoryTest, NoProtocolHandler) {
TEST(URLRequestJobFactoryTest, BasicProtocolHandler) {
TestDelegate delegate;
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
URLRequestJobFactory job_factory;
- request_context->set_job_factory(&job_factory);
+ TestURLRequestContext request_context;
+ request_context.set_job_factory(&job_factory);
job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
TestURLRequest request(GURL("foo://bar"), &delegate);
- request.set_context(request_context);
+ request.set_context(&request_context);
request.Start();
MessageLoop::current()->Run();
@@ -113,21 +113,21 @@ TEST(URLRequestJobFactoryTest, BasicProtocolHandler) {
}
TEST(URLRequestJobFactoryTest, DeleteProtocolHandler) {
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
URLRequestJobFactory job_factory;
- request_context->set_job_factory(&job_factory);
+ TestURLRequestContext request_context;
+ request_context.set_job_factory(&job_factory);
job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
job_factory.SetProtocolHandler("foo", NULL);
}
TEST(URLRequestJobFactoryTest, BasicInterceptor) {
TestDelegate delegate;
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
URLRequestJobFactory job_factory;
- request_context->set_job_factory(&job_factory);
+ TestURLRequestContext request_context;
+ request_context.set_job_factory(&job_factory);
job_factory.AddInterceptor(new DummyInterceptor);
TestURLRequest request(GURL("http://bar"), &delegate);
- request.set_context(request_context);
+ request.set_context(&request_context);
request.Start();
MessageLoop::current()->Run();
@@ -137,12 +137,12 @@ TEST(URLRequestJobFactoryTest, BasicInterceptor) {
TEST(URLRequestJobFactoryTest, InterceptorNeedsValidSchemeStill) {
TestDelegate delegate;
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
URLRequestJobFactory job_factory;
- request_context->set_job_factory(&job_factory);
+ TestURLRequestContext request_context;
+ request_context.set_job_factory(&job_factory);
job_factory.AddInterceptor(new DummyInterceptor);
TestURLRequest request(GURL("foo://bar"), &delegate);
- request.set_context(request_context);
+ request.set_context(&request_context);
request.Start();
MessageLoop::current()->Run();
@@ -152,13 +152,13 @@ TEST(URLRequestJobFactoryTest, InterceptorNeedsValidSchemeStill) {
TEST(URLRequestJobFactoryTest, InterceptorOverridesProtocolHandler) {
TestDelegate delegate;
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
URLRequestJobFactory job_factory;
- request_context->set_job_factory(&job_factory);
+ TestURLRequestContext request_context;
+ request_context.set_job_factory(&job_factory);
job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
job_factory.AddInterceptor(new DummyInterceptor);
TestURLRequest request(GURL("foo://bar"), &delegate);
- request.set_context(request_context);
+ request.set_context(&request_context);
request.Start();
MessageLoop::current()->Run();
@@ -168,13 +168,13 @@ TEST(URLRequestJobFactoryTest, InterceptorOverridesProtocolHandler) {
TEST(URLRequestJobFactoryTest, InterceptorDoesntInterceptUnknownProtocols) {
TestDelegate delegate;
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
URLRequestJobFactory job_factory;
- request_context->set_job_factory(&job_factory);
+ TestURLRequestContext request_context;
+ request_context.set_job_factory(&job_factory);
DummyInterceptor* interceptor = new DummyInterceptor;
job_factory.AddInterceptor(interceptor);
TestURLRequest request(GURL("foo://bar"), &delegate);
- request.set_context(request_context);
+ request.set_context(&request_context);
request.Start();
MessageLoop::current()->Run();
@@ -183,14 +183,14 @@ TEST(URLRequestJobFactoryTest, InterceptorDoesntInterceptUnknownProtocols) {
TEST(URLRequestJobFactoryTest, InterceptorInterceptsHandledUnknownProtocols) {
TestDelegate delegate;
- scoped_refptr<URLRequestContext> request_context(new TestURLRequestContext);
URLRequestJobFactory job_factory;
- request_context->set_job_factory(&job_factory);
+ TestURLRequestContext request_context;
+ request_context.set_job_factory(&job_factory);
DummyInterceptor* interceptor = new DummyInterceptor;
interceptor->handle_all_protocols_ = true;
job_factory.AddInterceptor(interceptor);
TestURLRequest request(GURL("foo://bar"), &delegate);
- request.set_context(request_context);
+ request.set_context(&request_context);
request.Start();
MessageLoop::current()->Run();
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | net/url_request/url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698