| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/ntp_tiles/most_visited_sites.h" | 5 #include "components/ntp_tiles/most_visited_sites.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <ostream> | 10 #include <ostream> |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 class PopularSitesFactoryForTest { | 200 class PopularSitesFactoryForTest { |
| 201 public: | 201 public: |
| 202 PopularSitesFactoryForTest( | 202 PopularSitesFactoryForTest( |
| 203 bool enabled, | 203 bool enabled, |
| 204 sync_preferences::TestingPrefServiceSyncable* pref_service) | 204 sync_preferences::TestingPrefServiceSyncable* pref_service) |
| 205 : prefs_(pref_service), | 205 : prefs_(pref_service), |
| 206 url_fetcher_factory_(/*default_factory=*/nullptr), | 206 url_fetcher_factory_(/*default_factory=*/nullptr), |
| 207 url_request_context_(new net::TestURLRequestContextGetter( | 207 url_request_context_(new net::TestURLRequestContextGetter( |
| 208 base::ThreadTaskRunnerHandle::Get())), | 208 base::ThreadTaskRunnerHandle::Get())), |
| 209 worker_pool_owner_(/*max_threads=*/2, "PopularSitesFactoryForTest.") { | 209 worker_pool_owner_(/*max_threads=*/2, "PopularSitesFactoryForTest.") { |
| 210 PopularSitesImpl::RegisterProfilePrefs(pref_service->registry()); |
| 210 if (enabled) { | 211 if (enabled) { |
| 211 PopularSitesImpl::RegisterProfilePrefs(pref_service->registry()); | |
| 212 | |
| 213 prefs_->SetString(prefs::kPopularSitesOverrideCountry, "IN"); | 212 prefs_->SetString(prefs::kPopularSitesOverrideCountry, "IN"); |
| 214 prefs_->SetString(prefs::kPopularSitesOverrideVersion, "7"); | 213 prefs_->SetString(prefs::kPopularSitesOverrideVersion, "7"); |
| 215 | 214 |
| 216 url_fetcher_factory_.SetFakeResponse( | 215 url_fetcher_factory_.SetFakeResponse( |
| 217 GURL("https://www.gstatic.com/chrome/ntp/suggested_sites_IN_7.json"), | 216 GURL("https://www.gstatic.com/chrome/ntp/suggested_sites_IN_7.json"), |
| 218 R"([{ | 217 R"([{ |
| 219 "title": "PopularSite1", | 218 "title": "PopularSite1", |
| 220 "url": "http://popularsite1/", | 219 "url": "http://popularsite1/", |
| 221 "favicon_url": "http://popularsite1/favicon.ico" | 220 "favicon_url": "http://popularsite1/favicon.ico" |
| 222 }, | 221 }, |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 MatchesTile("Site 4", "https://www.site4.com/", | 804 MatchesTile("Site 4", "https://www.site4.com/", |
| 806 NTPTileSource::TOP_SITES), | 805 NTPTileSource::TOP_SITES), |
| 807 MatchesTile("Site 1", "https://www.site1.com/", | 806 MatchesTile("Site 1", "https://www.site1.com/", |
| 808 NTPTileSource::POPULAR), | 807 NTPTileSource::POPULAR), |
| 809 MatchesTile("Site 2", "https://www.site2.com/", | 808 MatchesTile("Site 2", "https://www.site2.com/", |
| 810 NTPTileSource::POPULAR))); | 809 NTPTileSource::POPULAR))); |
| 811 } | 810 } |
| 812 | 811 |
| 813 } // namespace | 812 } // namespace |
| 814 } // namespace ntp_tiles | 813 } // namespace ntp_tiles |
| OLD | NEW |