| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/http/http_stream_factory_impl_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "net/dns/mock_host_resolver.h" | 10 #include "net/dns/mock_host_resolver.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 class FailingHostResolver : public MockHostResolverBase { | 93 class FailingHostResolver : public MockHostResolverBase { |
| 94 public: | 94 public: |
| 95 FailingHostResolver() : MockHostResolverBase(false /*use_caching*/) {} | 95 FailingHostResolver() : MockHostResolverBase(false /*use_caching*/) {} |
| 96 ~FailingHostResolver() override {} | 96 ~FailingHostResolver() override {} |
| 97 | 97 |
| 98 int Resolve(const RequestInfo& info, | 98 int Resolve(const RequestInfo& info, |
| 99 RequestPriority priority, | 99 RequestPriority priority, |
| 100 AddressList* addresses, | 100 AddressList* addresses, |
| 101 const CompletionCallback& callback, | 101 const CompletionCallback& callback, |
| 102 RequestHandle* out_req, | 102 std::unique_ptr<Request>* out_req, |
| 103 const BoundNetLog& net_log) override { | 103 const BoundNetLog& net_log) override { |
| 104 return ERR_NAME_NOT_RESOLVED; | 104 return ERR_NAME_NOT_RESOLVED; |
| 105 } | 105 } |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 class HangingResolver : public MockHostResolverBase { | 108 class HangingResolver : public MockHostResolverBase { |
| 109 public: | 109 public: |
| 110 HangingResolver() : MockHostResolverBase(false /*use_caching*/) {} | 110 HangingResolver() : MockHostResolverBase(false /*use_caching*/) {} |
| 111 ~HangingResolver() override {} | 111 ~HangingResolver() override {} |
| 112 | 112 |
| 113 int Resolve(const RequestInfo& info, | 113 int Resolve(const RequestInfo& info, |
| 114 RequestPriority priority, | 114 RequestPriority priority, |
| 115 AddressList* addresses, | 115 AddressList* addresses, |
| 116 const CompletionCallback& callback, | 116 const CompletionCallback& callback, |
| 117 RequestHandle* out_req, | 117 std::unique_ptr<Request>* out_req, |
| 118 const BoundNetLog& net_log) override { | 118 const BoundNetLog& net_log) override { |
| 119 return ERR_IO_PENDING; | 119 return ERR_IO_PENDING; |
| 120 } | 120 } |
| 121 | |
| 122 void CancelRequest(RequestHandle req) override {} | |
| 123 }; | 121 }; |
| 124 } // anonymous namespace | 122 } // anonymous namespace |
| 125 | 123 |
| 126 class HttpStreamFactoryImplJobPeer { | 124 class HttpStreamFactoryImplJobPeer { |
| 127 public: | 125 public: |
| 128 static void Start(HttpStreamFactoryImpl::Job* job, | 126 static void Start(HttpStreamFactoryImpl::Job* job, |
| 129 HttpStreamRequest::StreamType stream_type) { | 127 HttpStreamRequest::StreamType stream_type) { |
| 130 // Start() is mocked for MockHttpStreamFactoryImplJob. | 128 // Start() is mocked for MockHttpStreamFactoryImplJob. |
| 131 // This is the alternative method to invoke real Start() method on Job. | 129 // This is the alternative method to invoke real Start() method on Job. |
| 132 job->stream_type_ = stream_type; | 130 job->stream_type_ = stream_type; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 // request and controller should resume the main job after delay. | 699 // request and controller should resume the main job after delay. |
| 702 // Verify the waiting time for delayed main job. | 700 // Verify the waiting time for delayed main job. |
| 703 EXPECT_CALL(*job_factory_.main_job(), Resume()) | 701 EXPECT_CALL(*job_factory_.main_job(), Resume()) |
| 704 .WillOnce(Invoke(testing::CreateFunctor( | 702 .WillOnce(Invoke(testing::CreateFunctor( |
| 705 &JobControllerPeer::VerifyWaitingTimeForMainJob, job_controller_, | 703 &JobControllerPeer::VerifyWaitingTimeForMainJob, job_controller_, |
| 706 base::TimeDelta::FromMicroseconds(15)))); | 704 base::TimeDelta::FromMicroseconds(15)))); |
| 707 | 705 |
| 708 base::RunLoop().RunUntilIdle(); | 706 base::RunLoop().RunUntilIdle(); |
| 709 } | 707 } |
| 710 } // namespace net | 708 } // namespace net |
| OLD | NEW |