| 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 <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, | 97 static net::URLRequestJob* MockHttpJobFactory(net::URLRequest* request, |
| 98 const std::string& scheme) { | 98 const std::string& scheme) { |
| 99 if (mock_factory_job_) { | 99 if (mock_factory_job_) { |
| 100 net::URLRequestJob* temp = mock_factory_job_; | 100 net::URLRequestJob* temp = mock_factory_job_; |
| 101 mock_factory_job_ = NULL; | 101 mock_factory_job_ = NULL; |
| 102 return temp; | 102 return temp; |
| 103 } else { | 103 } else { |
| 104 // Some of these tests trigger UpdateJobs which start URLRequests. | 104 // Some of these tests trigger UpdateJobs which start URLRequests. |
| 105 // We short circuit those be returning error jobs. | 105 // We short circuit those be returning error jobs. |
| 106 return new URLRequestErrorJob(request, net::ERR_INTERNET_DISCONNECTED); | 106 return new net::URLRequestErrorJob(request, |
| 107 net::ERR_INTERNET_DISCONNECTED); |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 | 110 |
| 110 static void SetUpTestCase() { | 111 static void SetUpTestCase() { |
| 111 io_thread_.reset(new base::Thread("AppCacheRequestHandlerTest Thread")); | 112 io_thread_.reset(new base::Thread("AppCacheRequestHandlerTest Thread")); |
| 112 base::Thread::Options options(MessageLoop::TYPE_IO, 0); | 113 base::Thread::Options options(MessageLoop::TYPE_IO, 0); |
| 113 io_thread_->StartWithOptions(options); | 114 io_thread_->StartWithOptions(options); |
| 114 } | 115 } |
| 115 | 116 |
| 116 static void TearDownTestCase() { | 117 static void TearDownTestCase() { |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 | 739 |
| 739 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { | 740 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { |
| 740 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); | 741 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); |
| 741 } | 742 } |
| 742 | 743 |
| 743 } // namespace appcache | 744 } // namespace appcache |
| 744 | 745 |
| 745 // AppCacheRequestHandlerTest is expected to always live longer than the | 746 // AppCacheRequestHandlerTest is expected to always live longer than the |
| 746 // runnable methods. This lets us call NewRunnableMethod on its instances. | 747 // runnable methods. This lets us call NewRunnableMethod on its instances. |
| 747 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheRequestHandlerTest); | 748 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheRequestHandlerTest); |
| OLD | NEW |