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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "chrome/browser/background/background_mode_manager.h" | 9 #include "chrome/browser/background/background_mode_manager.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 chrome::IncrementKeepAliveCount(); | 979 chrome::IncrementKeepAliveCount(); |
980 chrome::CloseAllBrowsers(); | 980 chrome::CloseAllBrowsers(); |
981 close_observer.Wait(); | 981 close_observer.Wait(); |
982 } | 982 } |
983 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 983 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
984 EXPECT_TRUE(chrome::BrowserIterator().done()); | 984 EXPECT_TRUE(chrome::BrowserIterator().done()); |
985 EXPECT_TRUE(IsBackgroundModeSuspended()); | 985 EXPECT_TRUE(IsBackgroundModeSuspended()); |
986 | 986 |
987 // Background mode should be resumed when a new browser window is opened. | 987 // Background mode should be resumed when a new browser window is opened. |
988 ui_test_utils::BrowserAddedObserver new_browser_observer; | 988 ui_test_utils::BrowserAddedObserver new_browser_observer; |
989 chrome::NewEmptyWindow(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); | 989 chrome::NewEmptyWindow(profile, ui::HOST_DESKTOP_TYPE_NATIVE); |
990 new_browser_observer.WaitForSingleNewBrowser(); | 990 new_browser_observer.WaitForSingleNewBrowser(); |
991 chrome::DecrementKeepAliveCount(); | 991 chrome::DecrementKeepAliveCount(); |
992 EXPECT_FALSE(IsBackgroundModeSuspended()); | 992 EXPECT_FALSE(IsBackgroundModeSuspended()); |
993 RepeatedNotificationObserver close_observer( | 993 RepeatedNotificationObserver close_observer( |
994 chrome::NOTIFICATION_BROWSER_CLOSED, 1); | 994 chrome::NOTIFICATION_BROWSER_CLOSED, 1); |
995 | 995 |
996 // Background mode should not be suspended when quitting. | 996 // Background mode should not be suspended when quitting. |
997 chrome::CloseAllBrowsersAndQuit(); | 997 chrome::CloseAllBrowsersAndQuit(); |
998 close_observer.Wait(); | 998 close_observer.Wait(); |
999 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); | 999 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 | 1032 |
1033 chrome::CloseAllBrowsers(); | 1033 chrome::CloseAllBrowsers(); |
1034 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 1034 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
1035 EXPECT_TRUE(chrome::BrowserIterator().done()); | 1035 EXPECT_TRUE(chrome::BrowserIterator().done()); |
1036 EXPECT_TRUE(IsBackgroundModeSuspended()); | 1036 EXPECT_TRUE(IsBackgroundModeSuspended()); |
1037 } | 1037 } |
1038 | 1038 |
1039 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 1039 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
1040 BrowserCloseManagerWithBackgroundModeBrowserTest, | 1040 BrowserCloseManagerWithBackgroundModeBrowserTest, |
1041 testing::Bool()); | 1041 testing::Bool()); |
OLD | NEW |