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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc

Issue 2259033002: Revert of arc: Handle non-launchable apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ash/launcher/launcher_context_menu.h" 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
6 6
7 #include "ash/common/shelf/shelf_item_types.h" 7 #include "ash/common/shelf/shelf_item_types.h"
8 #include "ash/common/wm_root_window_controller.h" 8 #include "ash/common/wm_root_window_controller.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm_window.h" 10 #include "ash/common/wm_window.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 DesktopShellLauncherContextMenuVerifyCloseItem) { 165 DesktopShellLauncherContextMenuVerifyCloseItem) {
166 std::unique_ptr<LauncherContextMenu> menu( 166 std::unique_ptr<LauncherContextMenu> menu(
167 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT)); 167 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT));
168 ASSERT_FALSE( 168 ASSERT_FALSE(
169 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); 169 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE));
170 } 170 }
171 171
172 // Verifies contextmenu items for Arc app 172 // Verifies contextmenu items for Arc app
173 TEST_F(LauncherContextMenuTest, ArcLauncherContextMenuItemCheck) { 173 TEST_F(LauncherContextMenuTest, ArcLauncherContextMenuItemCheck) {
174 arc_test().app_instance()->RefreshAppList(); 174 arc_test().app_instance()->RefreshAppList();
175 arc_test().app_instance()->SendRefreshAppList( 175 arc_test().app_instance()->SendRefreshAppList(arc_test().fake_apps());
176 std::vector<arc::mojom::AppInfo>(arc_test().fake_apps().begin(),
177 arc_test().fake_apps().begin() + 1));
178 const std::string app_id = ArcAppTest::GetAppId(arc_test().fake_apps()[0]); 176 const std::string app_id = ArcAppTest::GetAppId(arc_test().fake_apps()[0]);
179 177
180 controller()->PinAppWithID(app_id); 178 controller()->PinAppWithID(app_id);
181 179
182 ash::ShelfItem item; 180 ash::ShelfItem item;
183 item.id = controller()->GetShelfIDForAppID(app_id); 181 item.id = controller()->GetShelfIDForAppID(app_id);
184 ash::WmShelf* wm_shelf = GetWmShelf(); 182 ash::WmShelf* wm_shelf = GetWmShelf();
185 183
186 std::unique_ptr<LauncherContextMenu> menu( 184 std::unique_ptr<LauncherContextMenu> menu(
187 new ArcLauncherContextMenu(controller(), &item, wm_shelf)); 185 new ArcLauncherContextMenu(controller(), &item, wm_shelf));
(...skipping 26 matching lines...) Expand all
214 CreateArcWindow(window_app_id1); 212 CreateArcWindow(window_app_id1);
215 arc_test().app_instance()->SendTaskCreated(1, arc_test().fake_apps()[0]); 213 arc_test().app_instance()->SendTaskCreated(1, arc_test().fake_apps()[0]);
216 menu.reset(new ArcLauncherContextMenu(controller(), &item, wm_shelf)); 214 menu.reset(new ArcLauncherContextMenu(controller(), &item, wm_shelf));
217 215
218 EXPECT_FALSE( 216 EXPECT_FALSE(
219 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); 217 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW));
220 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN)); 218 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN));
221 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_PIN)); 219 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_PIN));
222 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); 220 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE));
223 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE)); 221 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE));
224
225 // Arc non-launchable app is running.
226 const std::string app_id2 = ArcAppTest::GetAppId(arc_test().fake_apps()[1]);
227 arc_test().app_instance()->SendTaskCreated(2, arc_test().fake_apps()[1]);
228 item.id = controller()->GetShelfIDForAppID(app_id2);
229 ASSERT_TRUE(item.id);
230 menu.reset(new ArcLauncherContextMenu(controller(), &item, wm_shelf));
231
232 EXPECT_FALSE(
233 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW));
234 EXPECT_FALSE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN));
235 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE));
236 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE));
237 } 222 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc ('k') | components/arc/common/app.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698