| OLD | NEW |
| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 DesktopShellLauncherContextMenuVerifyCloseItem) { | 150 DesktopShellLauncherContextMenuVerifyCloseItem) { |
| 151 std::unique_ptr<LauncherContextMenu> menu( | 151 std::unique_ptr<LauncherContextMenu> menu( |
| 152 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT)); | 152 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT)); |
| 153 ASSERT_FALSE( | 153 ASSERT_FALSE( |
| 154 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); | 154 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Verifies contextmenu items for Arc app | 157 // Verifies contextmenu items for Arc app |
| 158 TEST_F(LauncherContextMenuTest, ArcLauncherContextMenuItemCheck) { | 158 TEST_F(LauncherContextMenuTest, ArcLauncherContextMenuItemCheck) { |
| 159 arc_test().app_instance()->RefreshAppList(); | 159 arc_test().app_instance()->RefreshAppList(); |
| 160 arc_test().app_instance()->SendRefreshAppList(arc_test().fake_apps()); | 160 arc_test().app_instance()->SendRefreshAppList( |
| 161 std::vector<arc::mojom::AppInfo>(arc_test().fake_apps().begin(), |
| 162 arc_test().fake_apps().begin() + 1)); |
| 161 const std::string app_id = ArcAppTest::GetAppId(arc_test().fake_apps()[0]); | 163 const std::string app_id = ArcAppTest::GetAppId(arc_test().fake_apps()[0]); |
| 162 | 164 |
| 163 controller()->PinAppWithID(app_id); | 165 controller()->PinAppWithID(app_id); |
| 164 | 166 |
| 165 ash::ShelfItem item; | 167 ash::ShelfItem item; |
| 166 item.id = controller()->GetShelfIDForAppID(app_id); | 168 item.id = controller()->GetShelfIDForAppID(app_id); |
| 167 ash::WmShelf* wm_shelf = GetWmShelf(); | 169 ash::WmShelf* wm_shelf = GetWmShelf(); |
| 168 | 170 |
| 169 std::unique_ptr<LauncherContextMenu> menu( | 171 std::unique_ptr<LauncherContextMenu> menu( |
| 170 new ArcLauncherContextMenu(controller(), &item, wm_shelf)); | 172 new ArcLauncherContextMenu(controller(), &item, wm_shelf)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 195 // Arc app is running. | 197 // Arc app is running. |
| 196 arc_test().app_instance()->SendTaskCreated(1, arc_test().fake_apps()[0]); | 198 arc_test().app_instance()->SendTaskCreated(1, arc_test().fake_apps()[0]); |
| 197 menu.reset(new ArcLauncherContextMenu(controller(), &item, wm_shelf)); | 199 menu.reset(new ArcLauncherContextMenu(controller(), &item, wm_shelf)); |
| 198 | 200 |
| 199 EXPECT_FALSE( | 201 EXPECT_FALSE( |
| 200 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); | 202 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); |
| 201 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN)); | 203 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN)); |
| 202 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_PIN)); | 204 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_PIN)); |
| 203 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); | 205 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); |
| 204 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE)); | 206 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE)); |
| 207 |
| 208 // Arc non-launchable app is running. |
| 209 const std::string app_id2 = ArcAppTest::GetAppId(arc_test().fake_apps()[1]); |
| 210 arc_test().app_instance()->SendTaskCreated(2, arc_test().fake_apps()[1]); |
| 211 item.id = controller()->GetShelfIDForAppID(app_id2); |
| 212 ASSERT_TRUE(item.id); |
| 213 menu.reset(new ArcLauncherContextMenu(controller(), &item, wm_shelf)); |
| 214 |
| 215 EXPECT_FALSE( |
| 216 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); |
| 217 EXPECT_FALSE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN)); |
| 218 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); |
| 219 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE)); |
| 205 } | 220 } |
| OLD | NEW |