| OLD | NEW |
| 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/base/request_priority.h" | 9 #include "net/base/request_priority.h" |
| 10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 NotifyHeadersComplete(); | 42 NotifyHeadersComplete(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 URLRequestStatus status_; | 45 URLRequestStatus status_; |
| 46 base::WeakPtrFactory<MockURLRequestJob> weak_factory_; | 46 base::WeakPtrFactory<MockURLRequestJob> weak_factory_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class DummyProtocolHandler : public URLRequestJobFactory::ProtocolHandler { | 49 class DummyProtocolHandler : public URLRequestJobFactory::ProtocolHandler { |
| 50 public: | 50 public: |
| 51 virtual URLRequestJob* MaybeCreateJob( | 51 virtual URLRequestJob* MaybeCreateJob( |
| 52 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE { | 52 URLRequest* request, |
| 53 NetworkDelegate* network_delegate) const OVERRIDE { |
| 53 return new MockURLRequestJob( | 54 return new MockURLRequestJob( |
| 54 request, | 55 request, |
| 55 network_delegate, | 56 network_delegate, |
| 56 URLRequestStatus(URLRequestStatus::SUCCESS, OK)); | 57 URLRequestStatus(URLRequestStatus::SUCCESS, OK)); |
| 57 } | 58 } |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 TEST(URLRequestJobFactoryTest, NoProtocolHandler) { | 61 TEST(URLRequestJobFactoryTest, NoProtocolHandler) { |
| 61 TestDelegate delegate; | 62 TestDelegate delegate; |
| 62 TestURLRequestContext request_context; | 63 TestURLRequestContext request_context; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 88 URLRequestJobFactoryImpl job_factory; | 89 URLRequestJobFactoryImpl job_factory; |
| 89 TestURLRequestContext request_context; | 90 TestURLRequestContext request_context; |
| 90 request_context.set_job_factory(&job_factory); | 91 request_context.set_job_factory(&job_factory); |
| 91 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler); | 92 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler); |
| 92 job_factory.SetProtocolHandler("foo", NULL); | 93 job_factory.SetProtocolHandler("foo", NULL); |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace | 96 } // namespace |
| 96 | 97 |
| 97 } // namespace net | 98 } // namespace net |
| OLD | NEW |