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

Unified Diff: components/favicon/core/large_icon_service_unittest.cc

Issue 2852383002: [LargeIconService] Add a unit-test for overriding request URL (Closed)
Patch Set: Fixing build Created 3 years, 7 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
« no previous file with comments | « components/favicon/core/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..67fcdd7a07f5616aead5bd26fd49884e164189ce 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,34 @@ 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();
+}
+
TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServerWithOriginalUrl) {
const GURL kExpectedServerUrl(
"https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true"
« no previous file with comments | « components/favicon/core/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698