OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/test_web_contents.h" | 5 #include "content/test/test_web_contents.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/browser_url_handler_impl.h" | 9 #include "content/browser/browser_url_handler_impl.h" |
10 #include "content/browser/frame_host/cross_process_frame_connector.h" | 10 #include "content/browser/frame_host/cross_process_frame_connector.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 GURL loaded_url(url); | 182 GURL loaded_url(url); |
183 bool reverse_on_redirect = false; | 183 bool reverse_on_redirect = false; |
184 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | 184 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
185 &loaded_url, GetBrowserContext(), &reverse_on_redirect); | 185 &loaded_url, GetBrowserContext(), &reverse_on_redirect); |
186 // LoadURL created a navigation entry, now simulate the RenderView sending | 186 // LoadURL created a navigation entry, now simulate the RenderView sending |
187 // a notification that it actually navigated. | 187 // a notification that it actually navigated. |
188 CommitPendingNavigation(); | 188 CommitPendingNavigation(); |
189 } | 189 } |
190 | 190 |
191 void TestWebContents::TestSetIsLoading(bool value) { | 191 void TestWebContents::TestSetIsLoading(bool value) { |
192 if (value) | 192 SetIsLoading(value, true, nullptr); |
193 DidStartLoading(GetMainFrame()->frame_tree_node(), true); | |
194 else { | |
195 for (FrameTreeNode* node : frame_tree_.Nodes()) { | |
196 RenderFrameHostImpl* current_frame_host = | |
197 node->render_manager()->current_frame_host(); | |
198 DCHECK(current_frame_host); | |
199 current_frame_host->ResetLoadingState(); | |
200 | |
201 RenderFrameHostImpl* pending_frame_host = | |
202 node->render_manager()->pending_frame_host(); | |
203 | |
204 if (IsBrowserSideNavigationEnabled()) { | |
205 RenderFrameHostImpl* speculative_frame_host = | |
206 node->render_manager()->speculative_frame_host(); | |
207 if (speculative_frame_host) | |
208 speculative_frame_host->ResetLoadingState(); | |
209 } else { | |
210 if (pending_frame_host) | |
211 pending_frame_host->ResetLoadingState(); | |
212 } | |
213 } | |
214 } | |
215 } | 193 } |
216 | 194 |
217 void TestWebContents::CommitPendingNavigation() { | 195 void TestWebContents::CommitPendingNavigation() { |
218 const NavigationEntry* entry = GetController().GetPendingEntry(); | 196 const NavigationEntry* entry = GetController().GetPendingEntry(); |
219 DCHECK(entry); | 197 DCHECK(entry); |
220 | 198 |
221 // If we are doing a cross-site navigation, this simulates the current RFH | 199 // If we are doing a cross-site navigation, this simulates the current RFH |
222 // notifying that it has unloaded so the pending RFH is resumed and can | 200 // notifying that it has unloaded so the pending RFH is resumed and can |
223 // navigate. | 201 // navigate. |
224 // PlzNavigate: the pending RFH is not created before the navigation commit, | 202 // PlzNavigate: the pending RFH is not created before the navigation commit, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 322 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
345 } | 323 } |
346 | 324 |
347 void TestWebContents::SaveFrameWithHeaders(const GURL& url, | 325 void TestWebContents::SaveFrameWithHeaders(const GURL& url, |
348 const Referrer& referrer, | 326 const Referrer& referrer, |
349 const std::string& headers) { | 327 const std::string& headers) { |
350 save_frame_headers_ = headers; | 328 save_frame_headers_ = headers; |
351 } | 329 } |
352 | 330 |
353 } // namespace content | 331 } // namespace content |
OLD | NEW |