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

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

Issue 1650983002: Add an IsBootstrapped method to the SiteEngagementService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@adjust_constants
Patch Set: address comments Created 4 years, 10 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 eca0b742b12a9ba90650fd69f502f0504c19b9c8..741fcc23c29644b60c89a71c63e49dc4ca1e257e 100644
--- a/chrome/browser/engagement/site_engagement_service_unittest.cc
+++ b/chrome/browser/engagement/site_engagement_service_unittest.cc
@@ -1059,6 +1059,29 @@ TEST_F(SiteEngagementServiceTest, NavigationAccumulation) {
ui::PAGE_TRANSITION_FORM_SUBMIT);
}
+TEST_F(SiteEngagementServiceTest, IsBootstrapped) {
+ base::SimpleTestClock* clock = new base::SimpleTestClock();
+ scoped_ptr<SiteEngagementService> service(
+ new SiteEngagementService(profile(), make_scoped_ptr(clock)));
+
+ base::Time current_day = GetReferenceTime();
+ clock->SetNow(current_day);
+
+ GURL url1("https://www.google.com/");
+ GURL url2("https://www.somewhereelse.com/");
+
+ EXPECT_FALSE(service->IsBootstrapped());
+
+ service->AddPoints(url1, 5.0);
+ EXPECT_FALSE(service->IsBootstrapped());
+
+ service->AddPoints(url2, 5.0);
+ EXPECT_TRUE(service->IsBootstrapped());
+
+ clock->SetNow(current_day + base::TimeDelta::FromDays(10));
+ EXPECT_FALSE(service->IsBootstrapped());
+}
+
TEST_F(SiteEngagementServiceTest, CleanupOriginsOnHistoryDeletion) {
SiteEngagementService* engagement =
SiteEngagementServiceFactory::GetForProfile(profile());
« 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