 Chromium Code Reviews
 Chromium Code Reviews Issue 2393103002:
  [Durable] Updated Durable heuristic to use 'important sites'  (Closed)
    
  
    Issue 2393103002:
  [Durable] Updated Durable heuristic to use 'important sites'  (Closed) 
  | Index: chrome/browser/engagement/important_sites_util_unittest.cc | 
| diff --git a/chrome/browser/android/preferences/important_sites_util_unittest.cc b/chrome/browser/engagement/important_sites_util_unittest.cc | 
| similarity index 91% | 
| rename from chrome/browser/android/preferences/important_sites_util_unittest.cc | 
| rename to chrome/browser/engagement/important_sites_util_unittest.cc | 
| index 09120d041c8b41b202eee3ae5635e4caf3c6cd02..4d98b3b73816793a932797add089292434c973d1 100644 | 
| --- a/chrome/browser/android/preferences/important_sites_util_unittest.cc | 
| +++ b/chrome/browser/engagement/important_sites_util_unittest.cc | 
| @@ -2,8 +2,7 @@ | 
| // Use of this source code is governed by a BSD-style license that can be | 
| // found in the LICENSE file. | 
| -#include "chrome/browser/android/preferences/important_sites_util.h" | 
| - | 
| +#include <chrome/browser/engagement/important_sites_util.h> | 
| 
michaeln
2016/10/05 23:27:45
ditto <>'s and blank line
 
dmurph
2016/10/06 01:01:59
Done.
 | 
| #include <memory> | 
| #include <utility> | 
| @@ -258,9 +257,11 @@ TEST_F(ImportantSitesUtilTest, Blacklisting) { | 
| ASSERT_EQ(1u, important_sites.size()); | 
| // Record ignore twice. | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| // Important fetch 2. | 
| important_sites = ImportantSitesUtil::GetImportantRegisterableDomains( | 
| @@ -272,7 +273,8 @@ TEST_F(ImportantSitesUtilTest, Blacklisting) { | 
| // Record ignore 3rd time. | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| // Important fetch 3. We should be blacklisted now. | 
| important_sites = ImportantSitesUtil::GetImportantRegisterableDomains( | 
| @@ -299,9 +301,11 @@ TEST_F(ImportantSitesUtilTest, BlacklistingReset) { | 
| // Record ignored twice. | 
| ASSERT_EQ(1u, important_sites.size()); | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| // Important fetch, we should still be there. | 
| important_sites = ImportantSitesUtil::GetImportantRegisterableDomains( | 
| @@ -314,13 +318,16 @@ TEST_F(ImportantSitesUtilTest, BlacklistingReset) { | 
| // Record NOT ignored. | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {"google.com"}, {important_sites[0].reason_bitfield}, {}, {}); | 
| + profile(), {"google.com"}, {important_sites[0].reason_bitfield}, | 
| + std::vector<std::string>(), std::vector<int32_t>()); | 
| // Record ignored twice again. | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| // Important fetch, we should still be there. | 
| important_sites = ImportantSitesUtil::GetImportantRegisterableDomains( | 
| @@ -330,7 +337,8 @@ TEST_F(ImportantSitesUtilTest, BlacklistingReset) { | 
| // Record ignored 3rd time in a row. | 
| ImportantSitesUtil::RecordBlacklistedAndIgnoredImportantSites( | 
| - profile(), {}, {}, {"google.com"}, {important_sites[0].reason_bitfield}); | 
| + profile(), std::vector<std::string>(), std::vector<int32_t>(), | 
| + {"google.com"}, {important_sites[0].reason_bitfield}); | 
| // Blacklisted now. | 
| important_sites = ImportantSitesUtil::GetImportantRegisterableDomains( | 
| @@ -363,12 +371,11 @@ TEST_F(ImportantSitesUtilTest, Metrics) { | 
| {important_sites[0].reason_bitfield, important_sites[1].reason_bitfield}, | 
| {"bad.com"}, {important_sites[2].reason_bitfield}); | 
| - EXPECT_THAT(histogram_tester.GetAllSamples( | 
| - "Storage.ImportantSites.CBDChosenReason"), | 
| - testing::ElementsAre( | 
| - base::Bucket(ENGAGEMENT, 1), | 
| - base::Bucket(BOOKMARKS, 1), | 
| - base::Bucket(NOTIFICATIONS, 1))); | 
| + EXPECT_THAT( | 
| + histogram_tester.GetAllSamples("Storage.ImportantSites.CBDChosenReason"), | 
| + testing::ElementsAre(base::Bucket(ENGAGEMENT, 1), | 
| + base::Bucket(BOOKMARKS, 1), | 
| + base::Bucket(NOTIFICATIONS, 1))); | 
| EXPECT_THAT( | 
| histogram_tester.GetAllSamples("Storage.ImportantSites.CBDIgnoredReason"), |