diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 22:45:39 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 22:45:39 +0000 |
commit | d8375fdbe8d32ad3562152ecd53378383e393971 (patch) | |
tree | 8c8f3e524fb5e600095368e982e5730916259453 /chrome/browser/tab_restore_uitest.cc | |
parent | ec9f22cd4e7151ab3c3eb6ba47885bd75d342ae3 (diff) | |
download | chromium_src-d8375fdbe8d32ad3562152ecd53378383e393971.zip chromium_src-d8375fdbe8d32ad3562152ecd53378383e393971.tar.gz chromium_src-d8375fdbe8d32ad3562152ecd53378383e393971.tar.bz2 |
Changes tab restore service to handle restoring closed windows as a
single unit. Sadly I've written another ui test. Lets hope it isn't
flakey. Glen is going to change the NTP to deal with this appropriately.
BUG=4686
TEST=Try closing a window (with more than one window open), hitting
control-shift-t, and make sure the window and all it's tabs comes
back.
Review URL: http://codereview.chromium.org/11377
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6003 0039d316-1c4b-4281-b951-d872f2087c98
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_); +} |