Commit 2a41181f authored by Qiang Xu's avatar Qiang Xu Committed by Commit Bot

Apply CloseBrowserSynchronously to tests

Changes:
CloseBrowserSynchronously is provided in InProcessBrowserTest, we
should prefer to use it.

Bug: 268984
Change-Id: I0988d31b87d77eff2d714641e8327974aaa01d53
Reviewed-on: https://chromium-review.googlesource.com/1006524
Commit-Queue: Qiang Xu <warx@google.com>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549963}
parent 260b07f1
...@@ -99,11 +99,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) { ...@@ -99,11 +99,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) {
// Close the first window. // Close the first window.
Profile* profile = browser()->profile(); Profile* profile = browser()->profile();
content::WindowedNotificationObserver observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser());
observer.Wait();
// There should only be the incognito window open now. // There should only be the incognito window open now.
ASSERT_EQ(1u, chrome::GetTotalBrowserCount()); ASSERT_EQ(1u, chrome::GetTotalBrowserCount());
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/test/histogram_tester.h" #include "base/test/histogram_tester.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -152,10 +151,7 @@ IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerTest, ...@@ -152,10 +151,7 @@ IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerTest,
ui_test_utils::NavigateToURL(incognito, ui_test_utils::NavigateToURL(incognito,
embedded_test_server()->GetURL("/test.html")); embedded_test_server()->GetURL("/test.html"));
content::WindowedNotificationObserver observer( CloseBrowserSynchronously(incognito);
chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(incognito));
incognito->window()->Close();
observer.Wait();
// Test passes if we don't crash. // Test passes if we don't crash.
} }
......
...@@ -2053,11 +2053,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, BrowserCloseAfterDownload) { ...@@ -2053,11 +2053,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, BrowserCloseAfterDownload) {
DownloadAndWait(browser(), download_url); DownloadAndWait(browser(), download_url);
content::WindowedNotificationObserver signal( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(browser()));
chrome::CloseWindow(browser());
signal.Wait();
} }
// Test to make sure the 'download' attribute in anchor tag is respected. // Test to make sure the 'download' attribute in anchor tag is respected.
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include <map> #include <map>
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/extension_util.h"
...@@ -18,7 +17,6 @@ ...@@ -18,7 +17,6 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_constants.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/api/management/management_api.h" #include "extensions/browser/api/management/management_api.h"
#include "extensions/browser/extension_dialog_auto_confirm.h" #include "extensions/browser/extension_dialog_auto_confirm.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
...@@ -224,12 +222,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { ...@@ -224,12 +222,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
ASSERT_TRUE(app_browser->is_app()); ASSERT_TRUE(app_browser->is_app());
// Close the app panel. // Close the app panel.
content::WindowedNotificationObserver signal( CloseBrowserSynchronously(app_browser);
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(app_browser));
chrome::CloseWindow(app_browser);
signal.Wait();
// Unload the extension. // Unload the extension.
UninstallExtension(app_id); UninstallExtension(app_id);
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "base/time/clock.h" #include "base/time/clock.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/notifications/notification_interactive_uitest_support.h" #include "chrome/browser/notifications/notification_interactive_uitest_support.h"
#include "chrome/browser/notifications/notification_test_util.h" #include "chrome/browser/notifications/notification_test_util.h"
...@@ -36,7 +35,6 @@ ...@@ -36,7 +35,6 @@
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
...@@ -373,14 +371,14 @@ IN_PROC_BROWSER_TEST_F( ...@@ -373,14 +371,14 @@ IN_PROC_BROWSER_TEST_F(
Browser* incognito = CreateIncognitoBrowser(); Browser* incognito = CreateIncognitoBrowser();
ui_test_utils::NavigateToURL(incognito, GetTestPageURL()); ui_test_utils::NavigateToURL(incognito, GetTestPageURL());
ASSERT_TRUE(RequestAndDenyPermission(incognito)); ASSERT_TRUE(RequestAndDenyPermission(incognito));
CloseBrowserWindow(incognito); CloseBrowserSynchronously(incognito);
incognito = CreateIncognitoBrowser(); incognito = CreateIncognitoBrowser();
ui_test_utils::NavigateToURL(incognito, GetTestPageURL()); ui_test_utils::NavigateToURL(incognito, GetTestPageURL());
ASSERT_TRUE(RequestAndAcceptPermission(incognito)); ASSERT_TRUE(RequestAndAcceptPermission(incognito));
CreateSimpleNotification(incognito, true); CreateSimpleNotification(incognito, true);
ASSERT_EQ(1, GetNotificationCount()); ASSERT_EQ(1, GetNotificationCount());
CloseBrowserWindow(incognito); CloseBrowserSynchronously(incognito);
incognito = CreateIncognitoBrowser(); incognito = CreateIncognitoBrowser();
ui_test_utils::NavigateToURL(incognito, GetTestPageURL()); ui_test_utils::NavigateToURL(incognito, GetTestPageURL());
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "chrome/browser/notifications/notification_interactive_uitest_support.h" #include "chrome/browser/notifications/notification_interactive_uitest_support.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/notifications/desktop_notification_profile_util.h" #include "chrome/browser/notifications/desktop_notification_profile_util.h"
#include "chrome/browser/permissions/permission_request_manager.h" #include "chrome/browser/permissions/permission_request_manager.h"
...@@ -138,13 +137,6 @@ int NotificationsTest::GetNotificationPopupCount() { ...@@ -138,13 +137,6 @@ int NotificationsTest::GetNotificationPopupCount() {
return message_center::MessageCenter::Get()->GetPopupNotifications().size(); return message_center::MessageCenter::Get()->GetPopupNotifications().size();
} }
void NotificationsTest::CloseBrowserWindow(Browser* browser) {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser));
browser->window()->Close();
observer.Wait();
}
void NotificationsTest::CrashTab(Browser* browser, int index) { void NotificationsTest::CrashTab(Browser* browser, int index) {
content::CrashTab(browser->tab_strip_model()->GetWebContentsAt(index)); content::CrashTab(browser->tab_strip_model()->GetWebContentsAt(index));
} }
......
...@@ -117,7 +117,6 @@ class ProfileWindowBrowserTest : public InProcessBrowserTest { ...@@ -117,7 +117,6 @@ class ProfileWindowBrowserTest : public InProcessBrowserTest {
~ProfileWindowBrowserTest() override {} ~ProfileWindowBrowserTest() override {}
Browser* OpenGuestBrowser(); Browser* OpenGuestBrowser();
void CloseBrowser(Browser* browser);
private: private:
DISALLOW_COPY_AND_ASSIGN(ProfileWindowBrowserTest); DISALLOW_COPY_AND_ASSIGN(ProfileWindowBrowserTest);
...@@ -154,14 +153,6 @@ Browser* ProfileWindowBrowserTest::OpenGuestBrowser() { ...@@ -154,14 +153,6 @@ Browser* ProfileWindowBrowserTest::OpenGuestBrowser() {
return browser; return browser;
} }
void ProfileWindowBrowserTest::CloseBrowser(Browser* browser) {
content::WindowedNotificationObserver window_close_observer(
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(browser));
browser->window()->Close();
window_close_observer.Wait();
}
IN_PROC_BROWSER_TEST_F(ProfileWindowBrowserTest, OpenGuestBrowser) { IN_PROC_BROWSER_TEST_F(ProfileWindowBrowserTest, OpenGuestBrowser) {
EXPECT_TRUE(OpenGuestBrowser()); EXPECT_TRUE(OpenGuestBrowser());
} }
...@@ -205,7 +196,7 @@ IN_PROC_BROWSER_TEST_F(ProfileWindowBrowserTest, GuestClearsCookies) { ...@@ -205,7 +196,7 @@ IN_PROC_BROWSER_TEST_F(ProfileWindowBrowserTest, GuestClearsCookies) {
cookie = content::GetCookies(guest_profile, url); cookie = content::GetCookies(guest_profile, url);
EXPECT_EQ("cookie1", cookie); EXPECT_EQ("cookie1", cookie);
CloseBrowser(guest_browser); CloseBrowserSynchronously(guest_browser);
// Closing the browser has removed the cookie. // Closing the browser has removed the cookie.
cookie = content::GetCookies(guest_profile, url); cookie = content::GetCookies(guest_profile, url);
......
...@@ -8,19 +8,14 @@ ...@@ -8,19 +8,14 @@
#include "components/sessions/core/persistent_tab_restore_service.h" #include "components/sessions/core/persistent_tab_restore_service.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h" #include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
typedef sessions::TabRestoreService::Window Window; using Window = sessions::TabRestoreService::Window;
typedef InProcessBrowserTest PersistentTabRestoreServiceBrowserTest; using PersistentTabRestoreServiceBrowserTest = InProcessBrowserTest;
IN_PROC_BROWSER_TEST_F(PersistentTabRestoreServiceBrowserTest, RestoreApp) { IN_PROC_BROWSER_TEST_F(PersistentTabRestoreServiceBrowserTest, RestoreApp) {
Profile* profile = browser()->profile(); Profile* profile = browser()->profile();
...@@ -29,11 +24,7 @@ IN_PROC_BROWSER_TEST_F(PersistentTabRestoreServiceBrowserTest, RestoreApp) { ...@@ -29,11 +24,7 @@ IN_PROC_BROWSER_TEST_F(PersistentTabRestoreServiceBrowserTest, RestoreApp) {
const char* app_name = "TestApp"; const char* app_name = "TestApp";
Browser* app_browser = CreateBrowserForApp(app_name, profile); Browser* app_browser = CreateBrowserForApp(app_name, profile);
app_browser->window()->Close(); CloseBrowserSynchronously(app_browser);
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(app_browser));
observer.Wait();
// One entry should be created. // One entry should be created.
ASSERT_EQ(1U, trs->entries().size()); ASSERT_EQ(1U, trs->entries().size());
......
...@@ -357,11 +357,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowAndTab) { ...@@ -357,11 +357,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowAndTab) {
EXPECT_EQ(2u, active_browser_list_->size()); EXPECT_EQ(2u, active_browser_list_->size());
// Close the first browser. // Close the first browser.
content::WindowedNotificationObserver observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser());
observer.Wait();
EXPECT_EQ(1u, active_browser_list_->size()); EXPECT_EQ(1u, active_browser_list_->size());
// Restore the first window. The expected_tabstrip_index (second argument) // Restore the first window. The expected_tabstrip_index (second argument)
...@@ -449,11 +445,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowBounds) { ...@@ -449,11 +445,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowBounds) {
EXPECT_EQ(bounds, bounds2); EXPECT_EQ(bounds, bounds2);
// Close the first window. // Close the first window.
content::WindowedNotificationObserver close_window_observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser());
close_window_observer.Wait();
EXPECT_EQ(1u, active_browser_list_->size()); EXPECT_EQ(1u, active_browser_list_->size());
// Check that the TabRestoreService has the contents of the closed window and // Check that the TabRestoreService has the contents of the closed window and
...@@ -502,11 +494,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabFromClosedWindowByID) { ...@@ -502,11 +494,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabFromClosedWindowByID) {
EXPECT_EQ(2u, active_browser_list_->size()); EXPECT_EQ(2u, active_browser_list_->size());
// Close the window. // Close the window.
content::WindowedNotificationObserver close_window_observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser());
close_window_observer.Wait();
EXPECT_EQ(1u, active_browser_list_->size()); EXPECT_EQ(1u, active_browser_list_->size());
// Check that the TabRestoreService has the contents of the closed window. // Check that the TabRestoreService has the contents of the closed window.
...@@ -681,11 +669,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) { ...@@ -681,11 +669,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) {
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
// Close the window. // Close the window.
content::WindowedNotificationObserver close_window_observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser());
close_window_observer.Wait();
EXPECT_EQ(window_count - 1, active_browser_list_->size()); EXPECT_EQ(window_count - 1, active_browser_list_->size());
// Restore the window. // Restore the window.
...@@ -822,11 +806,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, ...@@ -822,11 +806,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest,
AddSomeTabs(browser(), 3); AddSomeTabs(browser(), 3);
// 1st tab is about:blank added by InProcessBrowserTest. // 1st tab is about:blank added by InProcessBrowserTest.
EXPECT_EQ(4, browser()->tab_strip_model()->count()); EXPECT_EQ(4, browser()->tab_strip_model()->count());
content::WindowedNotificationObserver observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser());
observer.Wait();
SessionRestoreTestHelper helper; SessionRestoreTestHelper helper;
// Restore browser (this is what Cmd-Shift-T does on Mac). // Restore browser (this is what Cmd-Shift-T does on Mac).
...@@ -851,11 +831,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, ...@@ -851,11 +831,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest,
const int tabs_count = 4; const int tabs_count = 4;
AddSomeTabs(browser2, tabs_count - browser2->tab_strip_model()->count()); AddSomeTabs(browser2, tabs_count - browser2->tab_strip_model()->count());
EXPECT_EQ(tabs_count, browser2->tab_strip_model()->count()); EXPECT_EQ(tabs_count, browser2->tab_strip_model()->count());
content::WindowedNotificationObserver observer( CloseBrowserSynchronously(browser2);
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser2);
observer.Wait();
// Limit the number of restored tabs that are loaded. // Limit the number of restored tabs that are loaded.
TabLoader::SetMaxLoadedTabCountForTest(2); TabLoader::SetMaxLoadedTabCountForTest(2);
......
...@@ -2049,11 +2049,7 @@ IN_PROC_BROWSER_TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) { ...@@ -2049,11 +2049,7 @@ IN_PROC_BROWSER_TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) {
// running. // running.
Profile* profile = browser()->profile(); Profile* profile = browser()->profile();
EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
content::WindowedNotificationObserver observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(browser()));
chrome::CloseWindow(browser());
observer.Wait();
EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); EXPECT_EQ(0u, chrome::GetTotalBrowserCount());
ui_test_utils::BrowserAddedObserver browser_added_observer; ui_test_utils::BrowserAddedObserver browser_added_observer;
......
...@@ -55,14 +55,6 @@ void CreateTestTabs(Browser* browser) { ...@@ -55,14 +55,6 @@ void CreateTestTabs(Browser* browser) {
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
} }
void CloseBrowser(Browser* browser) {
content::WindowedNotificationObserver close_observer(
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(browser));
chrome::CloseWindow(browser);
close_observer.Wait();
}
IN_PROC_BROWSER_TEST_F(BrowserTabRestoreTest, RecentTabsMenuTabDisposition) { IN_PROC_BROWSER_TEST_F(BrowserTabRestoreTest, RecentTabsMenuTabDisposition) {
// Create tabs. // Create tabs.
CreateTestTabs(browser()); CreateTestTabs(browser());
...@@ -76,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTabRestoreTest, RecentTabsMenuTabDisposition) { ...@@ -76,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTabRestoreTest, RecentTabsMenuTabDisposition) {
EXPECT_EQ(2u, active_browser_list->size()); EXPECT_EQ(2u, active_browser_list->size());
// Close the first browser. // Close the first browser.
CloseBrowser(browser()); CloseBrowserSynchronously(browser());
EXPECT_EQ(1u, active_browser_list->size()); EXPECT_EQ(1u, active_browser_list->size());
// Restore tabs using the browser's recent tabs menu. // Restore tabs using the browser's recent tabs menu.
...@@ -127,7 +119,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTabRestoreTest, DelegateRestoreTabDisposition) { ...@@ -127,7 +119,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTabRestoreTest, DelegateRestoreTabDisposition) {
EXPECT_EQ(2u, active_browser_list->size()); EXPECT_EQ(2u, active_browser_list->size());
// Close the first browser. // Close the first browser.
CloseBrowser(browser()); CloseBrowserSynchronously(browser());
EXPECT_EQ(1u, active_browser_list->size()); EXPECT_EQ(1u, active_browser_list->size());
// Check the browser has a delegated restore service. // Check the browser has a delegated restore service.
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h" #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_action_manager.h" #include "chrome/browser/extensions/extension_action_manager.h"
...@@ -632,10 +631,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarIncognitoTest, IncognitoMode) { ...@@ -632,10 +631,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarIncognitoTest, IncognitoMode) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_FALSE(second_browser->profile()->IsOffTheRecord()); EXPECT_FALSE(second_browser->profile()->IsOffTheRecord());
content::WindowedNotificationObserver window_close_observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser()));
browser()->window()->Close();
window_close_observer.Wait();
std::vector<ToolbarActionViewController*> actions = std::vector<ToolbarActionViewController*> actions =
second_browser->window()->GetToolbarActionsBar()->GetActions(); second_browser->window()->GetToolbarActionsBar()->GetActions();
......
...@@ -183,11 +183,7 @@ class UnloadTest : public InProcessBrowserTest { ...@@ -183,11 +183,7 @@ class UnloadTest : public InProcessBrowserTest {
void LoadUrlAndQuitBrowser(const char* html_content, void LoadUrlAndQuitBrowser(const char* html_content,
const char* expected_title) { const char* expected_title) {
NavigateToDataURL(html_content, expected_title); NavigateToDataURL(html_content, expected_title);
content::WindowedNotificationObserver window_observer( CloseBrowserSynchronously(browser());
chrome::NOTIFICATION_BROWSER_CLOSED,
content::NotificationService::AllSources());
chrome::CloseWindow(browser());
window_observer.Wait();
} }
// If |accept| is true, simulates user clicking OK, otherwise simulates // If |accept| is true, simulates user clicking OK, otherwise simulates
......
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