Chromium Code Reviews| Index: components/favicon/core/large_icon_service_unittest.cc |
| diff --git a/components/favicon/core/large_icon_service_unittest.cc b/components/favicon/core/large_icon_service_unittest.cc |
| index ef463077010f4f6faedb63727ee92df29a1b0c5b..82aa68a3d84ca245c7de929ff09c615acb725bcf 100644 |
| --- a/components/favicon/core/large_icon_service_unittest.cc |
| +++ b/components/favicon/core/large_icon_service_unittest.cc |
| @@ -23,6 +23,7 @@ |
| #include "components/favicon_base/favicon_types.h" |
| #include "components/image_fetcher/core/image_fetcher.h" |
| #include "components/image_fetcher/core/request_metadata.h" |
| +#include "components/variations/variations_params_manager.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| @@ -164,6 +165,36 @@ TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServer) { |
| "Favicons.LargeIconService.DownloadedSize", 64, /*expected_count=*/1); |
| } |
| +TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServerWithCustomUrl) { |
| + variations::testing::VariationParamsManager variation_params( |
| + "LargeIconServiceFetching", |
| + {{"request_format", "https://t0.gstatic.com/faviconV2?size=%d&url=%s"}}, |
| + {"LargeIconServiceFetching"}); |
| + const GURL kExpectedServerUrl( |
| + "https://t0.gstatic.com/faviconV2?size=42&url=http://www.example.com/"); |
| + |
| + EXPECT_CALL(mock_favicon_service_, UnableToDownloadFavicon(_)).Times(0); |
| + |
| + base::MockCallback<base::Callback<void(bool success)>> callback; |
| + EXPECT_CALL(*mock_image_fetcher_, |
| + StartOrQueueNetworkRequest(_, kExpectedServerUrl, _)) |
| + .WillOnce(PostFetchReply(gfx::Image::CreateFrom1xBitmap( |
| + CreateTestSkBitmap(64, 64, kTestColor)))); |
| + EXPECT_CALL(mock_favicon_service_, |
| + SetLastResortFavicons(GURL(kDummyUrl), kExpectedServerUrl, |
| + favicon_base::IconType::TOUCH_ICON, _, _)) |
| + .WillOnce(PostBoolReply(true)); |
| + |
| + large_icon_service_ |
| + .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( |
| + GURL(kDummyUrl), /*min_source_size_in_pixel=*/42, callback.Get()); |
| + |
| + EXPECT_CALL(callback, Run(true)); |
| + base::RunLoop().RunUntilIdle(); |
| + histogram_tester_.ExpectUniqueSample( |
| + "Favicons.LargeIconService.DownloadedSize", 64, /*expected_count=*/1); |
|
pkotwicz
2017/05/03 17:35:20
Checking the histogram is unrelated to the main go
jkrcal
2017/05/04 15:37:39
Correct, removed.
|
| +} |
| + |
| TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServerWithOriginalUrl) { |
| const GURL kExpectedServerUrl( |
| "https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true" |