| 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
| 7 #include "chrome/browser/browser_thread.h" | 7 #include "chrome/browser/browser_thread.h" |
| 8 #include "chrome/browser/renderer_host/global_request_id.h" | 8 #include "chrome/browser/renderer_host/global_request_id.h" |
| 9 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" | 9 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 10 #include "chrome/browser/renderer_host/resource_handler.h" | 10 #include "chrome/browser/renderer_host/resource_handler.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 ResourceQueueTest() | 157 ResourceQueueTest() |
| 158 : response_started_count_(0), | 158 : response_started_count_(0), |
| 159 message_loop_(MessageLoop::TYPE_IO), | 159 message_loop_(MessageLoop::TYPE_IO), |
| 160 ui_thread_(BrowserThread::UI, &message_loop_), | 160 ui_thread_(BrowserThread::UI, &message_loop_), |
| 161 io_thread_(BrowserThread::IO, &message_loop_) { | 161 io_thread_(BrowserThread::IO, &message_loop_) { |
| 162 } | 162 } |
| 163 | 163 |
| 164 virtual void OnResponseStarted(net::URLRequest* request) { | 164 virtual void OnResponseStarted(net::URLRequest* request) { |
| 165 response_started_count_++; | 165 response_started_count_++; |
| 166 // We're not going to do anything more with the request. Cancel it now | 166 // We're not going to do anything more with the request. Cancel it now |
| 167 // to avoid leaking URLRequestJob. | 167 // to avoid leaking net::URLRequestJob. |
| 168 request->Cancel(); | 168 request->Cancel(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { | 171 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { |
| 172 } | 172 } |
| 173 | 173 |
| 174 protected: | 174 protected: |
| 175 int response_started_count_; | 175 int response_started_count_; |
| 176 | 176 |
| 177 private: | 177 private: |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 MessageLoop::current()->RunAllPending(); | 281 MessageLoop::current()->RunAllPending(); |
| 282 EXPECT_EQ(0, response_started_count_); | 282 EXPECT_EQ(0, response_started_count_); |
| 283 | 283 |
| 284 queue.Shutdown(); | 284 queue.Shutdown(); |
| 285 | 285 |
| 286 MessageLoop::current()->RunAllPending(); | 286 MessageLoop::current()->RunAllPending(); |
| 287 EXPECT_EQ(0, response_started_count_); | 287 EXPECT_EQ(0, response_started_count_); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace | 290 } // namespace |
| OLD | NEW |