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

Unified Diff: components/ntp_tiles/popular_sites_impl_unittest.cc

Issue 2695713004: Add baked-in favicons for default popular sites on NTP (Closed)
Patch Set: Rebase. Created 3 years, 10 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: 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(
« no previous file with comments | « components/ntp_tiles/popular_sites_impl.cc ('k') | components/ntp_tiles/resources/default_popular_sites.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698