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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 AppCacheURLRequestJobTest* test_; | 118 AppCacheURLRequestJobTest* test_; |
119 net::HttpResponseInfo received_info_; | 119 net::HttpResponseInfo received_info_; |
120 scoped_refptr<net::IOBuffer> received_data_; | 120 scoped_refptr<net::IOBuffer> received_data_; |
121 bool did_receive_headers_; | 121 bool did_receive_headers_; |
122 int amount_received_; | 122 int amount_received_; |
123 int kill_after_amount_received_; | 123 int kill_after_amount_received_; |
124 bool kill_with_io_pending_; | 124 bool kill_with_io_pending_; |
125 }; | 125 }; |
126 | 126 |
127 static 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 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 URLRequestErrorJob(request, net::ERR_INTERNET_DISCONNECTED); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 // Helper class run a test on our io_thread. The io_thread | 138 // Helper class run a test on our io_thread. The io_thread |
139 // is spun up once and reused for all tests. | 139 // is spun up once and reused for all tests. |
140 template <class Method> | 140 template <class Method> |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 | 812 |
813 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { | 813 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { |
814 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); | 814 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); |
815 } | 815 } |
816 | 816 |
817 } // namespace appcache | 817 } // namespace appcache |
818 | 818 |
819 // AppCacheURLRequestJobTest is expected to always live longer than the | 819 // AppCacheURLRequestJobTest is expected to always live longer than the |
820 // runnable methods. This lets us call NewRunnableMethod on its instances. | 820 // runnable methods. This lets us call NewRunnableMethod on its instances. |
821 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheURLRequestJobTest); | 821 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheURLRequestJobTest); |
OLD | NEW |