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

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

Issue 7140001: Multi-tab: Fixing TabStripSelectionModel::SetSelectedIndex corner case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding unit tests Created 9 years, 6 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/tabs/tab_strip_selection_model.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tabs/tab_strip_selection_model_unittest.cc
diff --git a/chrome/browser/tabs/tab_strip_selection_model_unittest.cc b/chrome/browser/tabs/tab_strip_selection_model_unittest.cc
index bf1ac874b1d0b02e50a6043dce4754673e72d62f..121ef655f3d745d709eb58df02de35b703d9493b 100644
--- a/chrome/browser/tabs/tab_strip_selection_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_selection_model_unittest.cc
@@ -40,6 +40,13 @@ TEST_F(TabStripSelectionModelTest, SetSelectedIndex) {
EXPECT_FALSE(model.empty());
}
+TEST_F(TabStripSelectionModelTest, SetSelectedIndexToEmpty) {
dpapad 2011/06/08 21:19:34 Is this ok, or should it be moved within the previ
sky 2011/06/08 21:59:23 Standalone test is fine by me.
+ TabStripSelectionModel model;
+ model.SetSelectedIndex(-1);
+ EXPECT_EQ("active=-1 anchor=-1 selection=", StateAsString(model));
+ EXPECT_TRUE(model.empty());
+}
+
TEST_F(TabStripSelectionModelTest, IncrementFrom) {
TabStripSelectionModel model;
model.SetSelectedIndex(1);
@@ -99,6 +106,22 @@ TEST_F(TabStripSelectionModelTest, RemoveIndexFromSelection) {
EXPECT_EQ("active=2 anchor=2 selection=", StateAsString(model));
}
+TEST_F(TabStripSelectionModelTest, SetSelectionFromAnchorTo) {
+ TabStripSelectionModel model;
+ model.SetSelectedIndex(2);
+ model.SetSelectionFromAnchorTo(7);
+ EXPECT_EQ("active=7 anchor=2 selection=2 3 4 5 6 7", StateAsString(model));
+
+ model.Clear();
+ model.SetSelectedIndex(7);
+ model.SetSelectionFromAnchorTo(2);
+ EXPECT_EQ("active=2 anchor=7 selection=2 3 4 5 6 7", StateAsString(model));
+
+ model.Clear();
+ model.SetSelectionFromAnchorTo(7);
+ EXPECT_EQ("active=7 anchor=7 selection=7", StateAsString(model));
+}
+
TEST_F(TabStripSelectionModelTest, Clear) {
TabStripSelectionModel model;
model.SetSelectedIndex(2);
« no previous file with comments | « chrome/browser/tabs/tab_strip_selection_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698