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

Side by Side Diff: ash/launcher/launcher_model_unittest.cc

Issue 10905201: Move app list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review issues Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/launcher/launcher_model.cc ('k') | ash/launcher/launcher_navigator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Assertions around where items are added. 133 // Assertions around where items are added.
134 TEST(LauncherModel, AddIndices) { 134 TEST(LauncherModel, AddIndices) {
135 TestLauncherModelObserver observer; 135 TestLauncherModelObserver observer;
136 LauncherModel model; 136 LauncherModel model;
137 137
138 // Model is initially populated with two items. 138 // Model is initially populated with two items.
139 EXPECT_EQ(2, model.item_count()); 139 EXPECT_EQ(2, model.item_count());
140 // Two initial items should have different ids. 140 // Two initial items should have different ids.
141 EXPECT_NE(model.items()[0].id, model.items()[1].id); 141 EXPECT_NE(model.items()[0].id, model.items()[1].id);
142 142
143 // Items come after the browser.
144 int browser = 1;
145 ASSERT_EQ(ash::TYPE_BROWSER_SHORTCUT, model.items()[browser].type);
146
143 // Tabbed items should be after shortcut. 147 // Tabbed items should be after shortcut.
144 LauncherItem item; 148 LauncherItem item;
145 int tabbed_index1 = model.Add(item); 149 int tabbed_index1 = model.Add(item);
146 EXPECT_EQ(1, tabbed_index1); 150 EXPECT_EQ(browser + 1, tabbed_index1);
147 151
148 // Add another tabbed item, it should follow first. 152 // Add another tabbed item, it should follow first.
149 int tabbed_index2 = model.Add(item); 153 int tabbed_index2 = model.Add(item);
150 EXPECT_EQ(2, tabbed_index2); 154 EXPECT_EQ(browser + 2, tabbed_index2);
151 155
152 // APP_SHORTCUT preceed browsers. 156 // APP_SHORTCUT preceed browsers.
153 item.type = TYPE_APP_SHORTCUT; 157 item.type = TYPE_APP_SHORTCUT;
154 int app_shortcut_index1 = model.Add(item); 158 int app_shortcut_index1 = model.Add(item);
155 EXPECT_EQ(1, app_shortcut_index1); 159 EXPECT_EQ(browser + 1, app_shortcut_index1);
156 160
157 item.type = TYPE_APP_SHORTCUT; 161 item.type = TYPE_APP_SHORTCUT;
158 int app_shortcut_index2 = model.Add(item); 162 int app_shortcut_index2 = model.Add(item);
159 EXPECT_EQ(2, app_shortcut_index2); 163 EXPECT_EQ(browser + 2, app_shortcut_index2);
160 164
161 // Check that AddAt() figures out the correct indexes for app shortcuts. 165 // Check that AddAt() figures out the correct indexes for app shortcuts.
162 item.type = TYPE_APP_SHORTCUT; 166 item.type = TYPE_APP_SHORTCUT;
163 int app_shortcut_index3 = model.AddAt(0, item); 167 int app_shortcut_index3 = model.AddAt(0, item);
164 EXPECT_EQ(1, app_shortcut_index3); 168 EXPECT_EQ(browser + 1, app_shortcut_index3);
165 169
166 item.type = TYPE_APP_SHORTCUT; 170 item.type = TYPE_APP_SHORTCUT;
167 int app_shortcut_index4 = model.AddAt(5, item); 171 int app_shortcut_index4 = model.AddAt(5, item);
168 EXPECT_EQ(4, app_shortcut_index4); 172 EXPECT_EQ(browser + 4, app_shortcut_index4);
169 173
170 item.type = TYPE_APP_SHORTCUT; 174 item.type = TYPE_APP_SHORTCUT;
171 int app_shortcut_index5 = model.AddAt(2, item); 175 int app_shortcut_index5 = model.AddAt(2, item);
172 EXPECT_EQ(2, app_shortcut_index5); 176 EXPECT_EQ(browser + 1, app_shortcut_index5);
173 177
174 // 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.
175 item.type = TYPE_TABBED; 179 item.type = TYPE_TABBED;
176 int tabbed_index3 = model.AddAt(2, item); 180 int tabbed_index3 = model.AddAt(2, item);
177 EXPECT_EQ(6, tabbed_index3); 181 EXPECT_EQ(browser + 6, tabbed_index3);
178 182
179 item.type = TYPE_APP_PANEL; 183 item.type = TYPE_APP_PANEL;
180 int app_panel_index1 = model.AddAt(2, item); 184 int app_panel_index1 = model.AddAt(2, item);
181 EXPECT_EQ(6, app_panel_index1); 185 EXPECT_EQ(browser + 6, app_panel_index1);
182 186
183 item.type = TYPE_TABBED; 187 item.type = TYPE_TABBED;
184 int tabbed_index4 = model.AddAt(11, item); 188 int tabbed_index4 = model.AddAt(11, item);
185 EXPECT_EQ(10, tabbed_index4); 189 EXPECT_EQ(browser + 10, tabbed_index4);
186 190
187 item.type = TYPE_APP_PANEL; 191 item.type = TYPE_APP_PANEL;
188 int app_panel_index2 = model.AddAt(12, item); 192 int app_panel_index2 = model.AddAt(12, item);
189 EXPECT_EQ(11, app_panel_index2); 193 EXPECT_EQ(browser + 11, app_panel_index2);
190 194
191 item.type = TYPE_TABBED; 195 item.type = TYPE_TABBED;
192 int tabbed_index5 = model.AddAt(7, item); 196 int tabbed_index5 = model.AddAt(7, item);
193 EXPECT_EQ(7, tabbed_index5); 197 EXPECT_EQ(browser + 6, tabbed_index5);
194 198
195 item.type = TYPE_APP_PANEL; 199 item.type = TYPE_APP_PANEL;
196 int app_panel_index3 = model.AddAt(8, item); 200 int app_panel_index3 = model.AddAt(8, item);
197 EXPECT_EQ(8, app_panel_index3); 201 EXPECT_EQ(browser + 7, app_panel_index3);
198 202
199 // Browser shortcut and app list should still be first and last, respectively. 203 // Browser shortcut and app list should still be first and second.
200 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type); 204 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[1].type);
201 EXPECT_EQ(TYPE_APP_LIST, model.items()[model.item_count() - 1].type); 205 EXPECT_EQ(TYPE_APP_LIST, model.items()[0].type);
202 } 206 }
203 207
204 } // namespace ash 208 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_model.cc ('k') | ash/launcher/launcher_navigator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698