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

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

Issue 2797143002: Add FaviconHandler test for UpdateFaviconMappingsAndFetch() (Closed)
Patch Set: Fixed comment. 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/favicon_handler_unittest.cc
diff --git a/components/favicon/core/favicon_handler_unittest.cc b/components/favicon/core/favicon_handler_unittest.cc
index 5a608b8ec5446bff4af2dfe69ff1338178c962a3..942068de0bc165bbcac9e736accfe80939bd9a48 100644
--- a/components/favicon/core/favicon_handler_unittest.cc
+++ b/components/favicon/core/favicon_handler_unittest.cc
@@ -395,12 +395,21 @@ TEST_F(FaviconHandlerTest, GetFaviconFromHistory) {
EXPECT_THAT(delegate_.downloads(), IsEmpty());
}
+// Test that UpdateFaviconsAndFetch() is called with the appropriate parameters
+// when there is data in the database for neither the page URL nor the icon URL.
+TEST_F(FaviconHandlerTest, UpdateFaviconMappingsAndFetch) {
+ EXPECT_CALL(favicon_service_, UpdateFaviconMappingsAndFetch(
+ kPageURL, URLVector{kIconURL16x16}, FAVICON,
+ /*desired_size_in_dip=*/16, _, _));
+
+ RunHandlerWithSimpleFaviconCandidates({kIconURL16x16});
+}
+
// Test that the FaviconHandler process finishes when:
// - There is data in the database for neither the page URL nor the icon URL.
// AND
// - FaviconService::GetFaviconForPageURL() callback returns before
// FaviconHandler::OnUpdateFaviconURL() is called.
-// TODO(mastiz): Add test to verify UpdateFaviconMappingsAndFetch().
TEST_F(FaviconHandlerTest, DownloadUnknownFaviconIfCandidatesSlower) {
EXPECT_CALL(favicon_service_, SetFavicons(kPageURL, kIconURL16x16, FAVICON,
ImageSizeIs(16, 16)));
@@ -423,15 +432,11 @@ TEST_F(FaviconHandlerTest, DownloadUnknownFaviconIfCandidatesSlower) {
}
// Test that the FaviconHandler process finishes when:
-// - There is no data in the database for neither the page URL nor the icon URL.
+// - There is data in the database for neither the page URL nor the icon URL.
// AND
// - FaviconService::GetFaviconForPageURL() callback returns after
// FaviconHandler::OnUpdateFaviconURL() is called.
TEST_F(FaviconHandlerTest, DownloadUnknownFaviconIfCandidatesFaster) {
- InSequence seq;
- EXPECT_CALL(favicon_service_,
- UpdateFaviconMappingsAndFetch(kPageURL, URLVector{kIconURL16x16},
- FAVICON, _, _, _));
EXPECT_CALL(favicon_service_, SetFavicons(kPageURL, kIconURL16x16, FAVICON,
ImageSizeIs(16, 16)));
EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL16x16, _, _));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698