| 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 <stack> | 5 #include <stack> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, | 135 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, |
| 136 const std::string& scheme) { | 136 const std::string& scheme) { |
| 137 if (mock_factory_job_) { | 137 if (mock_factory_job_) { |
| 138 net::URLRequestJob* temp = mock_factory_job_; | 138 net::URLRequestJob* temp = mock_factory_job_; |
| 139 mock_factory_job_ = NULL; | 139 mock_factory_job_ = NULL; |
| 140 return temp; | 140 return temp; |
| 141 } else { | 141 } else { |
| 142 // Some of these tests trigger UpdateJobs which start URLRequests. | 142 // Some of these tests trigger UpdateJobs which start URLRequests. |
| 143 // We short circuit those be returning error jobs. | 143 // We short circuit those be returning error jobs. |
| 144 return new net::URLRequestErrorJob(request, | 144 return new net::URLRequestErrorJob(request, |
| 145 request->context()->network_delegate(), |
| 145 net::ERR_INTERNET_DISCONNECTED); | 146 net::ERR_INTERNET_DISCONNECTED); |
| 146 } | 147 } |
| 147 } | 148 } |
| 148 | 149 |
| 149 static void SetUpTestCase() { | 150 static void SetUpTestCase() { |
| 150 io_thread_.reset(new base::Thread("AppCacheRequestHandlerTest Thread")); | 151 io_thread_.reset(new base::Thread("AppCacheRequestHandlerTest Thread")); |
| 151 base::Thread::Options options(MessageLoop::TYPE_IO, 0); | 152 base::Thread::Options options(MessageLoop::TYPE_IO, 0); |
| 152 io_thread_->StartWithOptions(options); | 153 io_thread_->StartWithOptions(options); |
| 153 } | 154 } |
| 154 | 155 |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 | 902 |
| 902 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { | 903 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { |
| 903 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); | 904 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); |
| 904 } | 905 } |
| 905 | 906 |
| 906 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { | 907 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { |
| 907 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); | 908 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); |
| 908 } | 909 } |
| 909 | 910 |
| 910 } // namespace appcache | 911 } // namespace appcache |
| OLD | NEW |