Commit 3cf7f982 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

[session restore] Prevent restored windows from being completely white.

Since https://crrev.com/701411, restoring a window that was "last active"
and "minimized" when it was closed opens a window that is completely
white. This is because the window is activated but never shown.

This CL ensures that the window that gets activated when restoring a
session is also shown.

Bug: 1018885
Change-Id: I9d01bfb2cafa83df9744bf5c598570ff55252de0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1884952Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710397}
parent d54f44e9
...@@ -470,8 +470,12 @@ class SessionRestoreImpl : public BrowserListObserver { ...@@ -470,8 +470,12 @@ class SessionRestoreImpl : public BrowserListObserver {
chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker( chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker(
"SessionRestore-CreatingTabs-End", false); "SessionRestore-CreatingTabs-End", false);
#endif #endif
if (browser_to_activate) if (browser_to_activate) {
// |browser_to_activate| may be minimized. Show it before activating it to
// avoid having a window with no content. https://crbug.com/1018885
browser_to_activate->window()->Show();
browser_to_activate->window()->Activate(); browser_to_activate->window()->Activate();
}
// If last_browser is NULL and urls_to_open_ is non-empty, // If last_browser is NULL and urls_to_open_ is non-empty,
// FinishedTabCreation will create a new TabbedBrowser and add the urls to // FinishedTabCreation will create a new TabbedBrowser and add the urls to
......
...@@ -368,6 +368,23 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoredTabsShouldHaveWindow) { ...@@ -368,6 +368,23 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoredTabsShouldHaveWindow) {
} }
} }
// Verify that restoring a minimized window does not create a blank window.
// Regression test for https://crbug.com/1018885.
IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreMinimizedWindow) {
// Minimize the window.
browser()->window()->Minimize();
// Restart and session restore the tabs.
Browser* restored = QuitBrowserAndRestore(browser(), 3);
EXPECT_EQ(1, restored->tab_strip_model()->count());
// Expect the window to be visible.
// Prior to the fix for https://crbug.com/1018885, the window was active but
// not visible.
EXPECT_TRUE(restored->window()->IsActive());
EXPECT_TRUE(restored->window()->IsVisible());
}
// Verify that restored tabs have correct disposition. Only one tab should // Verify that restored tabs have correct disposition. Only one tab should
// have "visible" visibility state, the rest should not. // have "visible" visibility state, the rest should not.
// (http://crbug.com/155365 http://crbug.com/118269) // (http://crbug.com/155365 http://crbug.com/118269)
......
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