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

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

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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) 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.h" 5 #include "net/url_request/url_request_job_factory.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_context.h" 10 #include "net/url_request/url_request_context.h"
(...skipping 29 matching lines...) Expand all
40 SetStatus(status_); 40 SetStatus(status_);
41 NotifyHeadersComplete(); 41 NotifyHeadersComplete();
42 } 42 }
43 43
44 URLRequestStatus status_; 44 URLRequestStatus status_;
45 base::WeakPtrFactory<MockURLRequestJob> weak_factory_; 45 base::WeakPtrFactory<MockURLRequestJob> weak_factory_;
46 }; 46 };
47 47
48 class DummyProtocolHandler : public URLRequestJobFactory::ProtocolHandler { 48 class DummyProtocolHandler : public URLRequestJobFactory::ProtocolHandler {
49 public: 49 public:
50 virtual URLRequestJob* MaybeCreateJob(URLRequest* request) const OVERRIDE { 50 virtual URLRequestJob* MaybeCreateJob(
51 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE {
51 return new MockURLRequestJob( 52 return new MockURLRequestJob(
52 request, URLRequestStatus(URLRequestStatus::SUCCESS, OK)); 53 request, URLRequestStatus(URLRequestStatus::SUCCESS, OK));
53 } 54 }
54 }; 55 };
55 56
56 class DummyInterceptor : public URLRequestJobFactory::Interceptor { 57 class DummyInterceptor : public URLRequestJobFactory::Interceptor {
57 public: 58 public:
58 DummyInterceptor() 59 DummyInterceptor()
59 : did_intercept_(false), 60 : did_intercept_(false),
60 handle_all_protocols_(false) { 61 handle_all_protocols_(false) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 EXPECT_FALSE(interceptor->WillHandleProtocol("anything")); 202 EXPECT_FALSE(interceptor->WillHandleProtocol("anything"));
202 EXPECT_FALSE(job_factory.IsHandledProtocol("anything")); 203 EXPECT_FALSE(job_factory.IsHandledProtocol("anything"));
203 interceptor->handle_all_protocols_ = true; 204 interceptor->handle_all_protocols_ = true;
204 EXPECT_TRUE(interceptor->WillHandleProtocol("anything")); 205 EXPECT_TRUE(interceptor->WillHandleProtocol("anything"));
205 EXPECT_TRUE(job_factory.IsHandledProtocol("anything")); 206 EXPECT_TRUE(job_factory.IsHandledProtocol("anything"));
206 } 207 }
207 208
208 } // namespace 209 } // namespace
209 210
210 } // namespace net 211 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698