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 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 completion_status_ = status; | 102 completion_status_ = status; |
103 if (quit_closure_for_on_complete_) | 103 if (quit_closure_for_on_complete_) |
104 quit_closure_for_on_complete_.Run(); | 104 quit_closure_for_on_complete_.Run(); |
105 } | 105 } |
106 | 106 |
107 void TestURLLoaderClient::ClearHasReceivedRedirect() { | 107 void TestURLLoaderClient::ClearHasReceivedRedirect() { |
108 has_received_redirect_ = false; | 108 has_received_redirect_ = false; |
109 } | 109 } |
110 | 110 |
111 mojom::URLLoaderClientAssociatedPtrInfo | 111 mojom::URLLoaderClientAssociatedPtrInfo |
112 TestURLLoaderClient::CreateRemoteAssociatedPtrInfo( | 112 TestURLLoaderClient::CreateRemoteAssociatedPtrInfo() { |
113 mojo::AssociatedGroup* associated_group) { | |
114 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info; | 113 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info; |
115 binding_.Bind(&client_ptr_info, associated_group); | 114 binding_.Bind(&client_ptr_info); |
116 return client_ptr_info; | 115 return client_ptr_info; |
117 } | 116 } |
118 | 117 |
119 void TestURLLoaderClient::Unbind() { | 118 void TestURLLoaderClient::Unbind() { |
120 binding_.Unbind(); | 119 binding_.Unbind(); |
121 response_body_.reset(); | 120 response_body_.reset(); |
122 } | 121 } |
123 | 122 |
124 void TestURLLoaderClient::RunUntilResponseReceived() { | 123 void TestURLLoaderClient::RunUntilResponseReceived() { |
125 if (has_received_response_) | 124 if (has_received_response_) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void TestURLLoaderClient::RunUntilComplete() { | 168 void TestURLLoaderClient::RunUntilComplete() { |
170 if (has_received_completion_) | 169 if (has_received_completion_) |
171 return; | 170 return; |
172 base::RunLoop run_loop; | 171 base::RunLoop run_loop; |
173 quit_closure_for_on_complete_ = run_loop.QuitClosure(); | 172 quit_closure_for_on_complete_ = run_loop.QuitClosure(); |
174 run_loop.Run(); | 173 run_loop.Run(); |
175 quit_closure_for_on_complete_.Reset(); | 174 quit_closure_for_on_complete_.Reset(); |
176 } | 175 } |
177 | 176 |
178 } // namespace content | 177 } // namespace content |
OLD | NEW |