Chromium Code Reviews| Index: chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc |
| diff --git a/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc b/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc |
| index dcdf4191069bacb67f8049761ac573ce3e3e0d5b..3a3f9bd70f6916231df3f0f55533c3e289e22335 100644 |
| --- a/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc |
| +++ b/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc |
| @@ -157,9 +157,15 @@ class SiteEngagementEvictionPolicyTest : public testing::Test { |
| ~SiteEngagementEvictionPolicyTest() override {} |
| - GURL CalculateEvictionOrigin(const std::map<GURL, int64>& usage) { |
| + GURL CalculateEvictionOrigin(const std::map<GURL, int64>& usage, |
|
raymes
2015/09/22 07:16:10
nit: suggest renaming this to CalculatEvictionOrig
calamity
2015/09/23 01:55:21
Good call. Done.
|
| + const std::set<GURL>& exceptions) { |
| return SiteEngagementEvictionPolicy::CalculateEvictionOriginForTests( |
| - storage_policy_, score_provider_.get(), usage, kGlobalQuota); |
| + storage_policy_, score_provider_.get(), exceptions, usage, |
| + kGlobalQuota); |
| + } |
| + |
| + GURL CalculateEvictionOrigin(const std::map<GURL, int64>& usage) { |
| + return CalculateEvictionOrigin(usage, std::set<GURL>()); |
| } |
| TestSiteEngagementScoreProvider* score_provider() { |
| @@ -237,3 +243,22 @@ TEST_F(SiteEngagementEvictionPolicyTest, SpecialStoragePolicy) { |
| storage_policy()->AddUnlimited(url1); |
| EXPECT_EQ(GURL(), CalculateEvictionOrigin(usage)); |
| } |
| + |
| +TEST_F(SiteEngagementEvictionPolicyTest, Exceptions) { |
| + GURL url1("http://www.google.com"); |
| + GURL url2("http://www.example.com"); |
| + |
| + std::map<GURL, int64> usage; |
| + usage[url1] = 10 * 1024; |
| + usage[url2] = 10 * 1024; |
| + |
| + score_provider()->SetScore(url1, 50); |
| + score_provider()->SetScore(url2, 25); |
| + |
| + EXPECT_EQ(url2, CalculateEvictionOrigin(usage)); |
| + |
| + // The policy should respect exceptions. |
| + std::set<GURL> exceptions; |
| + exceptions.insert(url2); |
| + EXPECT_EQ(url1, CalculateEvictionOrigin(usage, exceptions)); |
| +} |