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

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

Issue 10905201: Move app list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra nl 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
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_navigator.h" 5 #include "ash/launcher/launcher_navigator.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/launcher/launcher_model.h" 8 #include "ash/launcher/launcher_model.h"
9 #include "ash/launcher/launcher_types.h" 9 #include "ash/launcher/launcher_types.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 }; 53 };
54 54
55 } // namespace 55 } // namespace
56 56
57 TEST_F(LauncherNavigatorTest, BasicCycle) { 57 TEST_F(LauncherNavigatorTest, BasicCycle) {
58 // An app shortcut and three windows 58 // An app shortcut and three windows
59 LauncherItemType types[] = { 59 LauncherItemType types[] = {
60 TYPE_APP_SHORTCUT, TYPE_TABBED, TYPE_TABBED, TYPE_TABBED, 60 TYPE_APP_SHORTCUT, TYPE_TABBED, TYPE_TABBED, TYPE_TABBED,
61 }; 61 };
62 // LauncherModel automatically adds BROWSER_SHORTCUT item at the 62 // LauncherModel automatically adds BROWSER_SHORTCUT item at the
63 // beginning, so '2' refers the first TYPE_TABBED item. 63 // beginning, so '2' refers the first TYPE_TABBED item.
Mattias Nissler (ping if slow) 2012/09/11 08:42:30 comment stale.
DaveMoore 2012/09/11 17:07:00 Done.
64 SetupMockLauncherModel(types, arraysize(types), 2); 64 SetupMockLauncherModel(types, arraysize(types), 3);
65 65
66 EXPECT_EQ(3, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); 66 EXPECT_EQ(4, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
67 67
68 // Fourth one. It will skip the APP_SHORTCUT at the beginning of the list and 68 // Fourth one. It will skip the APP_SHORTCUT at the beginning of the list and
69 // the APP_LIST item which is automatically added at the end of items. 69 // the APP_LIST item which is automatically added at the end of items.
70 EXPECT_EQ(4, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD)); 70 EXPECT_EQ(5, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
71 } 71 }
72 72
73 TEST_F(LauncherNavigatorTest, WrapToBeginning) { 73 TEST_F(LauncherNavigatorTest, WrapToBeginning) {
74 LauncherItemType types[] = { 74 LauncherItemType types[] = {
75 TYPE_APP_SHORTCUT, TYPE_TABBED, TYPE_TABBED, TYPE_TABBED, 75 TYPE_APP_SHORTCUT, TYPE_TABBED, TYPE_TABBED, TYPE_TABBED,
76 }; 76 };
77 SetupMockLauncherModel(types, arraysize(types), 4); 77 SetupMockLauncherModel(types, arraysize(types), 5);
78 78
79 // Second one. It skips the APP_LIST item at the end of the list, 79 // Second one. It starts a the end, wraps to the beginning, and skips
Mattias Nissler (ping if slow) 2012/09/11 08:42:30 s/a/at/
DaveMoore 2012/09/11 17:07:00 Done.
80 // wraps to the beginning, and skips BROWSER_SHORTCUT and APP_SHORTCUT 80 // APP_LIST, BROWSER_SHORTCUT and APP_SHORTCUT at the beginning of the list.
81 // at the beginning of the list. 81 EXPECT_EQ(3, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
82 EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
83 } 82 }
84 83
85 TEST_F(LauncherNavigatorTest, Empty) { 84 TEST_F(LauncherNavigatorTest, Empty) {
86 SetupMockLauncherModel(NULL, 0, -1); 85 SetupMockLauncherModel(NULL, 0, -1);
87 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); 86 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
88 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD)); 87 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
89 } 88 }
90 89
91 TEST_F(LauncherNavigatorTest, SingleEntry) { 90 TEST_F(LauncherNavigatorTest, SingleEntry) {
92 LauncherItemType type = TYPE_TABBED; 91 LauncherItemType type = TYPE_TABBED;
93 SetupMockLauncherModel(&type, 1, 1); 92 SetupMockLauncherModel(&type, 1, 2);
94 93
95 // If there's only one item there and it is already active, there's no item 94 // If there's only one item there and it is already active, there's no item
96 // to be activated next. 95 // to be activated next.
97 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); 96 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
98 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD)); 97 EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
99 } 98 }
100 99
101 TEST_F(LauncherNavigatorTest, NoActive) { 100 TEST_F(LauncherNavigatorTest, NoActive) {
102 LauncherItemType types[] = { 101 LauncherItemType types[] = {
103 TYPE_TABBED, TYPE_TABBED, 102 TYPE_TABBED, TYPE_TABBED,
104 }; 103 };
105 // Special case: no items are 'STATUS_ACTIVE'. 104 // Special case: no items are 'STATUS_ACTIVE'.
106 SetupMockLauncherModel(types, arraysize(types), -1); 105 SetupMockLauncherModel(types, arraysize(types), -1);
107 106
108 // If there are no active status, pick the first running item as a fallback. 107 // If there are no active status, pick the first running item as a fallback.
109 EXPECT_EQ(1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); 108 EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
110 EXPECT_EQ(1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD)); 109 EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
111 } 110 }
112 111
113 } // namespace ash 112 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698