Index: components/ntp_tiles/popular_sites_impl_unittest.cc |
diff --git a/components/ntp_tiles/popular_sites_impl_unittest.cc b/components/ntp_tiles/popular_sites_impl_unittest.cc |
index 6732e27cc0cca77c40ede17e986c36bc0622432b..a80aa92ef6669747deecc860d3268ea72967f6b6 100644 |
--- a/components/ntp_tiles/popular_sites_impl_unittest.cc |
+++ b/components/ntp_tiles/popular_sites_impl_unittest.cc |
@@ -34,6 +34,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
using testing::Eq; |
+using testing::Gt; |
using testing::IsEmpty; |
namespace ntp_tiles { |
@@ -169,7 +170,17 @@ class PopularSitesTest : public ::testing::Test { |
net::FakeURLFetcherFactory url_fetcher_factory_; |
}; |
-TEST_F(PopularSitesTest, Basic) { |
+TEST_F(PopularSitesTest, ContainsDefaultTilesRightAfterConstruction) { |
+ scoped_refptr<net::TestURLRequestContextGetter> url_request_context( |
+ new net::TestURLRequestContextGetter( |
+ base::ThreadTaskRunnerHandle::Get())); |
+ |
+ auto popular_sites = CreatePopularSites(url_request_context.get()); |
+ EXPECT_THAT(popular_sites->sites().size(), |
+ Eq(GetNumberOfDefaultPopularSitesForPlatform())); |
+} |
+ |
+TEST_F(PopularSitesTest, Zasic) { |
SetCountryAndVersion("ZZ", "9"); |
RespondWithJSON( |
"https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", |
@@ -187,15 +198,6 @@ TEST_F(PopularSitesTest, Basic) { |
EXPECT_THAT(sites[0].favicon_url, URLEq("")); |
} |
-TEST_F(PopularSitesTest, ContainsDefaultTilesRightAfterConstruction) { |
- scoped_refptr<net::TestURLRequestContextGetter> url_request_context( |
- new net::TestURLRequestContextGetter( |
- base::ThreadTaskRunnerHandle::Get())); |
- |
- EXPECT_THAT(CreatePopularSites(url_request_context.get())->sites().size(), |
- Eq(GetNumberOfDefaultPopularSitesForPlatform())); |
-} |
- |
TEST_F(PopularSitesTest, Fallback) { |
SetCountryAndVersion("ZZ", "9"); |
RespondWith404( |
@@ -234,6 +236,21 @@ TEST_F(PopularSitesTest, PopulatesWithDefaultResoucesOnFailure) { |
EXPECT_THAT(sites.size(), Eq(GetNumberOfDefaultPopularSitesForPlatform())); |
} |
+TEST_F(PopularSitesTest, AddsIconResourcesToDefaultPages) { |
+ scoped_refptr<net::TestURLRequestContextGetter> url_request_context( |
+ new net::TestURLRequestContextGetter( |
+ base::ThreadTaskRunnerHandle::Get())); |
+ std::unique_ptr<PopularSites> popular_sites = |
+ CreatePopularSites(url_request_context.get()); |
+ |
+#if defined(GOOGLE_CHROME_BUILD) |
+ ASSERT_FALSE(popular_sites->sites().empty()); |
+ for (const auto& site : popular_sites->sites()) { |
+ EXPECT_THAT(site.default_icon_resource, Gt(0)); |
+ } |
+#endif |
+} |
+ |
TEST_F(PopularSitesTest, ProvidesDefaultSitesUntilCallbackReturns) { |
SetCountryAndVersion("ZZ", "9"); |
RespondWithJSON( |