diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 15:31:13 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 15:31:13 +0000 |
commit | d05cd10167055b92abefae9dbb700b49da657491 (patch) | |
tree | 1efbf0699b42d1d22158e418d68f2c135261d0ea /chrome/browser/sessions/session_service_unittest.cc | |
parent | ef321762d036191157a3d31a6eff2884f3ff0356 (diff) | |
download | chromium_src-d05cd10167055b92abefae9dbb700b49da657491.zip chromium_src-d05cd10167055b92abefae9dbb700b49da657491.tar.gz chromium_src-d05cd10167055b92abefae9dbb700b49da657491.tar.bz2 |
Makes session restore on Chrome OS restore popups.
BUG=18862
TEST=none
Review URL: http://codereview.chromium.org/337030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions/session_service_unittest.cc')
-rw-r--r-- | chrome/browser/sessions/session_service_unittest.cc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index 19997e7..1fec7f3 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -397,6 +397,9 @@ TEST_F(SessionServiceTest, WindowCloseCommittedAfterNavigate) { // Makes sure we don't track popups. TEST_F(SessionServiceTest, IgnorePopups) { + if (browser_defaults::kRestorePopups) + return; // This test is only applicable if popups aren't restored. + SessionID window2_id; SessionID tab_id; SessionID tab2_id; @@ -431,6 +434,56 @@ TEST_F(SessionServiceTest, IgnorePopups) { helper_.AssertNavigationEquals(nav1, tab->navigations[0]); } +// Makes sure we track popups. +TEST_F(SessionServiceTest, RestorePopup) { + if (!browser_defaults::kRestorePopups) + return; // This test is only applicable if popups are restored. + + SessionID window2_id; + SessionID tab_id; + SessionID tab2_id; + ASSERT_NE(window2_id.id(), window_id.id()); + + service()->SetWindowType(window2_id, Browser::TYPE_POPUP); + service()->SetWindowBounds(window2_id, window_bounds, false); + + TabNavigation nav1(0, GURL("http://google.com"), GURL(), + ASCIIToUTF16("abc"), "def", + PageTransition::QUALIFIER_MASK); + TabNavigation nav2(0, GURL("http://google2.com"), GURL(), + ASCIIToUTF16("abcd"), "defg", + PageTransition::AUTO_BOOKMARK); + + helper_.PrepareTabInWindow(window_id, tab_id, 0, true); + UpdateNavigation(window_id, tab_id, nav1, 0, true); + + helper_.PrepareTabInWindow(window2_id, tab2_id, 0, false); + UpdateNavigation(window2_id, tab2_id, nav2, 0, true); + + ScopedVector<SessionWindow> windows; + ReadWindows(&(windows.get())); + + ASSERT_EQ(2U, windows->size()); + int normal_index = windows[0]->type == Browser::TYPE_NORMAL ? + 0 : 1; + int popup_index = normal_index == 0 ? 1 : 0; + ASSERT_EQ(0, windows[normal_index]->selected_tab_index); + ASSERT_EQ(window_id.id(), windows[normal_index]->window_id.id()); + ASSERT_EQ(1U, windows[normal_index]->tabs.size()); + + SessionTab* tab = windows[normal_index]->tabs[0]; + helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab); + helper_.AssertNavigationEquals(nav1, tab->navigations[0]); + + ASSERT_EQ(0, windows[popup_index]->selected_tab_index); + ASSERT_EQ(window2_id.id(), windows[popup_index]->window_id.id()); + ASSERT_EQ(1U, windows[popup_index]->tabs.size()); + + tab = windows[popup_index]->tabs[0]; + helper_.AssertTabEquals(window2_id, tab2_id, 0, 0, 1, *tab); + helper_.AssertNavigationEquals(nav2, tab->navigations[0]); +} + // Tests pruning from the front. TEST_F(SessionServiceTest, PruneFromFront) { const std::string base_url("http://google.com/"); |