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 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 TestURLLoaderClient::TestURLLoaderClient() : binding_(this) {} | 13 TestURLLoaderClient::TestURLLoaderClient() : binding_(this) {} |
14 TestURLLoaderClient::~TestURLLoaderClient() {} | 14 TestURLLoaderClient::~TestURLLoaderClient() {} |
15 | 15 |
16 void TestURLLoaderClient::OnReceiveResponse( | 16 void TestURLLoaderClient::OnReceiveResponse( |
17 const ResourceResponseHead& response_head) { | 17 const ResourceResponseHead& response_head, |
| 18 mojom::DownloadedTempFilePtr downloaded_file) { |
18 has_received_response_ = true; | 19 has_received_response_ = true; |
19 response_head_ = response_head; | 20 response_head_ = response_head; |
20 if (quit_closure_for_on_receive_response_) | 21 if (quit_closure_for_on_receive_response_) |
21 quit_closure_for_on_receive_response_.Run(); | 22 quit_closure_for_on_receive_response_.Run(); |
22 } | 23 } |
23 | 24 |
24 void TestURLLoaderClient::OnReceiveRedirect( | 25 void TestURLLoaderClient::OnReceiveRedirect( |
25 const net::RedirectInfo& redirect_info, | 26 const net::RedirectInfo& redirect_info, |
26 const ResourceResponseHead& response_head) { | 27 const ResourceResponseHead& response_head) { |
27 EXPECT_FALSE(response_body_.is_valid()); | 28 EXPECT_FALSE(response_body_.is_valid()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void TestURLLoaderClient::RunUntilComplete() { | 110 void TestURLLoaderClient::RunUntilComplete() { |
110 if (has_received_completion_) | 111 if (has_received_completion_) |
111 return; | 112 return; |
112 base::RunLoop run_loop; | 113 base::RunLoop run_loop; |
113 quit_closure_for_on_complete_ = run_loop.QuitClosure(); | 114 quit_closure_for_on_complete_ = run_loop.QuitClosure(); |
114 run_loop.Run(); | 115 run_loop.Run(); |
115 quit_closure_for_on_complete_.Reset(); | 116 quit_closure_for_on_complete_.Reset(); |
116 } | 117 } |
117 | 118 |
118 } // namespace content | 119 } // namespace content |
OLD | NEW |