OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "chrome/browser/tabs/tab_strip_selection_model.h" | 9 #include "chrome/browser/tabs/tab_strip_selection_model.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 TEST_F(TabStripSelectionModelTest, AddSelectionFromAnchorTo) { | 166 TEST_F(TabStripSelectionModelTest, AddSelectionFromAnchorTo) { |
167 TabStripSelectionModel model; | 167 TabStripSelectionModel model; |
168 model.SetSelectedIndex(2); | 168 model.SetSelectedIndex(2); |
169 | 169 |
170 model.AddSelectionFromAnchorTo(4); | 170 model.AddSelectionFromAnchorTo(4); |
171 EXPECT_EQ("active=4 anchor=2 selection=2 3 4", StateAsString(model)); | 171 EXPECT_EQ("active=4 anchor=2 selection=2 3 4", StateAsString(model)); |
172 | 172 |
173 model.AddSelectionFromAnchorTo(0); | 173 model.AddSelectionFromAnchorTo(0); |
174 EXPECT_EQ("active=0 anchor=2 selection=0 1 2 3 4", StateAsString(model)); | 174 EXPECT_EQ("active=0 anchor=2 selection=0 1 2 3 4", StateAsString(model)); |
175 } | 175 } |
| 176 |
| 177 TEST_F(TabStripSelectionModelTest, Equals) { |
| 178 TabStripSelectionModel model1; |
| 179 model1.SetSelectedIndex(0); |
| 180 model1.AddSelectionFromAnchorTo(4); |
| 181 |
| 182 TabStripSelectionModel model2; |
| 183 model2.SetSelectedIndex(0); |
| 184 model2.AddSelectionFromAnchorTo(4); |
| 185 |
| 186 EXPECT_TRUE(model1.Equals(model2)); |
| 187 EXPECT_TRUE(model2.Equals(model1)); |
| 188 |
| 189 model2.SetSelectedIndex(0); |
| 190 EXPECT_FALSE(model1.Equals(model2)); |
| 191 EXPECT_FALSE(model2.Equals(model1)); |
| 192 } |
OLD | NEW |