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

Side by Side 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: unittest, mojo callback 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 EXPECT_EQ(item.GetContextMenuModel(), menu); 382 EXPECT_EQ(item.GetContextMenuModel(), menu);
383 ASSERT_EQ(3, menu->GetItemCount()); 383 ASSERT_EQ(3, menu->GetItemCount());
384 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0)); 384 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
385 EXPECT_EQ(false, menu->IsEnabledAt(0)); 385 EXPECT_EQ(false, menu->IsEnabledAt(0));
386 EXPECT_EQ(false, menu->IsItemCheckedAt(0)); 386 EXPECT_EQ(false, menu->IsItemCheckedAt(0));
387 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator 387 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
388 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2)); 388 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
389 EXPECT_EQ(true, menu->IsEnabledAt(2)); 389 EXPECT_EQ(true, menu->IsEnabledAt(2));
390 EXPECT_EQ(false, menu->IsItemCheckedAt(2)); 390 EXPECT_EQ(false, menu->IsItemCheckedAt(2));
391 } 391 }
392
393 TEST_F(AppContextMenuTest, ArcMenuStickyItem) {
394 ArcAppTest arc_test;
395 arc_test.SetUp(profile());
396 arc_test.bridge_service()->SetReady();
397
398 arc_test.app_instance()->RefreshAppList();
399 arc_test.app_instance()->SendRefreshAppList(arc_test.fake_apps());
400
401 {
402 // Verify menu of store
403 const arc::AppInfo& store_info = arc_test.fake_apps()[0];
404 const std::string store_id = ArcAppTest::GetAppId(store_info);
405 ArcAppItem item(profile(), nullptr, store_id, std::string(), true);
406 ui::MenuModel* menu = item.GetContextMenuModel();
407 ASSERT_NE(nullptr, menu);
408
409 ASSERT_EQ(2, menu->GetItemCount());
khmel 2016/03/07 21:11:52 I think pinnable item is missing. I would prefer t
victorhsieh0 2016/03/07 23:54:42 Done.
410 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
411 EXPECT_EQ(true, menu->IsEnabledAt(0));
412 EXPECT_EQ(false, menu->IsItemCheckedAt(0));
413 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
414 // No "uninstall" entry.
415 }
416
417 {
418 // Verify normal app menu
419 const arc::AppInfo& app_info = arc_test.fake_apps()[1];
420 const std::string app_id = ArcAppTest::GetAppId(app_info);
421 ArcAppItem item(profile(), nullptr, app_id, std::string(), true);
422 ui::MenuModel* menu = item.GetContextMenuModel();
423 ASSERT_NE(nullptr, menu);
424
425 ASSERT_EQ(3, menu->GetItemCount());
426 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
427 EXPECT_EQ(true, menu->IsEnabledAt(0));
428 EXPECT_EQ(false, menu->IsItemCheckedAt(0));
429 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
430 EXPECT_EQ(app_list::AppContextMenu::UNINSTALL, menu->GetCommandIdAt(2));
431 EXPECT_EQ(true, menu->IsEnabledAt(2));
432 EXPECT_EQ(false, menu->IsItemCheckedAt(2));
433 }
434 }
392 #endif 435 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698