Commit 5fce07b7 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Reland "Don't use NOTIFICATION_BROWSER_CLOSE_CANCELLED in tests"

This relands commit 7a5df8d5

Reverting didn't fix the test, and the test was also found to have been
flaky before the original commit.

Bug: 268984, 990692
Change-Id: I26c8c264e345e0cec6e0677e9fd28517f96d0504
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1748603
Auto-Submit: Evan Stade <estade@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687392}
parent ef65d7a9
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
...@@ -786,22 +787,21 @@ IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest, ...@@ -786,22 +787,21 @@ IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest,
DevToolsWindowTesting::Get(windows[2])->main_web_contents()); DevToolsWindowTesting::Get(windows[2])->main_web_contents());
// Try to close second devtools. // Try to close second devtools.
{ {
content::WindowedNotificationObserver cancel_browser(
chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
content::NotificationService::AllSources());
chrome::CloseWindow(DevToolsWindowTesting::Get(windows[1])->browser()); chrome::CloseWindow(DevToolsWindowTesting::Get(windows[1])->browser());
CancelModalDialog(); CancelModalDialog();
cancel_browser.Wait(); base::RunLoop().RunUntilIdle();
// The second devtools hasn't closed.
EXPECT_EQ(windows[1],
DevToolsWindow::GetInstanceForInspectedWebContents(
DevToolsWindowTesting::Get(windows[0])->main_web_contents()));
} }
// Try to close browser window. // Try to close browser window.
{ {
content::WindowedNotificationObserver cancel_browser(
chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser()); chrome::CloseWindow(browser());
AcceptModalDialog(); AcceptModalDialog();
CancelModalDialog(); CancelModalDialog();
cancel_browser.Wait(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(browser(), BrowserList::GetInstance()->get(0));
} }
// Try to exit application. // Try to exit application.
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment