Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2944)

Unified Diff: chrome/browser/ui/browser_browsertest.cc

Issue 2901833002: Create NavigationHandle after beforeunload with PlzNavigate. (Closed)
Patch Set: small fix from jam Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/browser_instant_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 294d095bb92b9f240e8ec832bc0d8815f184d36e..3c05a8e7542f76e61245e44845feb66466d7ec50 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -349,24 +349,6 @@ class RenderViewSizeObserver : public content::WebContentsObserver {
DISALLOW_COPY_AND_ASSIGN(RenderViewSizeObserver);
};
-// Waits for a failed commit notification.
-class FailedCommitWatcher : public content::WebContentsObserver {
-public:
- explicit FailedCommitWatcher(content::WebContents* wc)
- : content::WebContentsObserver(wc) {}
- void Wait() {
- run_loop_.Run();
- }
-
- private:
- void DidFinishNavigation(
- content::NavigationHandle* navigation_handle) override {
- CHECK(!navigation_handle->HasCommitted());
- run_loop_.Quit();
- }
- base::RunLoop run_loop_;
-};
-
} // namespace
class BrowserTest : public ExtensionBrowserTest {
@@ -728,10 +710,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
- FailedCommitWatcher watcher(contents);
alert->CloseModalDialog();
- if (content::IsBrowserSideNavigationEnabled())
- watcher.Wait();
EXPECT_FALSE(contents->IsLoading());
// Clear the beforeunload handler so the test can easily exit.
@@ -888,10 +867,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) {
// Cancel the dialog.
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
- FailedCommitWatcher watcher(contents);
alert->CloseModalDialog();
- if (content::IsBrowserSideNavigationEnabled())
- watcher.Wait();
EXPECT_FALSE(contents->IsLoading());
// Verify there are no pending history items after the dialog is cancelled.
@@ -952,11 +928,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, BeforeUnloadVsBeforeReload) {
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
EXPECT_TRUE(static_cast<JavaScriptAppModalDialog*>(alert)->is_reload());
- // Cancel the reload.
- FailedCommitWatcher watcher(contents);
- alert->native_dialog()->CancelAppModalDialog();
- if (content::IsBrowserSideNavigationEnabled())
- watcher.Wait();
+ // Proceed with the reload.
+ alert->native_dialog()->AcceptAppModalDialog();
+ EXPECT_TRUE(content::WaitForLoadStop(contents));
+
+ content::PrepContentsForBeforeUnloadTest(contents);
// Navigate to another url, and check that we get a "before unload" dialog.
GURL url2(url::kAboutBlankURL);
« no previous file with comments | « no previous file | chrome/browser/ui/browser_instant_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698