Index: content/test/test_web_contents.cc |
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc |
index 7807ffaa804cd54659f481ace694e51416a16efd..0918d5e9c57b38237d33895afacd17ee3f3a5bad 100644 |
--- a/content/test/test_web_contents.cc |
+++ b/content/test/test_web_contents.cc |
@@ -22,6 +22,7 @@ |
#include "content/public/browser/notification_types.h" |
#include "content/public/common/browser_side_navigation_policy.h" |
#include "content/public/common/page_state.h" |
+#include "content/public/test/browser_side_navigation_test_utils.h" |
#include "content/public/test/mock_render_process_host.h" |
#include "content/test/test_render_view_host.h" |
#include "ui/base/page_transition_types.h" |
@@ -217,31 +218,13 @@ void TestWebContents::CommitPendingNavigation() { |
const NavigationEntry* entry = GetController().GetPendingEntry(); |
DCHECK(entry); |
- // If we are doing a cross-site navigation, this simulates the current RFH |
- // notifying that it has unloaded so the pending RFH is resumed and can |
- // navigate. |
- // PlzNavigate: the pending RFH is not created before the navigation commit, |
- // so it is necessary to simulate the IO thread response here to commit in the |
- // proper renderer. It is necessary to call PrepareForCommit before getting |
- // the main and the pending frame because when we are trying to navigate to a |
- // webui from a new tab, a RenderFrameHost is created to display it that is |
- // committed immediately (since it is a new tab). Therefore the main frame is |
- // replaced without a pending frame being created, and we don't get the right |
- // values for the RFH to navigate: we try to use the old one that has been |
- // deleted in the meantime. |
- // Note that for some synchronous navigations (about:blank, javascript |
- // urls, etc.) there will be no NavigationRequest, and no simulation of the |
- // network stack is required. |
- bool browser_side_navigation = IsBrowserSideNavigationEnabled(); |
- if (!browser_side_navigation || |
- GetMainFrame()->frame_tree_node()->navigation_request()) { |
- GetMainFrame()->PrepareForCommit(); |
- } |
- |
TestRenderFrameHost* old_rfh = GetMainFrame(); |
+ old_rfh->SimulateUnloading(); |
+ |
TestRenderFrameHost* rfh = GetPendingMainFrame(); |
if (!rfh) |
rfh = old_rfh; |
+ const bool browser_side_navigation = IsBrowserSideNavigationEnabled(); |
CHECK(!browser_side_navigation || rfh->is_loading()); |
CHECK(!browser_side_navigation || |
!rfh->frame_tree_node()->navigation_request()); |