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

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

Issue 2228663003: arc: Add package app list updated event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase2 Created 4 years, 4 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/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 8e59f4763436ee148362c9a4a6cf9d73e5267519..4468326f22c04dbea7fec3bd82d18942ae30b393 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -38,7 +38,7 @@
namespace {
-constexpr char kTestPackageName[] = "fakepackagename2";
+constexpr char kTestPackageName[] = "fake.package.name2";
class FakeAppIconLoaderDelegate : public AppIconLoaderDelegate {
public:
@@ -934,3 +934,36 @@ TEST_F(ArcAppModelBuilderTest, NonLaunchableApp) {
EXPECT_FALSE(FindArcItem(app_id));
EXPECT_TRUE(prefs->IsRegistered(app_id));
}
+
+TEST_F(ArcAppModelBuilderTest, ArcAppsOnPackageUpdated) {
+ ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
+ ASSERT_NE(nullptr, prefs);
+
+ std::vector<arc::mojom::AppInfo> apps = fake_apps();
+ ASSERT_GE(3u, apps.size());
+ apps[0].package_name = apps[2].package_name;
+ apps[1].package_name = apps[2].package_name;
+ // Second app should be preserved after update.
+ std::vector<arc::mojom::AppInfo> apps1(apps.begin(), apps.begin() + 2);
+ std::vector<arc::mojom::AppInfo> apps2(apps.begin() + 1, apps.begin() + 3);
+
+ app_instance()->RefreshAppList();
+ app_instance()->SendRefreshAppList(apps1);
+ ValidateHaveApps(apps1);
+
+ const std::string app_id = ArcAppTest::GetAppId(apps[1]);
+ const base::Time now_time = base::Time::Now();
+ prefs->SetLastLaunchTime(app_id, now_time);
+ std::unique_ptr<ArcAppListPrefs::AppInfo> app_info_before =
+ prefs->GetApp(app_id);
+ ASSERT_TRUE(app_info_before);
+ EXPECT_EQ(now_time, app_info_before->last_launch_time);
+
+ app_instance()->SendPackageAppListRefreshed(apps[0].package_name, apps2);
+ ValidateHaveApps(apps2);
+
+ std::unique_ptr<ArcAppListPrefs::AppInfo> app_info_after =
+ prefs->GetApp(app_id);
+ ASSERT_TRUE(app_info_after);
+ EXPECT_EQ(now_time, app_info_after->last_launch_time);
+}
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_test.cc ('k') | chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698