OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/app_list/app_list_service_impl.h" | 5 #include "chrome/browser/ui/app_list/app_list_service_impl.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/ui/app_list/app_list_service.h" | 10 #include "chrome/browser/ui/app_list/app_list_service.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 EXPECT_FALSE(view_delegate->profile()); | 153 EXPECT_FALSE(view_delegate->profile()); |
154 service_->ShowForProfile(browser()->profile()); | 154 service_->ShowForProfile(browser()->profile()); |
155 | 155 |
156 EXPECT_EQ(view_delegate, test_api_->view_delegate()); | 156 EXPECT_EQ(view_delegate, test_api_->view_delegate()); |
157 EXPECT_EQ(view_delegate->profile(), browser()->profile()); | 157 EXPECT_EQ(view_delegate->profile(), browser()->profile()); |
158 } | 158 } |
159 | 159 |
160 // Test that all the items in the context menu for a hosted app have valid | 160 // Test that all the items in the context menu for a hosted app have valid |
161 // labels. | 161 // labels. |
162 IN_PROC_BROWSER_TEST_F(AppListServiceImplBrowserTest, ShowContextMenu) { | 162 IN_PROC_BROWSER_TEST_F(AppListServiceImplBrowserTest, ShowContextMenu) { |
| 163 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 164 switches::kEnableNewBookmarkApps); |
163 AppListService* service = test::GetAppListService(); | 165 AppListService* service = test::GetAppListService(); |
164 EXPECT_TRUE(service); | 166 EXPECT_TRUE(service); |
165 | 167 |
166 // Show the app list to ensure it has loaded a profile. | 168 // Show the app list to ensure it has loaded a profile. |
167 service_->ShowForProfile(browser()->profile()); | 169 service_->ShowForProfile(browser()->profile()); |
168 app_list::AppListModel* model = test::GetAppListModel(service); | 170 app_list::AppListModel* model = test::GetAppListModel(service); |
169 EXPECT_TRUE(model); | 171 EXPECT_TRUE(model); |
170 | 172 |
171 // Get the webstore hosted app, which is always present. | 173 // Get the webstore hosted app, which is always present. |
172 app_list::AppListItem* item = model->FindItem(extensions::kWebStoreAppId); | 174 app_list::AppListItem* item = model->FindItem(extensions::kWebStoreAppId); |
173 EXPECT_TRUE(item); | 175 EXPECT_TRUE(item); |
174 | 176 |
175 ui::MenuModel* menu_model = item->GetContextMenuModel(); | 177 ui::MenuModel* menu_model = item->GetContextMenuModel(); |
176 EXPECT_TRUE(menu_model); | 178 EXPECT_TRUE(menu_model); |
177 | 179 |
178 int num_items = menu_model->GetItemCount(); | 180 int num_items = menu_model->GetItemCount(); |
179 EXPECT_LT(0, num_items); | 181 EXPECT_LT(0, num_items); |
180 | 182 |
181 for (int i = 0; i < num_items; i++) { | 183 for (int i = 0; i < num_items; i++) { |
182 if (menu_model->GetTypeAt(i) == ui::MenuModel::TYPE_SEPARATOR) | 184 if (menu_model->GetTypeAt(i) == ui::MenuModel::TYPE_SEPARATOR) |
183 continue; | 185 continue; |
184 | 186 |
185 base::string16 label = menu_model->GetLabelAt(i); | 187 base::string16 label = menu_model->GetLabelAt(i); |
186 EXPECT_FALSE(label.empty()); | 188 EXPECT_FALSE(label.empty()); |
187 } | 189 } |
188 } | 190 } |
OLD | NEW |