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/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 TestURLLoaderClient::TestURLLoaderClient() : binding_(this) {} | 12 TestURLLoaderClient::TestURLLoaderClient() : binding_(this) {} |
13 TestURLLoaderClient::~TestURLLoaderClient() {} | 13 TestURLLoaderClient::~TestURLLoaderClient() {} |
14 | 14 |
15 void TestURLLoaderClient::OnReceiveResponse( | 15 void TestURLLoaderClient::OnReceiveResponse( |
16 const ResourceResponseHead& response_head) { | 16 const ResourceResponseHead& response_head, |
| 17 mojom::DownloadedTempFilePtr downloaded_file) { |
17 has_received_response_ = true; | 18 has_received_response_ = true; |
18 response_head_ = response_head; | 19 response_head_ = response_head; |
19 if (quit_closure_for_on_received_response_) | 20 if (quit_closure_for_on_received_response_) |
20 quit_closure_for_on_received_response_.Run(); | 21 quit_closure_for_on_received_response_.Run(); |
21 } | 22 } |
22 | 23 |
23 void TestURLLoaderClient::OnDataDownloaded(int64_t data_length, | 24 void TestURLLoaderClient::OnDataDownloaded(int64_t data_length, |
24 int64_t encoded_data_length) { | 25 int64_t encoded_data_length) { |
25 has_data_downloaded_ = true; | 26 has_data_downloaded_ = true; |
26 download_data_length_ += data_length; | 27 download_data_length_ += data_length; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void TestURLLoaderClient::RunUntilComplete() { | 84 void TestURLLoaderClient::RunUntilComplete() { |
84 if (has_received_completion_) | 85 if (has_received_completion_) |
85 return; | 86 return; |
86 base::RunLoop run_loop; | 87 base::RunLoop run_loop; |
87 quit_closure_for_on_complete_ = run_loop.QuitClosure(); | 88 quit_closure_for_on_complete_ = run_loop.QuitClosure(); |
88 run_loop.Run(); | 89 run_loop.Run(); |
89 quit_closure_for_on_complete_.Reset(); | 90 quit_closure_for_on_complete_.Reset(); |
90 } | 91 } |
91 | 92 |
92 } // namespace content | 93 } // namespace content |
OLD | NEW |