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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_unittest.cc

Issue 2858703002: arc: Support UNINSTALL_SHORTCUT (Closed)
Patch Set: typo fix Created 3 years, 8 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 | « chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc ('k') | components/arc/common/app.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/arc/arc_app_unittest.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
index 49be182c8ce180c9a5deb7ecc3a87480aa0045b3..3c6b346a418305033a631efa6f8f555188bffb70 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -580,11 +580,41 @@ TEST_P(ArcAppModelBuilderTest, RefreshAllFillsContent) {
ValidateHaveApps(fake_apps());
}
-TEST_P(ArcAppModelBuilderTest, InstallShortcut) {
+TEST_P(ArcAppModelBuilderTest, InstallUninstallShortcut) {
ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
- app_instance()->SendInstallShortcuts(fake_shortcuts());
- ValidateHaveShortcuts(fake_shortcuts());
+ std::vector<arc::mojom::ShortcutInfo> shortcuts = fake_shortcuts();
+ ASSERT_GE(shortcuts.size(), 2U);
+
+ // Adding package is requred to safely call SendPackageUninstalled.
+ arc::mojom::ArcPackageInfo package;
+ package.package_name = shortcuts[1].package_name;
+ package.package_version = 1;
+ package.sync = true;
+ AddPackage(package);
+ app_instance()->SendPackageAdded(package);
+
+ app_instance()->SendInstallShortcuts(shortcuts);
+ ValidateHaveShortcuts(shortcuts);
+
+ // Uninstall first shortcut and validate it was removed.
+ const std::string package_name = shortcuts[0].package_name;
+ const std::string intent_uri = shortcuts[0].intent_uri;
+ shortcuts.erase(shortcuts.begin());
+ app_instance()->SendUninstallShortcut(package_name, intent_uri);
+ ValidateHaveShortcuts(shortcuts);
+
+ // Requests to uninstall non-existing shortcuts should be just ignored.
+ EXPECT_NE(package_name, shortcuts[0].package_name);
+ EXPECT_NE(intent_uri, shortcuts[0].intent_uri);
+ app_instance()->SendUninstallShortcut(package_name, shortcuts[0].intent_uri);
+ app_instance()->SendUninstallShortcut(shortcuts[0].package_name, intent_uri);
+ ValidateHaveShortcuts(shortcuts);
+
+ // Removing package should also remove associated shortcuts.
+ app_instance()->SendPackageUninstalled(shortcuts[0].package_name);
+ shortcuts.erase(shortcuts.begin());
+ ValidateHaveShortcuts(shortcuts);
}
TEST_P(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc ('k') | components/arc/common/app.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698