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

Side by Side Diff: net/url_request/url_request_job_factory_impl_unittest.cc

Issue 12328072: Remove some calls to URLRequestContext::network_delegate(). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Provide read-only access to network delegate for derived classes. Created 7 years, 9 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
« no previous file with comments | « net/url_request/url_request_job.h ('k') | net/url_request/url_request_job_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/url_request/url_request_job_factory_impl.h" 5 #include "net/url_request/url_request_job_factory_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "net/url_request/url_request.h" 9 #include "net/url_request/url_request.h"
10 #include "net/url_request/url_request_job.h" 10 #include "net/url_request/url_request_job.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return new MockURLRequestJob( 53 return new MockURLRequestJob(
54 request, 54 request,
55 network_delegate, 55 network_delegate,
56 URLRequestStatus(URLRequestStatus::SUCCESS, OK)); 56 URLRequestStatus(URLRequestStatus::SUCCESS, OK));
57 } 57 }
58 }; 58 };
59 59
60 TEST(URLRequestJobFactoryTest, NoProtocolHandler) { 60 TEST(URLRequestJobFactoryTest, NoProtocolHandler) {
61 TestDelegate delegate; 61 TestDelegate delegate;
62 TestURLRequestContext request_context; 62 TestURLRequestContext request_context;
63 TestURLRequest request(GURL("foo://bar"), &delegate, &request_context); 63 TestURLRequest request(GURL("foo://bar"), &delegate, &request_context, NULL);
64 request.Start(); 64 request.Start();
65 65
66 MessageLoop::current()->Run(); 66 MessageLoop::current()->Run();
67 EXPECT_EQ(URLRequestStatus::FAILED, request.status().status()); 67 EXPECT_EQ(URLRequestStatus::FAILED, request.status().status());
68 EXPECT_EQ(ERR_UNKNOWN_URL_SCHEME, request.status().error()); 68 EXPECT_EQ(ERR_UNKNOWN_URL_SCHEME, request.status().error());
69 } 69 }
70 70
71 TEST(URLRequestJobFactoryTest, BasicProtocolHandler) { 71 TEST(URLRequestJobFactoryTest, BasicProtocolHandler) {
72 TestDelegate delegate; 72 TestDelegate delegate;
73 URLRequestJobFactoryImpl job_factory; 73 URLRequestJobFactoryImpl job_factory;
74 TestURLRequestContext request_context; 74 TestURLRequestContext request_context;
75 request_context.set_job_factory(&job_factory); 75 request_context.set_job_factory(&job_factory);
76 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler); 76 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
77 TestURLRequest request(GURL("foo://bar"), &delegate, &request_context); 77 TestURLRequest request(GURL("foo://bar"), &delegate, &request_context, NULL);
78 request.Start(); 78 request.Start();
79 79
80 MessageLoop::current()->Run(); 80 MessageLoop::current()->Run();
81 EXPECT_EQ(URLRequestStatus::SUCCESS, request.status().status()); 81 EXPECT_EQ(URLRequestStatus::SUCCESS, request.status().status());
82 EXPECT_EQ(OK, request.status().error()); 82 EXPECT_EQ(OK, request.status().error());
83 } 83 }
84 84
85 TEST(URLRequestJobFactoryTest, DeleteProtocolHandler) { 85 TEST(URLRequestJobFactoryTest, DeleteProtocolHandler) {
86 URLRequestJobFactoryImpl job_factory; 86 URLRequestJobFactoryImpl job_factory;
87 TestURLRequestContext request_context; 87 TestURLRequestContext request_context;
88 request_context.set_job_factory(&job_factory); 88 request_context.set_job_factory(&job_factory);
89 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler); 89 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
90 job_factory.SetProtocolHandler("foo", NULL); 90 job_factory.SetProtocolHandler("foo", NULL);
91 } 91 }
92 92
93 } // namespace 93 } // namespace
94 94
95 } // namespace net 95 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job.h ('k') | net/url_request/url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698