OLD | NEW |
---|---|
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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1560 EXPECT_CALL(favicon_service_, | 1560 EXPECT_CALL(favicon_service_, |
1561 SetFavicons(_, kManifestURL, WEB_MANIFEST_ICON, _)); | 1561 SetFavicons(_, kManifestURL, WEB_MANIFEST_ICON, _)); |
1562 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL, _, _)); | 1562 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL, _, _)); |
1563 | 1563 |
1564 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | 1564 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); |
1565 EXPECT_THAT(favicon_service_.fake()->db_requests(), | 1565 EXPECT_THAT(favicon_service_.fake()->db_requests(), |
1566 ElementsAre(kPageURL, kManifestURL)); | 1566 ElementsAre(kPageURL, kManifestURL)); |
1567 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL16x16)); | 1567 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL16x16)); |
1568 } | 1568 } |
1569 | 1569 |
1570 // Test that a favicon corresponding to a web manifest is reported when there is | |
1571 // data in the database for neither the page URL nor the manifest URL. | |
pkotwicz
2017/06/21 18:03:43
The comment seems to be unrelated to the test
mastiz
2017/06/23 10:29:36
Done, thanks for catching.
| |
1572 TEST_F(FaviconHandlerManifestsEnabledTest, Prefer192x192IconFromManifest) { | |
1573 const GURL kIconURL144x144 = GURL("http://www.google.com/favicon144x144"); | |
1574 const GURL kIconURL192x192 = GURL("http://www.google.com/favicon192x192"); | |
1575 | |
1576 delegate_.fake_image_downloader().Add(kIconURL144x144, IntVector{144}); | |
1577 delegate_.fake_image_downloader().Add(kIconURL192x192, IntVector{192}); | |
1578 | |
1579 const std::vector<favicon::FaviconURL> kManifestIcons = { | |
1580 FaviconURL(kIconURL144x144, WEB_MANIFEST_ICON, | |
1581 SizeVector(1U, gfx::Size(144, 144))), | |
1582 FaviconURL(kIconURL192x192, WEB_MANIFEST_ICON, | |
1583 SizeVector(1U, gfx::Size(192, 192))), | |
1584 }; | |
1585 | |
1586 delegate_.fake_manifest_downloader().Add(kManifestURL, kManifestIcons); | |
1587 | |
1588 RunHandlerWithCandidates( | |
1589 FaviconDriverObserver::TOUCH_LARGEST, | |
1590 { | |
1591 FaviconURL(kIconURL12x12, TOUCH_ICON, kEmptySizes), | |
1592 FaviconURL(kIconURL64x64, TOUCH_ICON, kEmptySizes), | |
1593 }, | |
pkotwicz
2017/06/21 18:03:43
Can the |candidates| be empty?
mastiz
2017/06/23 10:29:36
Done.
| |
1594 kManifestURL); | |
1595 | |
1596 EXPECT_THAT(delegate_.downloads(), | |
1597 ElementsAre(kManifestURL, kIconURL192x192)); | |
1598 } | |
1599 | |
1570 // Test that the manifest and icon are redownloaded if the icon cached for the | 1600 // Test that the manifest and icon are redownloaded if the icon cached for the |
1571 // page URL expired. | 1601 // page URL expired. |
1572 TEST_F(FaviconHandlerManifestsEnabledTest, GetFaviconFromExpiredManifest) { | 1602 TEST_F(FaviconHandlerManifestsEnabledTest, GetFaviconFromExpiredManifest) { |
1573 const std::vector<favicon::FaviconURL> kManifestIcons = { | 1603 const std::vector<favicon::FaviconURL> kManifestIcons = { |
1574 FaviconURL(kIconURL64x64, FAVICON, kEmptySizes), | 1604 FaviconURL(kIconURL64x64, FAVICON, kEmptySizes), |
1575 }; | 1605 }; |
1576 | 1606 |
1577 favicon_service_.fake()->Store( | 1607 favicon_service_.fake()->Store( |
1578 kPageURL, kManifestURL, | 1608 kPageURL, kManifestURL, |
1579 CreateRawBitmapResult(kManifestURL, WEB_MANIFEST_ICON, | 1609 CreateRawBitmapResult(kManifestURL, WEB_MANIFEST_ICON, |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1966 | 1996 |
1967 // Complete the download. | 1997 // Complete the download. |
1968 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL2, _, _)); | 1998 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL2, _, _)); |
1969 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL2, _, _)); | 1999 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL2, _, _)); |
1970 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually()); | 2000 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually()); |
1971 base::RunLoop().RunUntilIdle(); | 2001 base::RunLoop().RunUntilIdle(); |
1972 } | 2002 } |
1973 | 2003 |
1974 } // namespace | 2004 } // namespace |
1975 } // namespace favicon | 2005 } // namespace favicon |
OLD | NEW |