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

Unified Diff: chrome/browser/android/preferences/important_sites_util_unittest.cc

Issue 1465363002: [Storage] Android - ManageSpace UI, Important Origins, and CBD Dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
Index: chrome/browser/android/preferences/important_sites_util_unittest.cc
diff --git a/chrome/browser/android/preferences/important_sites_util_unittest.cc b/chrome/browser/android/preferences/important_sites_util_unittest.cc
index f2be975fceb199f80dfb6d13c5946e7ea1022244..1e5f823249a95753b88d952c698b45f4773c32f3 100644
--- a/chrome/browser/android/preferences/important_sites_util_unittest.cc
+++ b/chrome/browser/android/preferences/important_sites_util_unittest.cc
@@ -71,7 +71,7 @@ class ImportantSitesUtilTest : public ChromeRenderViewHostTestHarness {
TEST_F(ImportantSitesUtilTest, TestNoImportantSites) {
EXPECT_TRUE(ImportantSitesUtil::GetImportantRegisterableDomains(
- profile(), kNumImportantSites)
+ profile(), kNumImportantSites, nullptr)
.empty());
}
@@ -101,9 +101,13 @@ TEST_F(ImportantSitesUtilTest, NotificationsThenEngagement) {
// 3: sorted by the score.
std::vector<std::string> expected_sorted_domains = {
"foo.bar", "example.com", "chrome.com", "google.com"};
+ std::vector<GURL> example_origins;
EXPECT_THAT(ImportantSitesUtil::GetImportantRegisterableDomains(
- profile(), kNumImportantSites),
+ profile(), kNumImportantSites, &example_origins),
::testing::ElementsAreArray(expected_sorted_domains));
+ std::vector<GURL> expected_sorted_origins = {url7, url5, url4, url3};
+ EXPECT_THAT(example_origins,
+ ::testing::ElementsAreArray(expected_sorted_origins));
// Test that notifications get moved to the front.
AddContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_ALLOW,
@@ -116,7 +120,25 @@ TEST_F(ImportantSitesUtilTest, NotificationsThenEngagement) {
// Same as above, but the site with notifications should be at the front.
expected_sorted_domains = {"youtube.com", "foo.bar", "example.com",
"chrome.com", "google.com"};
+ example_origins.clear();
EXPECT_THAT(ImportantSitesUtil::GetImportantRegisterableDomains(
- profile(), kNumImportantSites),
+ profile(), kNumImportantSites, &example_origins),
+ ::testing::ElementsAreArray(expected_sorted_domains));
+ expected_sorted_origins = {url6, url7, url5, url4, url3};
+ EXPECT_THAT(example_origins,
+ ::testing::ElementsAreArray(expected_sorted_origins));
+}
+
+TEST_F(ImportantSitesUtilTest, TestNoOriginPopulation) {
+ SiteEngagementService* service = SiteEngagementService::Get(profile());
+ ASSERT_TRUE(service);
+
+ GURL url1("http://www.google.com/");
+
+ service->ResetScoreForURL(url1, 5);
+
+ std::vector<std::string> expected_sorted_domains = {"google.com"};
+ EXPECT_THAT(ImportantSitesUtil::GetImportantRegisterableDomains(
+ profile(), kNumImportantSites, nullptr),
::testing::ElementsAreArray(expected_sorted_domains));
}
« no previous file with comments | « chrome/browser/android/preferences/important_sites_util.cc ('k') | chrome/browser/android/preferences/pref_service_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698