| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 bool kill_with_io_pending_; | 124 bool kill_with_io_pending_; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, | 127 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, |
| 128 const std::string& scheme) { | 128 const std::string& scheme) { |
| 129 if (mock_factory_job_) { | 129 if (mock_factory_job_) { |
| 130 net::URLRequestJob* temp = mock_factory_job_; | 130 net::URLRequestJob* temp = mock_factory_job_; |
| 131 mock_factory_job_ = NULL; | 131 mock_factory_job_ = NULL; |
| 132 return temp; | 132 return temp; |
| 133 } else { | 133 } else { |
| 134 return new URLRequestErrorJob(request, net::ERR_INTERNET_DISCONNECTED); | 134 return new net::URLRequestErrorJob(request, |
| 135 net::ERR_INTERNET_DISCONNECTED); |
| 135 } | 136 } |
| 136 } | 137 } |
| 137 | 138 |
| 138 // Helper class run a test on our io_thread. The io_thread | 139 // Helper class run a test on our io_thread. The io_thread |
| 139 // is spun up once and reused for all tests. | 140 // is spun up once and reused for all tests. |
| 140 template <class Method> | 141 template <class Method> |
| 141 class WrapperTask : public Task { | 142 class WrapperTask : public Task { |
| 142 public: | 143 public: |
| 143 WrapperTask(AppCacheURLRequestJobTest* test, Method method) | 144 WrapperTask(AppCacheURLRequestJobTest* test, Method method) |
| 144 : test_(test), method_(method) { | 145 : test_(test), method_(method) { |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 813 |
| 813 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { | 814 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { |
| 814 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); | 815 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); |
| 815 } | 816 } |
| 816 | 817 |
| 817 } // namespace appcache | 818 } // namespace appcache |
| 818 | 819 |
| 819 // AppCacheURLRequestJobTest is expected to always live longer than the | 820 // AppCacheURLRequestJobTest is expected to always live longer than the |
| 820 // runnable methods. This lets us call NewRunnableMethod on its instances. | 821 // runnable methods. This lets us call NewRunnableMethod on its instances. |
| 821 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheURLRequestJobTest); | 822 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheURLRequestJobTest); |
| OLD | NEW |