OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/lifetime/browser_close_manager.h" | 5 #include "chrome/browser/lifetime/browser_close_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 chrome::IncrementKeepAliveCount(); | 983 chrome::IncrementKeepAliveCount(); |
984 chrome::CloseAllBrowsers(); | 984 chrome::CloseAllBrowsers(); |
985 close_observer.Wait(); | 985 close_observer.Wait(); |
986 } | 986 } |
987 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 987 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
988 EXPECT_TRUE(BrowserList::GetInstance()->empty()); | 988 EXPECT_TRUE(BrowserList::GetInstance()->empty()); |
989 EXPECT_TRUE(IsBackgroundModeSuspended()); | 989 EXPECT_TRUE(IsBackgroundModeSuspended()); |
990 | 990 |
991 // Background mode should be resumed when a new browser window is opened. | 991 // Background mode should be resumed when a new browser window is opened. |
992 ui_test_utils::BrowserAddedObserver new_browser_observer; | 992 ui_test_utils::BrowserAddedObserver new_browser_observer; |
993 chrome::NewEmptyWindow(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); | 993 chrome::NewEmptyWindow(profile); |
994 new_browser_observer.WaitForSingleNewBrowser(); | 994 new_browser_observer.WaitForSingleNewBrowser(); |
995 chrome::DecrementKeepAliveCount(); | 995 chrome::DecrementKeepAliveCount(); |
996 EXPECT_FALSE(IsBackgroundModeSuspended()); | 996 EXPECT_FALSE(IsBackgroundModeSuspended()); |
997 RepeatedNotificationObserver close_observer( | 997 RepeatedNotificationObserver close_observer( |
998 chrome::NOTIFICATION_BROWSER_CLOSED, 1); | 998 chrome::NOTIFICATION_BROWSER_CLOSED, 1); |
999 | 999 |
1000 // Background mode should not be suspended when quitting. | 1000 // Background mode should not be suspended when quitting. |
1001 chrome::CloseAllBrowsersAndQuit(); | 1001 chrome::CloseAllBrowsersAndQuit(); |
1002 close_observer.Wait(); | 1002 close_observer.Wait(); |
1003 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); | 1003 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 | 1036 |
1037 chrome::CloseAllBrowsers(); | 1037 chrome::CloseAllBrowsers(); |
1038 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 1038 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
1039 EXPECT_TRUE(BrowserList::GetInstance()->empty()); | 1039 EXPECT_TRUE(BrowserList::GetInstance()->empty()); |
1040 EXPECT_TRUE(IsBackgroundModeSuspended()); | 1040 EXPECT_TRUE(IsBackgroundModeSuspended()); |
1041 } | 1041 } |
1042 | 1042 |
1043 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 1043 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
1044 BrowserCloseManagerWithBackgroundModeBrowserTest, | 1044 BrowserCloseManagerWithBackgroundModeBrowserTest, |
1045 testing::Bool()); | 1045 testing::Bool()); |
OLD | NEW |