Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: chrome/browser/sessions/session_service_unittest.cc

Issue 329040: Take 2 at this. The only change between this and the first is to add the GetT... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/tab_restore_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_service_unittest.cc
===================================================================
--- chrome/browser/sessions/session_service_unittest.cc (revision 30237)
+++ chrome/browser/sessions/session_service_unittest.cc (working copy)
@@ -397,6 +397,9 @@
// 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 @@
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/");
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/tab_restore_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698