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