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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // Second request refetches ZZ_9, which now has data. | 451 // Second request refetches ZZ_9, which now has data. |
452 RespondWithJSON( | 452 RespondWithJSON( |
453 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", | 453 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", |
454 {kChromium}); | 454 {kChromium}); |
455 EXPECT_THAT(FetchPopularSites(/*force_download=*/false, &sites), | 455 EXPECT_THAT(FetchPopularSites(/*force_download=*/false, &sites), |
456 Eq(base::Optional<bool>(true))); | 456 Eq(base::Optional<bool>(true))); |
457 ASSERT_THAT(sites.size(), Eq(1u)); | 457 ASSERT_THAT(sites.size(), Eq(1u)); |
458 EXPECT_THAT(sites[0].url, URLEq("https://www.chromium.org/")); | 458 EXPECT_THAT(sites[0].url, URLEq("https://www.chromium.org/")); |
459 } | 459 } |
460 | 460 |
| 461 TEST_F(PopularSitesTest, ShouldOverrideDirectory) { |
| 462 SetCountryAndVersion("ZZ", "9"); |
| 463 prefs_->SetString(prefs::kPopularSitesOverrideDirectory, "foo/bar/"); |
| 464 RespondWithJSON("https://www.gstatic.com/foo/bar/suggested_sites_ZZ_9.json", |
| 465 {kWikipedia}); |
| 466 |
| 467 PopularSites::SitesVector sites; |
| 468 EXPECT_THAT(FetchPopularSites(/*force_download=*/false, &sites), |
| 469 Eq(base::Optional<bool>(true))); |
| 470 |
| 471 EXPECT_THAT(sites.size(), Eq(1u)); |
| 472 } |
| 473 |
461 } // namespace | 474 } // namespace |
462 } // namespace ntp_tiles | 475 } // namespace ntp_tiles |
OLD | NEW |