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 e6c39a5a0eb43bb7625b4a3aae0e25f066f83eaf..143756a700212d5a6c117964b97a905bd497be3e 100644 |
--- a/chrome/browser/engagement/site_engagement_service_unittest.cc |
+++ b/chrome/browser/engagement/site_engagement_service_unittest.cc |
@@ -1835,3 +1835,33 @@ TEST_F(SiteEngagementServiceTest, GetScoreFromSettings) { |
EXPECT_EQ(3, CheckScoreFromSettingsOnThread(content::BrowserThread::IO, |
incognito_settings_map, url2)); |
} |
+ |
+TEST_F(SiteEngagementServiceTest, GetAllDetailsIncludesBonusOnlyScores) { |
+ GURL url1("http://www.google.com/"); |
+ GURL url2("https://www.google.com/"); |
+ GURL url3("https://drive.google.com/"); |
+ |
+ std::vector<mojom::SiteEngagementDetails> details = service_->GetAllDetails(); |
+ EXPECT_EQ(0u, details.size()); |
+ |
+ // Add a single site score via explicitly resetting the engagement score. |
+ service_->ResetBaseScoreForURL(url1, 5); |
+ |
+ // Add a second site indirectly, via notifications permissions. |
+ HostContentSettingsMap* settings_map = |
+ HostContentSettingsMapFactory::GetForProfile(profile()); |
+ settings_map->SetContentSettingDefaultScope( |
+ url2, url2, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string(), |
dominickn
2017/04/10 04:49:26
Nit: this second url2 should be GURL(). Notificati
Wez
2017/04/10 21:18:09
This was actually cribbed from the tests above. :P
|
+ CONTENT_SETTING_ALLOW); |
+ |
+ // Add a third site with notifications permission explicitly denied, to verify |
+ // that it is not included. |
+ settings_map->SetContentSettingDefaultScope( |
+ url3, url3, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string(), |
dominickn
2017/04/10 04:49:26
Ditto
Wez
2017/04/10 21:18:09
Done.
|
+ CONTENT_SETTING_BLOCK); |
+ |
+ // Verify that the URLs with engagement, and with notifications permission |
+ // boosted engagement total, are included. |
+ details = service_->GetAllDetails(); |
+ EXPECT_EQ(2u, details.size()); |
+} |