Index: chrome/test/base/browser_with_test_window_test.cc |
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc |
index 967d987a9767d7bd18ab6778fd9090bf329c94f7..f7761aac2049e5cc3e61e56be1f994cf9a4738d7 100644 |
--- a/chrome/test/base/browser_with_test_window_test.cc |
+++ b/chrome/test/base/browser_with_test_window_test.cc |
@@ -19,6 +19,8 @@ |
#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/navigation_entry.h" |
#include "content/public/browser/web_contents.h" |
+#include "content/public/common/browser_side_navigation_policy.h" |
+#include "content/public/test/browser_side_navigation_test_utils.h" |
#include "content/public/test/test_renderer_host.h" |
#include "ui/base/page_transition_types.h" |
@@ -65,6 +67,9 @@ void BrowserWithTestWindowTest::SetUp() { |
SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
#endif |
+ if (content::IsBrowserSideNavigationEnabled()) |
+ content::BrowserSideNavigationSetUp(); |
+ |
// Subclasses can provide their own Profile. |
profile_ = CreateProfile(); |
// Subclasses can provide their own test BrowserWindow. If they return NULL |
@@ -85,6 +90,9 @@ void BrowserWithTestWindowTest::TearDown() { |
// audio service) depend on test stubs that the helpers below will remove. |
DestroyBrowserAndProfile(); |
+ if (content::IsBrowserSideNavigationEnabled()) |
+ content::BrowserSideNavigationTearDown(); |
+ |
#if defined(TOOLKIT_VIEWS) |
constrained_window::SetConstrainedWindowViewsClient(nullptr); |
#endif |
@@ -128,15 +136,12 @@ void BrowserWithTestWindowTest::CommitPendingLoad( |
return; // Nothing to commit. |
RenderFrameHost* old_rfh = controller->GetWebContents()->GetMainFrame(); |
+ RenderFrameHostTester* old_rfh_tester = RenderFrameHostTester::For(old_rfh); |
+ old_rfh_tester->SimulateUnloading(); |
RenderFrameHost* pending_rfh = RenderFrameHostTester::GetPendingForController( |
controller); |
- if (pending_rfh) { |
- // Simulate the BeforeUnload_ACK that is received from the current renderer |
- // for a cross-site navigation. |
- DCHECK_NE(old_rfh, pending_rfh); |
- RenderFrameHostTester::For(old_rfh)->SendBeforeUnloadACK(true); |
- } |
+ |
// Commit on the pending_rfh, if one exists. |
RenderFrameHost* test_rfh = pending_rfh ? pending_rfh : old_rfh; |
RenderFrameHostTester* test_rfh_tester = RenderFrameHostTester::For(test_rfh); |