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

Unified Diff: chrome/browser/ui/app_list/app_context_menu_unittest.cc

Issue 1756193008: Support uninstalling ARC app from Chrome launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/app_context_menu_unittest.cc
diff --git a/chrome/browser/ui/app_list/app_context_menu_unittest.cc b/chrome/browser/ui/app_list/app_context_menu_unittest.cc
index cd7ea1dc8e96d43e84bf5643deb2a625bebb10e2..536450c3070f8b12e9dcfb4914750b534ea0e389 100644
--- a/chrome/browser/ui/app_list/app_context_menu_unittest.cc
+++ b/chrome/browser/ui/app_list/app_context_menu_unittest.cc
@@ -389,4 +389,58 @@ TEST_F(AppContextMenuTest, ArcMenu) {
EXPECT_EQ(true, menu->IsEnabledAt(2));
EXPECT_EQ(false, menu->IsItemCheckedAt(2));
}
+
+TEST_F(AppContextMenuTest, ArcMenuStickyItem) {
+ ArcAppTest arc_test;
+ arc_test.SetUp(profile());
+ arc_test.bridge_service()->SetReady();
+
+ arc_test.app_instance()->RefreshAppList();
+ arc_test.app_instance()->SendRefreshAppList(arc_test.fake_apps());
+
+ {
+ // Verify menu of store
+ const arc::AppInfo& store_info = arc_test.fake_apps()[0];
+ const std::string store_id = ArcAppTest::GetAppId(store_info);
+ controller()->SetAppPinnable(store_id,
+ AppListControllerDelegate::PIN_EDITABLE);
+ ArcAppItem item(profile(), nullptr, store_id, std::string(), true);
+ ui::MenuModel* menu = item.GetContextMenuModel();
+ ASSERT_NE(nullptr, menu);
+
+ ASSERT_EQ(3, menu->GetItemCount());
+ EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
khmel 2016/03/08 00:09:54 nit: I know you followed code style in this file,
victorhsieh0 2016/03/08 00:33:07 Done.
+ EXPECT_EQ(true, menu->IsEnabledAt(0));
+ EXPECT_EQ(false, menu->IsItemCheckedAt(0));
+ EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
+ EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
+ EXPECT_EQ(true, menu->IsEnabledAt(2));
+ EXPECT_EQ(false, menu->IsItemCheckedAt(2));
+ // No "uninstall" entry.
+ }
+
+ {
+ // Verify normal app menu
+ const arc::AppInfo& app_info = arc_test.fake_apps()[1];
+ const std::string app_id = ArcAppTest::GetAppId(app_info);
+ controller()->SetAppPinnable(app_id,
+ AppListControllerDelegate::PIN_EDITABLE);
+ ArcAppItem item(profile(), nullptr, app_id, std::string(), true);
+ ui::MenuModel* menu = item.GetContextMenuModel();
+ ASSERT_NE(nullptr, menu);
+
+ ASSERT_EQ(5, menu->GetItemCount());
+ EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
+ EXPECT_EQ(true, menu->IsEnabledAt(0));
+ EXPECT_EQ(false, menu->IsItemCheckedAt(0));
+ EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
+ EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
+ EXPECT_EQ(true, menu->IsEnabledAt(2));
+ EXPECT_EQ(false, menu->IsItemCheckedAt(2));
+ EXPECT_EQ(-1, menu->GetCommandIdAt(3)); // separator
+ EXPECT_EQ(app_list::AppContextMenu::UNINSTALL, menu->GetCommandIdAt(4));
+ EXPECT_EQ(true, menu->IsEnabledAt(4));
+ EXPECT_EQ(false, menu->IsItemCheckedAt(4));
+ }
+}
#endif

Powered by Google App Engine
This is Rietveld 408576698