| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/launcher/launcher_model.h" | 5 #include "ash/launcher/launcher_model.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher_model_observer.h" | 10 #include "ash/launcher/launcher_model_observer.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 EXPECT_EQ(browser + 1, app_shortcut_index3); | 168 EXPECT_EQ(browser + 1, app_shortcut_index3); |
| 169 | 169 |
| 170 item.type = TYPE_APP_SHORTCUT; | 170 item.type = TYPE_APP_SHORTCUT; |
| 171 int app_shortcut_index4 = model.AddAt(5, item); | 171 int app_shortcut_index4 = model.AddAt(5, item); |
| 172 EXPECT_EQ(browser + 4, app_shortcut_index4); | 172 EXPECT_EQ(browser + 4, app_shortcut_index4); |
| 173 | 173 |
| 174 item.type = TYPE_APP_SHORTCUT; | 174 item.type = TYPE_APP_SHORTCUT; |
| 175 int app_shortcut_index5 = model.AddAt(2, item); | 175 int app_shortcut_index5 = model.AddAt(2, item); |
| 176 EXPECT_EQ(browser + 2, app_shortcut_index5); | 176 EXPECT_EQ(browser + 2, app_shortcut_index5); |
| 177 | 177 |
| 178 // Before there are any panels, no icons should be right aligned. |
| 179 EXPECT_EQ(model.item_count(), model.EndAlignedIndex()); |
| 180 |
| 178 // Check that AddAt() figures out the correct indexes for tabs and panels. | 181 // Check that AddAt() figures out the correct indexes for tabs and panels. |
| 179 item.type = TYPE_TABBED; | 182 item.type = TYPE_TABBED; |
| 180 int tabbed_index3 = model.AddAt(2, item); | 183 int tabbed_index3 = model.AddAt(2, item); |
| 181 EXPECT_EQ(browser + 6, tabbed_index3); | 184 EXPECT_EQ(browser + 6, tabbed_index3); |
| 182 | 185 |
| 183 item.type = TYPE_APP_PANEL; | 186 item.type = TYPE_APP_PANEL; |
| 184 int app_panel_index1 = model.AddAt(2, item); | 187 int app_panel_index1 = model.AddAt(2, item); |
| 185 EXPECT_EQ(browser + 6, app_panel_index1); | 188 EXPECT_EQ(browser + 10, app_panel_index1); |
| 186 | 189 |
| 187 item.type = TYPE_TABBED; | 190 item.type = TYPE_TABBED; |
| 188 int tabbed_index4 = model.AddAt(11, item); | 191 int tabbed_index4 = model.AddAt(11, item); |
| 189 EXPECT_EQ(browser + 10, tabbed_index4); | 192 EXPECT_EQ(browser + 9, tabbed_index4); |
| 190 | 193 |
| 191 item.type = TYPE_APP_PANEL; | 194 item.type = TYPE_APP_PANEL; |
| 192 int app_panel_index2 = model.AddAt(12, item); | 195 int app_panel_index2 = model.AddAt(15, item); |
| 193 EXPECT_EQ(browser + 11, app_panel_index2); | 196 EXPECT_EQ(browser + 12, app_panel_index2); |
| 194 | 197 |
| 195 item.type = TYPE_TABBED; | 198 item.type = TYPE_TABBED; |
| 196 int tabbed_index5 = model.AddAt(7, item); | 199 int tabbed_index5 = model.AddAt(7, item); |
| 197 EXPECT_EQ(browser + 7, tabbed_index5); | 200 EXPECT_EQ(browser + 7, tabbed_index5); |
| 198 | 201 |
| 199 item.type = TYPE_APP_PANEL; | 202 item.type = TYPE_APP_PANEL; |
| 200 int app_panel_index3 = model.AddAt(8, item); | 203 int app_panel_index3 = model.AddAt(13, item); |
| 201 EXPECT_EQ(browser + 8, app_panel_index3); | 204 EXPECT_EQ(browser + 13, app_panel_index3); |
| 205 |
| 206 // Right aligned index should be the first app panel index. |
| 207 EXPECT_EQ(browser + 12, model.EndAlignedIndex()); |
| 202 | 208 |
| 203 // Browser shortcut and app list should still be first and second. | 209 // Browser shortcut and app list should still be first and second. |
| 204 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type); | 210 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type); |
| 205 EXPECT_EQ(TYPE_APP_LIST, model.items()[model.items().size() - 1].type); | 211 EXPECT_EQ(TYPE_APP_LIST, model.items()[model.EndAlignedIndex() - 1].type); |
| 206 } | 212 } |
| 207 | 213 |
| 208 } // namespace ash | 214 } // namespace ash |
| OLD | NEW |