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

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

Issue 2810733002: [LargeIconService] Store downloaded icons under original URL (Closed)
Patch Set: Peter's comments Created 3 years, 8 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/large_icon_service.cc ('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 e7f17ffc7613e259aa86a6783cba49f24198b004..434baf1fced9f5aed6508b93e287bd7bc6d4eeec 100644
--- a/components/favicon/core/large_icon_service_unittest.cc
+++ b/components/favicon/core/large_icon_service_unittest.cc
@@ -51,6 +51,11 @@ ACTION_P(PostFetchReply, p0) {
FROM_HERE, base::Bind(arg2, arg0, p0, image_fetcher::RequestMetadata()));
}
+ACTION_P2(PostFetchReplyWithMetadata, p0, p1) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ base::Bind(arg2, arg0, p0, p1));
+}
+
ACTION_P(PostBoolReply, p0) {
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
base::Bind(arg4, p0));
@@ -154,6 +159,35 @@ TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServer) {
base::RunLoop().RunUntilIdle();
}
+TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServerWithOriginalUrl) {
+ const GURL kExpectedServerUrl(
+ "https://t0.gstatic.com/faviconV2?client=chrome&drop_404_icon=true"
+ "&size=64&min_size=42&max_size=128&fallback_opts=TYPE,SIZE,URL"
+ "&url=http://www.example.com/");
+ const GURL kExpectedOriginalUrl("http://www.example.com/favicon.png");
+
+ image_fetcher::RequestMetadata expected_metadata;
+ expected_metadata.content_location_header = kExpectedOriginalUrl.spec();
+ EXPECT_CALL(*mock_image_fetcher_,
+ StartOrQueueNetworkRequest(_, kExpectedServerUrl, _))
+ .WillOnce(PostFetchReplyWithMetadata(
+ gfx::Image::CreateFrom1xBitmap(
+ CreateTestSkBitmap(64, 64, kTestColor)),
+ expected_metadata));
+ EXPECT_CALL(mock_favicon_service_,
+ SetLastResortFavicons(GURL(kDummyUrl), kExpectedOriginalUrl,
+ favicon_base::IconType::TOUCH_ICON, _, _))
+ .WillOnce(PostBoolReply(true));
+
+ base::MockCallback<base::Callback<void(bool success)>> callback;
+ 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, ShouldTrimQueryParametersForGoogleServer) {
const GURL kDummyUrlWithQuery("http://www.example.com?foo=1");
const GURL kExpectedServerUrl(
« no previous file with comments | « components/favicon/core/large_icon_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698