| 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 SetIsLoading(value, true, nullptr); | 192 if (value) |
| 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 } |
| 193 } | 215 } |
| 194 | 216 |
| 195 void TestWebContents::CommitPendingNavigation() { | 217 void TestWebContents::CommitPendingNavigation() { |
| 196 const NavigationEntry* entry = GetController().GetPendingEntry(); | 218 const NavigationEntry* entry = GetController().GetPendingEntry(); |
| 197 DCHECK(entry); | 219 DCHECK(entry); |
| 198 | 220 |
| 199 // If we are doing a cross-site navigation, this simulates the current RFH | 221 // If we are doing a cross-site navigation, this simulates the current RFH |
| 200 // notifying that it has unloaded so the pending RFH is resumed and can | 222 // notifying that it has unloaded so the pending RFH is resumed and can |
| 201 // navigate. | 223 // navigate. |
| 202 // PlzNavigate: the pending RFH is not created before the navigation commit, | 224 // PlzNavigate: the pending RFH is not created before the navigation commit, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 344 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
| 323 } | 345 } |
| 324 | 346 |
| 325 void TestWebContents::SaveFrameWithHeaders(const GURL& url, | 347 void TestWebContents::SaveFrameWithHeaders(const GURL& url, |
| 326 const Referrer& referrer, | 348 const Referrer& referrer, |
| 327 const std::string& headers) { | 349 const std::string& headers) { |
| 328 save_frame_headers_ = headers; | 350 save_frame_headers_ = headers; |
| 329 } | 351 } |
| 330 | 352 |
| 331 } // namespace content | 353 } // namespace content |
| OLD | NEW |