| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/content/content_favicon_driver.h" | 5 #include "components/favicon/content/content_favicon_driver.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 std::vector<content::FaviconURL> favicon_urls; | 123 std::vector<content::FaviconURL> favicon_urls; |
| 124 favicon_urls.push_back( | 124 favicon_urls.push_back( |
| 125 content::FaviconURL(GURL("http://www.google.ca/favicon.ico"), | 125 content::FaviconURL(GURL("http://www.google.ca/favicon.ico"), |
| 126 content::FaviconURL::FAVICON, kEmptyIconSizes)); | 126 content::FaviconURL::FAVICON, kEmptyIconSizes)); |
| 127 favicon::ContentFaviconDriver* driver = | 127 favicon::ContentFaviconDriver* driver = |
| 128 favicon::ContentFaviconDriver::FromWebContents(web_contents()); | 128 favicon::ContentFaviconDriver::FromWebContents(web_contents()); |
| 129 static_cast<content::WebContentsObserver*>(driver) | 129 static_cast<content::WebContentsObserver*>(driver) |
| 130 ->DidUpdateFaviconURL(favicon_urls); | 130 ->DidUpdateFaviconURL(favicon_urls); |
| 131 | 131 |
| 132 // Test that ContentFaviconDriver ignored the favicon url update. | 132 // Test that ContentFaviconDriver ignored the favicon url update. |
| 133 EXPECT_TRUE(driver->favicon_urls().empty()); | 133 EXPECT_FALSE(driver->favicon_urls().has_value()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 TEST_F(ContentFaviconDriverTest, RecordsHistorgramsForCandidates) { | 136 TEST_F(ContentFaviconDriverTest, RecordsHistorgramsForCandidates) { |
| 137 const std::vector<gfx::Size> kSizes16x16and32x32({{16, 16}, {32, 32}}); | 137 const std::vector<gfx::Size> kSizes16x16and32x32({{16, 16}, {32, 32}}); |
| 138 base::HistogramTester tester; | 138 base::HistogramTester tester; |
| 139 content::WebContentsObserver* driver_as_observer = | 139 content::WebContentsObserver* driver_as_observer = |
| 140 ContentFaviconDriver::FromWebContents(web_contents()); | 140 ContentFaviconDriver::FromWebContents(web_contents()); |
| 141 | 141 |
| 142 // Navigation to a page updating one icon. | 142 // Navigation to a page updating one icon. |
| 143 NavigateAndCommit(GURL("http://www.youtube.com")); | 143 NavigateAndCommit(GURL("http://www.youtube.com")); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 172 base::Bucket(/*min=*/3, /*count=*/2))); | 172 base::Bucket(/*min=*/3, /*count=*/2))); |
| 173 EXPECT_THAT(tester.GetAllSamples("Favicons.CandidatesWithDefinedSizesCount"), | 173 EXPECT_THAT(tester.GetAllSamples("Favicons.CandidatesWithDefinedSizesCount"), |
| 174 ElementsAre(base::Bucket(/*min=*/1, /*count=*/3))); | 174 ElementsAre(base::Bucket(/*min=*/1, /*count=*/3))); |
| 175 EXPECT_THAT(tester.GetAllSamples("Favicons.CandidatesWithTouchIconsCount"), | 175 EXPECT_THAT(tester.GetAllSamples("Favicons.CandidatesWithTouchIconsCount"), |
| 176 ElementsAre(base::Bucket(/*min=*/0, /*count=*/1), | 176 ElementsAre(base::Bucket(/*min=*/0, /*count=*/1), |
| 177 base::Bucket(/*min=*/2, /*count=*/2))); | 177 base::Bucket(/*min=*/2, /*count=*/2))); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace | 180 } // namespace |
| 181 } // namespace favicon | 181 } // namespace favicon |
| OLD | NEW |