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

Unified Diff: chrome/browser/tabs/tab_strip_model_unittest.cc

Issue 10117016: Implementation for switching between recently used tabs using ctrl tilde or quoteleft. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added tab mru list manager class. Created 8 years, 7 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
Index: chrome/browser/tabs/tab_strip_model_unittest.cc
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 178fe53bcf417aa5cecd89c058ce2298b931f894..b237c26d172587a51e689eefc684075025f76fe5 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -734,6 +734,36 @@ static void InsertTabContentses(TabStripModel* tabstrip,
contents3, TabStripModel::ADD_INHERIT_GROUP);
}
+TEST_F(TabStripModelTest, TestSelectNextMRUTab) {
+ TabStripDummyDelegate delegate(NULL);
+ TabStripModel tabstrip(&delegate, profile());
+ EXPECT_TRUE(tabstrip.empty());
+
+ TabContentsWrapper* opener_contents = CreateTabContents();
+ tabstrip.AppendTabContents(opener_contents, true);
+
+ TabContentsWrapper* contents1 = CreateTabContents();
+ TabContentsWrapper* contents2 = CreateTabContents();
+ TabContentsWrapper* contents3 = CreateTabContents();
+
+ // Test LTR
+ InsertTabContentses(&tabstrip, contents1, contents2, contents3);
+ EXPECT_EQ(contents1, tabstrip.GetTabContentsAt(1));
+ EXPECT_EQ(contents2, tabstrip.GetTabContentsAt(2));
+ EXPECT_EQ(contents3, tabstrip.GetTabContentsAt(3));
+
+ EXPECT_EQ(0, tabstrip.active_index());
+ tabstrip.ActivateTabAt(1, true);
+ EXPECT_EQ(1, tabstrip.active_index());
+
+ // Next MRU Tab is tab from where we switched to tab 1 i.e tab 2
+ tabstrip.SelectNextMRUTab();
+ EXPECT_EQ(0, tabstrip.active_index());
+
+ tabstrip.CloseAllTabs();
+ EXPECT_TRUE(tabstrip.empty());
+}
+
// Tests opening background tabs.
TEST_F(TabStripModelTest, TestLTRInsertionOptions) {
TabStripDummyDelegate delegate(NULL);

Powered by Google App Engine
This is Rietveld 408576698