Index: chrome/browser/sessions/session_restore_browsertest_chromeos.cc |
diff --git a/chrome/browser/sessions/session_restore_browsertest_chromeos.cc b/chrome/browser/sessions/session_restore_browsertest_chromeos.cc |
index c152a2732d62b02d37cf9ed6d1a89d1f0504d9f9..8ffe884da891194bcdc641f300b85fe902756910 100644 |
--- a/chrome/browser/sessions/session_restore_browsertest_chromeos.cc |
+++ b/chrome/browser/sessions/session_restore_browsertest_chromeos.cc |
@@ -18,10 +18,12 @@ |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/test/base/in_process_browser_test.h" |
+#include "chrome/test/base/test_launcher_utils.h" |
#include "components/prefs/pref_service.h" |
#include "components/sessions/core/serialized_navigation_entry_test_helper.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/test/test_utils.h" |
+#include "ui/wm/core/wm_core_switches.h" |
namespace { |
const char* test_app_popup_name1 = "TestApp1"; |
@@ -33,8 +35,16 @@ class SessionRestoreTestChromeOS : public InProcessBrowserTest { |
~SessionRestoreTestChromeOS() override {} |
protected: |
- void SetUpCommandLine(base::CommandLine* command_line) override { |
- InProcessBrowserTest::SetUpCommandLine(command_line); |
+ void SetUpDefaultCommandLine(base::CommandLine* command_line) override { |
+ base::CommandLine default_command_line(base::CommandLine::NO_PROGRAM); |
+ InProcessBrowserTest::SetUpDefaultCommandLine(&default_command_line); |
+ |
+ // Animations have caused crashes in session restore in the past but are |
+ // usually disabled in tests. Remove --wm-window-animations-disabled to |
+ // re-enable animations. |
+ test_launcher_utils::RemoveCommandLineSwitch( |
+ default_command_line, wm::switches::kWindowAnimationsDisabled, |
+ command_line); |
} |
Browser* CreateBrowserWithParams(Browser::CreateParams params) { |
@@ -161,3 +171,33 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, RestoreMaximized) { |
EXPECT_EQ(4u, total_count); |
EXPECT_EQ(2u, maximized_count); |
} |
+ |
+// Test for crash when restoring minimized windows. http://crbug.com/679513. |
+IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, PRE_RestoreMinimized) { |
+ // One browser window is always created by default. |
+ ASSERT_TRUE(browser()); |
+ browser()->window()->Minimize(); |
+ |
+ Browser* browser2 = CreateBrowserWithParams(Browser::CreateParams(profile())); |
+ browser2->window()->Minimize(); |
+ |
+ EXPECT_TRUE(browser()->window()->IsMinimized()); |
+ EXPECT_TRUE(browser2->window()->IsMinimized()); |
+ |
+ TurnOnSessionRestore(); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, RestoreMinimized) { |
+ size_t total_count = 0; |
+ size_t minimized_count = 0; |
+ for (auto* browser : *BrowserList::GetInstance()) { |
+ ++total_count; |
+ if (browser->window()->IsMinimized()) |
+ ++minimized_count; |
+ } |
+ EXPECT_EQ(2u, total_count); |
+ // Chrome OS always activates the last browser window on login, which results |
+ // in one window being restored. This seems reasonable as it reminds users |
+ // they have a browser running instead of just showing them an empty desktop. |
+ EXPECT_EQ(1u, minimized_count); |
+} |