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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 return status_; | 209 return status_; |
210 } | 210 } |
211 | 211 |
212 void MockResourceLoader::WaitUntilIdleOrCanceled() { | 212 void MockResourceLoader::WaitUntilIdleOrCanceled() { |
213 if (status_ == Status::IDLE || status_ == Status::CANCELED) | 213 if (status_ == Status::IDLE || status_ == Status::CANCELED) |
214 return; | 214 return; |
215 EXPECT_FALSE(canceled_or_idle_run_loop_); | 215 EXPECT_FALSE(canceled_or_idle_run_loop_); |
216 canceled_or_idle_run_loop_.reset(new base::RunLoop()); | 216 canceled_or_idle_run_loop_.reset(new base::RunLoop()); |
217 canceled_or_idle_run_loop_->Run(); | 217 canceled_or_idle_run_loop_->Run(); |
| 218 canceled_or_idle_run_loop_.reset(); |
218 EXPECT_TRUE(status_ == Status::IDLE || status_ == Status::CANCELED); | 219 EXPECT_TRUE(status_ == Status::IDLE || status_ == Status::CANCELED); |
219 } | 220 } |
220 | 221 |
221 void MockResourceLoader::Cancel() { | 222 void MockResourceLoader::Cancel() { |
222 CancelWithError(net::ERR_ABORTED); | 223 CancelWithError(net::ERR_ABORTED); |
223 } | 224 } |
224 | 225 |
225 void MockResourceLoader::CancelAndIgnore() { | 226 void MockResourceLoader::CancelAndIgnore() { |
226 NOTREACHED(); | 227 NOTREACHED(); |
227 } | 228 } |
(...skipping 18 matching lines...) Expand all Loading... |
246 } | 247 } |
247 | 248 |
248 void MockResourceLoader::Resume() { | 249 void MockResourceLoader::Resume() { |
249 EXPECT_EQ(Status::CALLBACK_PENDING, status_); | 250 EXPECT_EQ(Status::CALLBACK_PENDING, status_); |
250 status_ = Status::IDLE; | 251 status_ = Status::IDLE; |
251 if (canceled_or_idle_run_loop_) | 252 if (canceled_or_idle_run_loop_) |
252 canceled_or_idle_run_loop_->Quit(); | 253 canceled_or_idle_run_loop_->Quit(); |
253 } | 254 } |
254 | 255 |
255 } // namespace content | 256 } // namespace content |
OLD | NEW |