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

Side by Side 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, 7 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 EXPECT_EQ(2, app_instance()->refresh_app_list_count()); 573 EXPECT_EQ(2, app_instance()->refresh_app_list_count());
574 } 574 }
575 575
576 TEST_P(ArcAppModelBuilderTest, RefreshAllFillsContent) { 576 TEST_P(ArcAppModelBuilderTest, RefreshAllFillsContent) {
577 ValidateHaveApps(std::vector<arc::mojom::AppInfo>()); 577 ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
578 app_instance()->RefreshAppList(); 578 app_instance()->RefreshAppList();
579 app_instance()->SendRefreshAppList(fake_apps()); 579 app_instance()->SendRefreshAppList(fake_apps());
580 ValidateHaveApps(fake_apps()); 580 ValidateHaveApps(fake_apps());
581 } 581 }
582 582
583 TEST_P(ArcAppModelBuilderTest, InstallShortcut) { 583 TEST_P(ArcAppModelBuilderTest, InstallUninstallShortcut) {
584 ValidateHaveApps(std::vector<arc::mojom::AppInfo>()); 584 ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
585 585
586 app_instance()->SendInstallShortcuts(fake_shortcuts()); 586 std::vector<arc::mojom::ShortcutInfo> shortcuts = fake_shortcuts();
587 ValidateHaveShortcuts(fake_shortcuts()); 587 ASSERT_GE(shortcuts.size(), 2U);
588
589 // Adding package is requred to safely call SendPackageUninstalled.
590 arc::mojom::ArcPackageInfo package;
591 package.package_name = shortcuts[1].package_name;
592 package.package_version = 1;
593 package.sync = true;
594 AddPackage(package);
595 app_instance()->SendPackageAdded(package);
596
597 app_instance()->SendInstallShortcuts(shortcuts);
598 ValidateHaveShortcuts(shortcuts);
599
600 // Uninstall first shortcut and validate it was removed.
601 const std::string package_name = shortcuts[0].package_name;
602 const std::string intent_uri = shortcuts[0].intent_uri;
603 shortcuts.erase(shortcuts.begin());
604 app_instance()->SendUninstallShortcut(package_name, intent_uri);
605 ValidateHaveShortcuts(shortcuts);
606
607 // Requests to uninstall non-existing shortcuts should be just ignored.
608 EXPECT_NE(package_name, shortcuts[0].package_name);
609 EXPECT_NE(intent_uri, shortcuts[0].intent_uri);
610 app_instance()->SendUninstallShortcut(package_name, shortcuts[0].intent_uri);
611 app_instance()->SendUninstallShortcut(shortcuts[0].package_name, intent_uri);
612 ValidateHaveShortcuts(shortcuts);
613
614 // Removing package should also remove associated shortcuts.
615 app_instance()->SendPackageUninstalled(shortcuts[0].package_name);
616 shortcuts.erase(shortcuts.begin());
617 ValidateHaveShortcuts(shortcuts);
588 } 618 }
589 619
590 TEST_P(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) { 620 TEST_P(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
591 ValidateHaveApps(std::vector<arc::mojom::AppInfo>()); 621 ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
592 app_instance()->RefreshAppList(); 622 app_instance()->RefreshAppList();
593 app_instance()->SendRefreshAppList(fake_apps()); 623 app_instance()->SendRefreshAppList(fake_apps());
594 ValidateHaveApps(fake_apps()); 624 ValidateHaveApps(fake_apps());
595 625
596 app_instance()->SendInstallShortcuts(fake_shortcuts()); 626 app_instance()->SendInstallShortcuts(fake_shortcuts());
597 ValidateHaveAppsAndShortcuts(fake_apps(), fake_shortcuts()); 627 ValidateHaveAppsAndShortcuts(fake_apps(), fake_shortcuts());
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 ::testing::ValuesIn(kUnmanagedArcStates)); 1603 ::testing::ValuesIn(kUnmanagedArcStates));
1574 INSTANTIATE_TEST_CASE_P(, 1604 INSTANTIATE_TEST_CASE_P(,
1575 ArcDefaulAppForManagedUserTest, 1605 ArcDefaulAppForManagedUserTest,
1576 ::testing::ValuesIn(kManagedArcStates)); 1606 ::testing::ValuesIn(kManagedArcStates));
1577 INSTANTIATE_TEST_CASE_P(, 1607 INSTANTIATE_TEST_CASE_P(,
1578 ArcPlayStoreAppTest, 1608 ArcPlayStoreAppTest,
1579 ::testing::ValuesIn(kUnmanagedArcStates)); 1609 ::testing::ValuesIn(kUnmanagedArcStates));
1580 INSTANTIATE_TEST_CASE_P(, 1610 INSTANTIATE_TEST_CASE_P(,
1581 ArcAppModelBuilderRecreate, 1611 ArcAppModelBuilderRecreate,
1582 ::testing::ValuesIn(kUnmanagedArcStates)); 1612 ::testing::ValuesIn(kUnmanagedArcStates));
OLDNEW
« 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