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

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: 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 4ef89ee76a81f71aff1b3388b7fc5c747262b2ac..6279c2914269f9e3e5b581f767a575810160ac23 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -911,3 +911,36 @@ TEST_F(ArcAppModelBuilderTest, AppLauncher) {
ASSERT_EQ(2u, app_instance()->launch_requests().size());
EXPECT_TRUE(app_instance()->launch_requests()[1]->IsForApp(app2));
}
+
+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);
+}

Powered by Google App Engine
This is Rietveld 408576698