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

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: fix 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
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_context_menu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2db8878ad283038ad32be7f70b822fab5f3c8f3e 100644
--- a/chrome/browser/ui/app_list/app_context_menu_unittest.cc
+++ b/chrome/browser/ui/app_list/app_context_menu_unittest.cc
@@ -357,12 +357,12 @@ TEST_F(AppContextMenuTest, ArcMenu) {
ASSERT_EQ(3, 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_TRUE(menu->IsEnabledAt(0));
+ EXPECT_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_TRUE(menu->IsEnabledAt(2));
+ EXPECT_FALSE(menu->IsItemCheckedAt(2));
// Test activate request.
EXPECT_EQ(0u, arc_test.app_instance()->launch_requests().size());
@@ -373,7 +373,7 @@ TEST_F(AppContextMenuTest, ArcMenu) {
const ScopedVector<arc::FakeAppInstance::Request>& launch_requests =
arc_test.app_instance()->launch_requests();
ASSERT_EQ(1u, launch_requests.size());
- EXPECT_EQ(true, launch_requests[0]->IsForApp(app_info));
+ EXPECT_TRUE(launch_requests[0]->IsForApp(app_info));
arc_test.app_instance()->RefreshAppList();
arc_test.app_instance()->SendRefreshAppList(std::vector<arc::AppInfo>());
@@ -382,11 +382,65 @@ TEST_F(AppContextMenuTest, ArcMenu) {
EXPECT_EQ(item.GetContextMenuModel(), menu);
ASSERT_EQ(3, menu->GetItemCount());
EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
- EXPECT_EQ(false, menu->IsEnabledAt(0));
- EXPECT_EQ(false, menu->IsItemCheckedAt(0));
+ EXPECT_FALSE(menu->IsEnabledAt(0));
+ EXPECT_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_TRUE(menu->IsEnabledAt(2));
+ EXPECT_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));
+ EXPECT_TRUE(menu->IsEnabledAt(0));
+ EXPECT_FALSE(menu->IsItemCheckedAt(0));
+ EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
+ EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
+ EXPECT_TRUE(menu->IsEnabledAt(2));
+ EXPECT_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_TRUE(menu->IsEnabledAt(0));
+ EXPECT_FALSE(menu->IsItemCheckedAt(0));
+ EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
+ EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
+ EXPECT_TRUE(menu->IsEnabledAt(2));
+ EXPECT_FALSE(menu->IsItemCheckedAt(2));
+ EXPECT_EQ(-1, menu->GetCommandIdAt(3)); // separator
+ EXPECT_EQ(app_list::AppContextMenu::UNINSTALL, menu->GetCommandIdAt(4));
+ EXPECT_TRUE(menu->IsEnabledAt(4));
+ EXPECT_FALSE(menu->IsItemCheckedAt(4));
+ }
}
#endif
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_context_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698