diff options
Diffstat (limited to 'chrome/browser/tab_restore_uitest.cc')
-rw-r--r-- | chrome/browser/tab_restore_uitest.cc | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index 7a55257..d108d0f 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -170,7 +170,6 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { ASSERT_EQ(http_url1, GetActiveTabURL()); } - // Tests that the SiteInstances used for entries in a restored tab's history // are given appropriate max page IDs, even if the renderer for the entry // already exists. (Bug 1204135) @@ -222,3 +221,56 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { ASSERT_EQ(http_url2, GetActiveTabURL()); } +TEST_F(TabRestoreUITest, RestoreWindow) { + // Create a new window. + int window_count; + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); + ASSERT_TRUE(automation()->OpenNewBrowserWindow(SW_HIDE)); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome(++window_count, + kWaitForActionMaxMsec)); + + // Create two more tabs, one with url1, the other url2. + scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); + int initial_tab_count; + ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); + browser_proxy->AppendTab(url1_); + ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 1, + kWaitForActionMaxMsec)); + scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(initial_tab_count)); + new_tab->NavigateToURL(url1_); + browser_proxy->AppendTab(url2_); + ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 2, + kWaitForActionMaxMsec)); + new_tab.reset(browser_proxy->GetTab(initial_tab_count + 1)); + new_tab->NavigateToURL(url2_); + + // Close the window. + ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_CLOSEWINDOW)); + browser_proxy.reset(); + new_tab.reset(); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome(window_count - 1, + kWaitForActionMaxMsec)); + + // Restore the window. + browser_proxy.reset(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_RESTORE_TAB)); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome(window_count, + kWaitForActionMaxMsec)); + + browser_proxy.reset(automation()->GetBrowserWindow(1)); + ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 2, + kWaitForActionMaxMsec)); + + scoped_ptr<TabProxy> restored_tab_proxy( + browser_proxy->GetTab(initial_tab_count)); + ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); + GURL url; + ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); + ASSERT_TRUE(url == url1_); + + restored_tab_proxy.reset( + browser_proxy->GetTab(initial_tab_count + 1)); + ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); + ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); + ASSERT_TRUE(url == url2_); +} |