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

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

Issue 17673004: Insert panel icons on the left of other panel icons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix test assertions. Created 7 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 unified diff | Download patch
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 // Move the third to the second. 123 // Move the third to the second.
124 model.Move(2, 1); 124 model.Move(2, 1);
125 EXPECT_EQ("moved=1", observer.StateStringAndClear()); 125 EXPECT_EQ("moved=1", observer.StateStringAndClear());
126 126
127 // And back. 127 // And back.
128 model.Move(1, 2); 128 model.Move(1, 2);
129 EXPECT_EQ("moved=1", observer.StateStringAndClear()); 129 EXPECT_EQ("moved=1", observer.StateStringAndClear());
130 } 130 }
131 131
132 // Assertions about automatic index when adding items.
133 TEST(LauncherModel, AutomaticIndex) {
134 TestLauncherModelObserver observer;
135 LauncherModel model;
136
137 // Model is initially populated with one item.
138 EXPECT_EQ(1, model.item_count());
139
140 // Insert browser short cut at index 0.
141 LauncherItem browser_shortcut;
142 browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
143 int browser_shortcut_index = model.Add(browser_shortcut);
144 EXPECT_EQ(0, browser_shortcut_index);
145
146 // Tabbed (and any non-panel type) items are inserted at the right
147 LauncherItem item;
148 int tabbed_index1 = model.Add(item);
149 EXPECT_EQ(1, tabbed_index1);
150 int tabbed_index2 = model.Add(item);
151 EXPECT_EQ(2, tabbed_index2);
152
153 // Panel items are inserted at the left of other panels.
154 item.type = TYPE_APP_PANEL;
155 int app_panel_index1 = model.Add(item);
156 EXPECT_EQ(4, app_panel_index1);
157
158 item.type = TYPE_APP_PANEL;
159 int app_panel_index2 = model.Add(item);
160 EXPECT_EQ(4, app_panel_index2);
161 }
162
132 // Assertions around where items are added. 163 // Assertions around where items are added.
133 TEST(LauncherModel, AddIndices) { 164 TEST(LauncherModel, AddIndices) {
134 TestLauncherModelObserver observer; 165 TestLauncherModelObserver observer;
135 LauncherModel model; 166 LauncherModel model;
136 167
137 // Model is initially populated with one item. 168 // Model is initially populated with one item.
138 EXPECT_EQ(1, model.item_count()); 169 EXPECT_EQ(1, model.item_count());
139 170
140 // Insert browser short cut at index 0. 171 // Insert browser short cut at index 0.
141 LauncherItem browser_shortcut; 172 LauncherItem browser_shortcut;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Now change the type of the second item and make sure that it is moving 300 // Now change the type of the second item and make sure that it is moving
270 // behind the shortcuts. 301 // behind the shortcuts.
271 item.type = TYPE_PLATFORM_APP; 302 item.type = TYPE_PLATFORM_APP;
272 model.Set(app2_index, item); 303 model.Set(app2_index, item);
273 304
274 // The item should have moved in front of the app launcher. 305 // The item should have moved in front of the app launcher.
275 EXPECT_EQ(TYPE_PLATFORM_APP, model.items()[3].type); 306 EXPECT_EQ(TYPE_PLATFORM_APP, model.items()[3].type);
276 } 307 }
277 308
278 } // namespace ash 309 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698