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

Unified Diff: chrome/browser/engagement/site_engagement_service_unittest.cc

Issue 2293793002: Make Site Engagement behave for adding 0 points. (Closed)
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
« no previous file with comments | « chrome/browser/engagement/site_engagement_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/engagement/site_engagement_service_unittest.cc
diff --git a/chrome/browser/engagement/site_engagement_service_unittest.cc b/chrome/browser/engagement/site_engagement_service_unittest.cc
index 0a594dbf52c9db07675f18e11ae051e3ca2bdb3c..a7d2db4645e4fb92a9576f90e0e7192c0735c047 100644
--- a/chrome/browser/engagement/site_engagement_service_unittest.cc
+++ b/chrome/browser/engagement/site_engagement_service_unittest.cc
@@ -1459,9 +1459,17 @@ TEST_F(SiteEngagementServiceTest, LastEngagementTime) {
EXPECT_EQ(rebased_time, last_engagement_time);
EXPECT_EQ(rebased_time, service->GetLastEngagementTime());
- // Add some more points and ensure the value is persisted.
+ // Adding 0 points shouldn't update the last engagement time.
base::Time later_in_day = current_day + base::TimeDelta::FromSeconds(30);
clock->SetNow(later_in_day);
+ service->AddPoints(origin, 0);
+
+ last_engagement_time = base::Time::FromInternalValue(
+ profile()->GetPrefs()->GetInt64(prefs::kSiteEngagementLastUpdateTime));
+ EXPECT_EQ(rebased_time, last_engagement_time);
+ EXPECT_EQ(rebased_time, service->GetLastEngagementTime());
+
+ // Add some more points and ensure the value is persisted.
service->AddPoints(origin, 3);
last_engagement_time = base::Time::FromInternalValue(
« no previous file with comments | « chrome/browser/engagement/site_engagement_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698