Chromium Code Reviews| Index: chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc |
| diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc |
| index f41ae2451cf1b39caea98dae5ff34614518d398e..03f79b8a6c6d59f8cedcd046302889e4c79f758b 100644 |
| --- a/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc |
| +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc |
| @@ -13,7 +13,10 @@ |
| #include "chrome/app/chrome_command_ids.h" |
| #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" |
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| +#include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" |
| +#include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" |
| #include "chrome/test/base/testing_profile.h" |
| #include "components/prefs/pref_service.h" |
| #include "ui/aura/window_event_dispatcher.h" |
| @@ -42,9 +45,21 @@ class LauncherContextMenuTest : public ash::test::AshTestBase { |
| item.id = 1; // dummy id |
| item.type = shelf_item_type; |
| ash::Shelf* shelf = ash::Shelf::ForWindow(CurrentContext()); |
| - return new LauncherContextMenu(controller_.get(), &item, shelf); |
| + return LauncherContextMenu::Create(controller_.get(), &item, shelf); |
| } |
| + LauncherContextMenu* CreateLauncherContextMenuForDesktopShell() { |
| + ash::ShelfItem* item = nullptr; |
| + ash::Shelf* shelf = ash::Shelf::ForWindow(CurrentContext()); |
| + return LauncherContextMenu::Create(controller_.get(), item, shelf); |
| + } |
| + |
| + LauncherContextMenu* CreateLauncherContextMenuForArcApp() { |
|
khmel
2016/03/30 00:58:46
This must be under
#if defined(OS_CHROMEOS)
#end
lgcheng
2016/03/30 02:06:25
Done.
|
| + ash::ShelfItem item; |
| + item.id = 1; |
| + ash::Shelf* shelf = ash::Shelf::ForWindow(CurrentContext()); |
| + return new ArcLauncherContextMenu(controller_.get(), &item, shelf); |
| + } |
| Profile* profile() { return profile_.get(); } |
| private: |
| @@ -97,3 +112,50 @@ TEST_F(LauncherContextMenuTest, |
| menu.get(), LauncherContextMenu::MENU_NEW_WINDOW)); |
| EXPECT_FALSE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW)); |
| } |
| + |
| +// Verifies status of contextmenu items for desktop shell. |
| +TEST_F(LauncherContextMenuTest, DesktopShellLauncherContextMenuItemCheck) { |
| + scoped_ptr<LauncherContextMenu> menu( |
| + CreateLauncherContextMenuForDesktopShell()); |
| + EXPECT_FALSE( |
| + IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); |
| + EXPECT_FALSE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN)); |
| + EXPECT_TRUE( |
| + IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_AUTO_HIDE)); |
| + EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_AUTO_HIDE)); |
| + EXPECT_TRUE(IsItemPresentInMenu(menu.get(), |
| + LauncherContextMenu::MENU_ALIGNMENT_MENU)); |
| + EXPECT_TRUE( |
| + menu->IsCommandIdEnabled(LauncherContextMenu::MENU_ALIGNMENT_MENU)); |
| +#if defined(OS_CHROMEOS) |
| + // By default, screen is not locked and ChangeWallPaper item is added in |
| + // menu. ChangeWallPaper item is not enabled in default mode. |
| + EXPECT_TRUE(IsItemPresentInMenu(menu.get(), |
| + LauncherContextMenu::MENU_CHANGE_WALLPAPER)); |
| + EXPECT_FALSE( |
| + menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CHANGE_WALLPAPER)); |
| +#endif |
| +} |
| + |
| +// Verifies contextmenu items for Arc app |
| +TEST_F(LauncherContextMenuTest, ArcLauncherContextMenuItemCheck) { |
| +#if defined(OS_CHROMEOS) |
|
khmel
2016/03/30 00:58:46
Whole test must be under
#if defined(OS_CHROMEOS)
lgcheng
2016/03/30 02:06:25
Done.
|
| + scoped_ptr<LauncherContextMenu> menu(CreateLauncherContextMenuForArcApp()); |
| + EXPECT_TRUE( |
| + IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); |
| + EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_OPEN_NEW)); |
| + EXPECT_TRUE( |
| + IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_AUTO_HIDE)); |
| + EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_AUTO_HIDE)); |
| + EXPECT_TRUE(IsItemPresentInMenu(menu.get(), |
| + LauncherContextMenu::MENU_ALIGNMENT_MENU)); |
| + EXPECT_TRUE( |
| + menu->IsCommandIdEnabled(LauncherContextMenu::MENU_ALIGNMENT_MENU)); |
| + // By default, screen is not locked and ChangeWallPaper item is added in |
| + // menu. ChangeWallPaper item is not enabled in default mode. |
| + EXPECT_TRUE(IsItemPresentInMenu(menu.get(), |
| + LauncherContextMenu::MENU_CHANGE_WALLPAPER)); |
| + EXPECT_FALSE( |
| + menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CHANGE_WALLPAPER)); |
| +#endif |
| +} |