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.FirstPanelIndex()); | |
180 | |
181 // Check that AddAt() figures out the correct indexes for tabs and panels. | 178 // Check that AddAt() figures out the correct indexes for tabs and panels. |
182 item.type = TYPE_TABBED; | 179 item.type = TYPE_TABBED; |
183 int tabbed_index3 = model.AddAt(2, item); | 180 int tabbed_index3 = model.AddAt(2, item); |
184 EXPECT_EQ(browser + 6, tabbed_index3); | 181 EXPECT_EQ(browser + 6, tabbed_index3); |
185 | 182 |
186 item.type = TYPE_APP_PANEL; | 183 item.type = TYPE_APP_PANEL; |
187 int app_panel_index1 = model.AddAt(2, item); | 184 int app_panel_index1 = model.AddAt(2, item); |
188 EXPECT_EQ(browser + 10, app_panel_index1); | 185 EXPECT_EQ(browser + 6, app_panel_index1); |
189 | 186 |
190 item.type = TYPE_TABBED; | 187 item.type = TYPE_TABBED; |
191 int tabbed_index4 = model.AddAt(11, item); | 188 int tabbed_index4 = model.AddAt(11, item); |
192 EXPECT_EQ(browser + 9, tabbed_index4); | 189 EXPECT_EQ(browser + 10, tabbed_index4); |
193 | 190 |
194 item.type = TYPE_APP_PANEL; | 191 item.type = TYPE_APP_PANEL; |
195 int app_panel_index2 = model.AddAt(15, item); | 192 int app_panel_index2 = model.AddAt(12, item); |
196 EXPECT_EQ(browser + 12, app_panel_index2); | 193 EXPECT_EQ(browser + 11, app_panel_index2); |
197 | 194 |
198 item.type = TYPE_TABBED; | 195 item.type = TYPE_TABBED; |
199 int tabbed_index5 = model.AddAt(7, item); | 196 int tabbed_index5 = model.AddAt(7, item); |
200 EXPECT_EQ(browser + 7, tabbed_index5); | 197 EXPECT_EQ(browser + 7, tabbed_index5); |
201 | 198 |
202 item.type = TYPE_APP_PANEL; | 199 item.type = TYPE_APP_PANEL; |
203 int app_panel_index3 = model.AddAt(13, item); | 200 int app_panel_index3 = model.AddAt(8, item); |
204 EXPECT_EQ(browser + 13, app_panel_index3); | 201 EXPECT_EQ(browser + 8, app_panel_index3); |
205 | |
206 // Right aligned index should be the first app panel index. | |
207 EXPECT_EQ(browser + 12, model.FirstPanelIndex()); | |
208 | 202 |
209 // Browser shortcut and app list should still be first and second. | 203 // Browser shortcut and app list should still be first and second. |
210 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type); | 204 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type); |
211 EXPECT_EQ(TYPE_APP_LIST, model.items()[model.FirstPanelIndex() - 1].type); | 205 EXPECT_EQ(TYPE_APP_LIST, model.items()[model.items().size() - 1].type); |
212 } | 206 } |
213 | 207 |
214 } // namespace ash | 208 } // namespace ash |
OLD | NEW |