| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stack> | 5 #include <stack> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, | 130 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, |
| 131 const std::string& scheme) { | 131 const std::string& scheme) { |
| 132 if (mock_factory_job_) { | 132 if (mock_factory_job_) { |
| 133 net::URLRequestJob* temp = mock_factory_job_; | 133 net::URLRequestJob* temp = mock_factory_job_; |
| 134 mock_factory_job_ = NULL; | 134 mock_factory_job_ = NULL; |
| 135 return temp; | 135 return temp; |
| 136 } else { | 136 } else { |
| 137 return new net::URLRequestErrorJob(request, | 137 return new net::URLRequestErrorJob(request, |
| 138 request->context()->network_delegate(), |
| 138 net::ERR_INTERNET_DISCONNECTED); | 139 net::ERR_INTERNET_DISCONNECTED); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 // Helper callback to run a test on our io_thread. The io_thread is spun up | 143 // Helper callback to run a test on our io_thread. The io_thread is spun up |
| 143 // once and reused for all tests. | 144 // once and reused for all tests. |
| 144 template <class Method> | 145 template <class Method> |
| 145 void MethodWrapper(Method method) { | 146 void MethodWrapper(Method method) { |
| 146 SetUpTest(); | 147 SetUpTest(); |
| 147 (this->*method)(); | 148 (this->*method)(); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 799 |
| 799 TEST_F(AppCacheURLRequestJobTest, CancelRequest) { | 800 TEST_F(AppCacheURLRequestJobTest, CancelRequest) { |
| 800 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequest); | 801 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequest); |
| 801 } | 802 } |
| 802 | 803 |
| 803 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { | 804 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { |
| 804 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); | 805 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); |
| 805 } | 806 } |
| 806 | 807 |
| 807 } // namespace appcache | 808 } // namespace appcache |
| OLD | NEW |