OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/loader/mock_resource_loader.h" | 5 #include "content/browser/loader/mock_resource_loader.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return status_; | 153 return status_; |
154 } | 154 } |
155 | 155 |
156 MockResourceLoader::Status | 156 MockResourceLoader::Status |
157 MockResourceLoader::OnResponseCompletedFromExternalOutOfBandCancel( | 157 MockResourceLoader::OnResponseCompletedFromExternalOutOfBandCancel( |
158 const net::URLRequestStatus& url_request_status) { | 158 const net::URLRequestStatus& url_request_status) { |
159 // This can happen at any point, except from a recursive call from | 159 // This can happen at any point, except from a recursive call from |
160 // ResourceHandler. | 160 // ResourceHandler. |
161 EXPECT_NE(Status::CALLING_HANDLER, status_); | 161 EXPECT_NE(Status::CALLING_HANDLER, status_); |
162 | 162 |
163 waiting_on_buffer_ = false; | |
164 io_buffer_ = nullptr; | 163 io_buffer_ = nullptr; |
165 io_buffer_size_ = 0; | 164 io_buffer_size_ = 0; |
166 status_ = Status::CALLING_HANDLER; | 165 status_ = Status::CALLING_HANDLER; |
167 | 166 |
168 resource_handler_->OnResponseCompleted( | 167 resource_handler_->OnResponseCompleted( |
169 url_request_status, | 168 url_request_status, |
170 base::MakeUnique<TestResourceController>(weak_factory_.GetWeakPtr())); | 169 base::MakeUnique<TestResourceController>(weak_factory_.GetWeakPtr())); |
171 if (status_ == Status::CALLING_HANDLER) | 170 if (status_ == Status::CALLING_HANDLER) |
172 status_ = Status::CALLBACK_PENDING; | 171 status_ = Status::CALLBACK_PENDING; |
173 EXPECT_NE(Status::CANCELED, status_); | 172 EXPECT_NE(Status::CANCELED, status_); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // Shouldn't update |io_buffer_| or |io_buffer_size_| on cancel. | 236 // Shouldn't update |io_buffer_| or |io_buffer_size_| on cancel. |
238 EXPECT_TRUE(status_ == Status::CALLBACK_PENDING || | 237 EXPECT_TRUE(status_ == Status::CALLBACK_PENDING || |
239 status_ == Status::CALLING_HANDLER); | 238 status_ == Status::CALLING_HANDLER); |
240 | 239 |
241 status_ = Status::IDLE; | 240 status_ = Status::IDLE; |
242 if (canceled_or_idle_run_loop_) | 241 if (canceled_or_idle_run_loop_) |
243 canceled_or_idle_run_loop_->Quit(); | 242 canceled_or_idle_run_loop_->Quit(); |
244 } | 243 } |
245 | 244 |
246 } // namespace content | 245 } // namespace content |
OLD | NEW |