| 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/test_url_loader_client.h" | 5 #include "content/browser/loader/test_url_loader_client.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 void TestURLLoaderClient::RunUntilResponseReceived() { | 46 void TestURLLoaderClient::RunUntilResponseReceived() { |
| 47 base::RunLoop run_loop; | 47 base::RunLoop run_loop; |
| 48 quit_closure_for_on_received_response_ = run_loop.QuitClosure(); | 48 quit_closure_for_on_received_response_ = run_loop.QuitClosure(); |
| 49 run_loop.Run(); | 49 run_loop.Run(); |
| 50 quit_closure_for_on_received_response_.Reset(); | 50 quit_closure_for_on_received_response_.Reset(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void TestURLLoaderClient::RunUntilResponseBodyArrived() { | 53 void TestURLLoaderClient::RunUntilResponseBodyArrived() { |
| 54 if (response_body_.is_valid()) |
| 55 return; |
| 54 base::RunLoop run_loop; | 56 base::RunLoop run_loop; |
| 55 quit_closure_for_on_start_loading_response_body_ = run_loop.QuitClosure(); | 57 quit_closure_for_on_start_loading_response_body_ = run_loop.QuitClosure(); |
| 56 run_loop.Run(); | 58 run_loop.Run(); |
| 57 quit_closure_for_on_start_loading_response_body_.Reset(); | 59 quit_closure_for_on_start_loading_response_body_.Reset(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 void TestURLLoaderClient::RunUntilComplete() { | 62 void TestURLLoaderClient::RunUntilComplete() { |
| 63 if (has_received_completion_) |
| 64 return; |
| 61 base::RunLoop run_loop; | 65 base::RunLoop run_loop; |
| 62 quit_closure_for_on_complete_ = run_loop.QuitClosure(); | 66 quit_closure_for_on_complete_ = run_loop.QuitClosure(); |
| 63 run_loop.Run(); | 67 run_loop.Run(); |
| 64 quit_closure_for_on_complete_.Reset(); | 68 quit_closure_for_on_complete_.Reset(); |
| 65 } | 69 } |
| 66 | 70 |
| 67 } // namespace content | 71 } // namespace content |
| OLD | NEW |