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

Side by Side Diff: components/favicon/core/favicon_handler_unittest.cc

Issue 2804573002: Add FaviconHandler test reflecting behavior of bookmarks in incognito (Closed)
Patch Set: Reverted unrelated changes. 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/favicon/core/favicon_handler.h" 5 #include "components/favicon/core/favicon_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)).Times(0); 460 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)).Times(0);
461 461
462 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL16x16, _, _)); 462 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL16x16, _, _));
463 463
464 RunHandlerWithSimpleFaviconCandidates({kIconURL16x16}); 464 RunHandlerWithSimpleFaviconCandidates({kIconURL16x16});
465 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL16x16)); 465 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL16x16));
466 EXPECT_THAT(favicon_service_.fake()->db_requests(), 466 EXPECT_THAT(favicon_service_.fake()->db_requests(),
467 ElementsAre(kPageURL, kIconURL16x16)); 467 ElementsAre(kPageURL, kIconURL16x16));
468 } 468 }
469 469
470 // Test that the FaviconHandler saves a favicon if the page is bookmarked, even
471 // in incognito.
472 TEST_F(FaviconHandlerTest, DownloadBookmarkedFaviconInIncognito) {
473 ON_CALL(delegate_, IsOffTheRecord()).WillByDefault(Return(true));
474 ON_CALL(delegate_, IsBookmarked(kPageURL)).WillByDefault(Return(true));
475
476 EXPECT_CALL(favicon_service_, UpdateFaviconMappingsAndFetch(_, _, _, _, _, _))
477 .Times(0);
478
479 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL16x16, _, _));
480
pkotwicz 2017/04/05 15:19:42 Can you please add: EXPECT_THAT(delegate_.downloa
mastiz 2017/04/06 08:17:53 Done. Can you please elaborate why this verificati
pkotwicz 2017/04/06 14:46:02 It is relevant to the test because "the downloaded
mastiz 2017/04/06 14:56:56 Acknowledged, thx.
481 RunHandlerWithSimpleFaviconCandidates({kIconURL16x16});
482 }
483
470 // Test that the icon is redownloaded if the icon cached for the page URL 484 // Test that the icon is redownloaded if the icon cached for the page URL
471 // expired. 485 // expired.
472 TEST_F(FaviconHandlerTest, RedownloadExpiredPageUrlFavicon) { 486 TEST_F(FaviconHandlerTest, RedownloadExpiredPageUrlFavicon) {
473 favicon_service_.fake()->Store( 487 favicon_service_.fake()->Store(
474 kPageURL, kIconURL16x16, 488 kPageURL, kIconURL16x16,
475 CreateRawBitmapResult(kIconURL16x16, FAVICON, /*expired=*/true)); 489 CreateRawBitmapResult(kIconURL16x16, FAVICON, /*expired=*/true));
476 490
477 // TODO(crbug.com/700811): It would be nice if we could check whether the two 491 // TODO(crbug.com/700811): It would be nice if we could check whether the two
478 // OnFaviconUpdated() calls are called with different gfx::Images (as opposed 492 // OnFaviconUpdated() calls are called with different gfx::Images (as opposed
479 // to calling OnFaviconUpdated() with the expired gfx::Image both times). 493 // to calling OnFaviconUpdated() with the expired gfx::Image both times).
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 1020
1007 RunHandlerWithCandidates( 1021 RunHandlerWithCandidates(
1008 FaviconDriverObserver::NON_TOUCH_LARGEST, 1022 FaviconDriverObserver::NON_TOUCH_LARGEST,
1009 {FaviconURL(kIconURL10x10, FAVICON, SizeVector{gfx::Size(16, 16)}), 1023 {FaviconURL(kIconURL10x10, FAVICON, SizeVector{gfx::Size(16, 16)}),
1010 FaviconURL(kIconURL12x12, FAVICON, SizeVector{gfx::Size(15, 15)}), 1024 FaviconURL(kIconURL12x12, FAVICON, SizeVector{gfx::Size(15, 15)}),
1011 FaviconURL(kIconURL16x16, FAVICON, kEmptySizes)}); 1025 FaviconURL(kIconURL16x16, FAVICON, kEmptySizes)});
1012 } 1026 }
1013 1027
1014 } // namespace 1028 } // namespace
1015 } // namespace favicon 1029 } // namespace favicon
OLDNEW
« 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