| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 content::RepeatedNotificationObserver close_observer( | 344 content::RepeatedNotificationObserver close_observer( |
| 345 chrome::NOTIFICATION_BROWSER_CLOSED, 1); | 345 chrome::NOTIFICATION_BROWSER_CLOSED, 1); |
| 346 chrome::CloseAllBrowsersAndQuit(); | 346 chrome::CloseAllBrowsersAndQuit(); |
| 347 close_observer.Wait(); | 347 close_observer.Wait(); |
| 348 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); | 348 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); |
| 349 EXPECT_TRUE(BrowserList::GetInstance()->empty()); | 349 EXPECT_TRUE(BrowserList::GetInstance()->empty()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 // Test that the tab closed after the aborted shutdown attempt is not re-opened | 352 // Test that the tab closed after the aborted shutdown attempt is not re-opened |
| 353 // when restoring the session. | 353 // when restoring the session. |
| 354 // Flaky on Windows trybots, see https://crbug.com/737860. |
| 355 #if defined(OS_WIN) |
| 356 #define MAYBE_TestSessionRestore DISABLED_TestSessionRestore |
| 357 #else |
| 358 #define MAYBE_TestSessionRestore TestSessionRestore |
| 359 #endif |
| 354 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest, | 360 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest, |
| 355 TestSessionRestore) { | 361 MAYBE_TestSessionRestore) { |
| 356 // The testing framework launches Chrome with about:blank as args. | 362 // The testing framework launches Chrome with about:blank as args. |
| 357 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 363 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| 358 EXPECT_EQ(GURL(chrome::kChromeUIVersionURL), | 364 EXPECT_EQ(GURL(chrome::kChromeUIVersionURL), |
| 359 browser()->tab_strip_model()->GetWebContentsAt(0)->GetURL()); | 365 browser()->tab_strip_model()->GetWebContentsAt(0)->GetURL()); |
| 360 EXPECT_EQ(GURL("about:blank"), | 366 EXPECT_EQ(GURL("about:blank"), |
| 361 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); | 367 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); |
| 362 } | 368 } |
| 363 | 369 |
| 364 // Test that browser windows are only closed if all browsers are ready to close | 370 // Test that browser windows are only closed if all browsers are ready to close |
| 365 // and that all beforeunload dialogs are shown again after a cancel. | 371 // and that all beforeunload dialogs are shown again after a cancel. |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 | 1305 |
| 1300 chrome::CloseAllBrowsers(); | 1306 chrome::CloseAllBrowsers(); |
| 1301 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 1307 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
| 1302 EXPECT_TRUE(BrowserList::GetInstance()->empty()); | 1308 EXPECT_TRUE(BrowserList::GetInstance()->empty()); |
| 1303 EXPECT_TRUE(IsBackgroundModeSuspended()); | 1309 EXPECT_TRUE(IsBackgroundModeSuspended()); |
| 1304 } | 1310 } |
| 1305 | 1311 |
| 1306 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 1312 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1307 BrowserCloseManagerWithBackgroundModeBrowserTest, | 1313 BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1308 testing::Bool()); | 1314 testing::Bool()); |
| OLD | NEW |