| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/popular_sites_impl.h" | 5 #include "components/ntp_tiles/popular_sites_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 EXPECT_THAT(sites.size(), Eq(GetNumberOfDefaultPopularSitesForPlatform())); | 236 EXPECT_THAT(sites.size(), Eq(GetNumberOfDefaultPopularSitesForPlatform())); |
| 237 } | 237 } |
| 238 | 238 |
| 239 TEST_F(PopularSitesTest, AddsIconResourcesToDefaultPages) { | 239 TEST_F(PopularSitesTest, AddsIconResourcesToDefaultPages) { |
| 240 scoped_refptr<net::TestURLRequestContextGetter> url_request_context( | 240 scoped_refptr<net::TestURLRequestContextGetter> url_request_context( |
| 241 new net::TestURLRequestContextGetter( | 241 new net::TestURLRequestContextGetter( |
| 242 base::ThreadTaskRunnerHandle::Get())); | 242 base::ThreadTaskRunnerHandle::Get())); |
| 243 std::unique_ptr<PopularSites> popular_sites = | 243 std::unique_ptr<PopularSites> popular_sites = |
| 244 CreatePopularSites(url_request_context.get()); | 244 CreatePopularSites(url_request_context.get()); |
| 245 | 245 |
| 246 #if defined(GOOGLE_CHROME_BUILD) | 246 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_ANDROID) || defined(OS_IOS)) |
| 247 ASSERT_FALSE(popular_sites->sites().empty()); | 247 ASSERT_FALSE(popular_sites->sites().empty()); |
| 248 for (const auto& site : popular_sites->sites()) { | 248 for (const auto& site : popular_sites->sites()) { |
| 249 EXPECT_THAT(site.default_icon_resource, Gt(0)); | 249 EXPECT_THAT(site.default_icon_resource, Gt(0)); |
| 250 } | 250 } |
| 251 #endif | 251 #endif |
| 252 } | 252 } |
| 253 | 253 |
| 254 TEST_F(PopularSitesTest, ProvidesDefaultSitesUntilCallbackReturns) { | 254 TEST_F(PopularSitesTest, ProvidesDefaultSitesUntilCallbackReturns) { |
| 255 SetCountryAndVersion("ZZ", "9"); | 255 SetCountryAndVersion("ZZ", "9"); |
| 256 RespondWithJSON( | 256 RespondWithJSON( |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", | 432 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", |
| 433 {kChromium}); | 433 {kChromium}); |
| 434 EXPECT_THAT(FetchPopularSites(/*force_download=*/false, &sites), | 434 EXPECT_THAT(FetchPopularSites(/*force_download=*/false, &sites), |
| 435 Eq(base::Optional<bool>(true))); | 435 Eq(base::Optional<bool>(true))); |
| 436 ASSERT_THAT(sites.size(), Eq(1u)); | 436 ASSERT_THAT(sites.size(), Eq(1u)); |
| 437 EXPECT_THAT(sites[0].url, URLEq("https://www.chromium.org/")); | 437 EXPECT_THAT(sites[0].url, URLEq("https://www.chromium.org/")); |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace | 440 } // namespace |
| 441 } // namespace ntp_tiles | 441 } // namespace ntp_tiles |
| OLD | NEW |