Chromium Code Reviews| 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> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "base/test/histogram_tester.h" | 18 #include "base/test/histogram_tester.h" |
| 19 #include "base/test/scoped_feature_list.h" | |
| 19 #include "base/test/scoped_task_environment.h" | 20 #include "base/test/scoped_task_environment.h" |
| 20 #include "base/test/test_simple_task_runner.h" | 21 #include "base/test/test_simple_task_runner.h" |
| 21 #include "components/favicon/core/favicon_driver.h" | 22 #include "components/favicon/core/favicon_driver.h" |
| 22 #include "components/favicon/core/test/mock_favicon_service.h" | 23 #include "components/favicon/core/test/mock_favicon_service.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 25 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| 26 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
| 27 #include "ui/base/layout.h" | 28 #include "ui/base/layout.h" |
| 28 #include "ui/gfx/codec/png_codec.h" | 29 #include "ui/gfx/codec/png_codec.h" |
| 29 #include "ui/gfx/favicon_size.h" | 30 #include "ui/gfx/favicon_size.h" |
| 30 #include "ui/gfx/image/image.h" | 31 #include "ui/gfx/image/image.h" |
| 31 | 32 |
| 32 namespace favicon { | 33 namespace favicon { |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 using favicon_base::FAVICON; | 36 using favicon_base::FAVICON; |
| 36 using favicon_base::FaviconRawBitmapResult; | 37 using favicon_base::FaviconRawBitmapResult; |
| 37 using favicon_base::TOUCH_ICON; | 38 using favicon_base::TOUCH_ICON; |
| 38 using favicon_base::TOUCH_PRECOMPOSED_ICON; | 39 using favicon_base::TOUCH_PRECOMPOSED_ICON; |
| 39 using testing::Assign; | 40 using testing::Assign; |
| 41 using testing::Contains; | |
| 40 using testing::ElementsAre; | 42 using testing::ElementsAre; |
| 41 using testing::InSequence; | 43 using testing::InSequence; |
| 42 using testing::Invoke; | 44 using testing::Invoke; |
| 43 using testing::IsEmpty; | 45 using testing::IsEmpty; |
| 46 using testing::Not; | |
| 44 using testing::Return; | 47 using testing::Return; |
| 45 using testing::_; | 48 using testing::_; |
| 46 | 49 |
| 47 using DownloadOutcome = FaviconHandler::DownloadOutcome; | 50 using DownloadOutcome = FaviconHandler::DownloadOutcome; |
| 48 using IntVector = std::vector<int>; | 51 using IntVector = std::vector<int>; |
| 49 using URLVector = std::vector<GURL>; | 52 using URLVector = std::vector<GURL>; |
| 50 using BitmapVector = std::vector<SkBitmap>; | 53 using BitmapVector = std::vector<SkBitmap>; |
| 51 using SizeVector = std::vector<gfx::Size>; | 54 using SizeVector = std::vector<gfx::Size>; |
| 52 | 55 |
| 53 MATCHER_P2(ImageSizeIs, width, height, "") { | 56 MATCHER_P2(ImageSizeIs, width, height, "") { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // Fake that implements the calls to FaviconHandler::Delegate's DownloadImage(), | 113 // Fake that implements the calls to FaviconHandler::Delegate's DownloadImage(), |
| 111 // delegated to this class through MockDelegate. | 114 // delegated to this class through MockDelegate. |
| 112 class FakeImageDownloader { | 115 class FakeImageDownloader { |
| 113 public: | 116 public: |
| 114 struct Response { | 117 struct Response { |
| 115 int http_status_code = 404; | 118 int http_status_code = 404; |
| 116 BitmapVector bitmaps; | 119 BitmapVector bitmaps; |
| 117 SizeVector original_bitmap_sizes; | 120 SizeVector original_bitmap_sizes; |
| 118 }; | 121 }; |
| 119 | 122 |
| 120 FakeImageDownloader() : next_download_id_(1) {} | 123 // |downloads| must not be nullptr and must outlive this object. |
| 124 FakeImageDownloader(URLVector* downloads) | |
| 125 : downloads_(downloads), next_download_id_(1) {} | |
| 121 | 126 |
| 122 // Implementation of FaviconHalder::Delegate's DownloadImage(). If a given | 127 // Implementation of FaviconHalder::Delegate's DownloadImage(). If a given |
| 123 // URL is not known (i.e. not previously added via Add()), it produces 404s. | 128 // URL is not known (i.e. not previously added via Add()), it produces 404s. |
| 124 int DownloadImage(const GURL& url, | 129 int DownloadImage(const GURL& url, |
| 125 int max_image_size, | 130 int max_image_size, |
| 126 FaviconHandler::Delegate::ImageDownloadCallback callback) { | 131 FaviconHandler::Delegate::ImageDownloadCallback callback) { |
| 127 downloads_.push_back(url); | 132 downloads_->push_back(url); |
| 128 | 133 |
| 129 const Response& response = responses_[url]; | 134 const Response& response = responses_[url]; |
| 130 int download_id = next_download_id_++; | 135 int download_id = next_download_id_++; |
| 131 base::Closure bound_callback = | 136 base::Closure bound_callback = |
| 132 base::Bind(callback, download_id, response.http_status_code, url, | 137 base::Bind(callback, download_id, response.http_status_code, url, |
| 133 response.bitmaps, response.original_bitmap_sizes); | 138 response.bitmaps, response.original_bitmap_sizes); |
| 134 if (url == manual_callback_url_) | 139 if (url == manual_callback_url_) |
| 135 manual_callback_ = bound_callback; | 140 manual_callback_ = bound_callback; |
| 136 else | 141 else |
| 137 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, bound_callback); | 142 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, bound_callback); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 // Triggers the response for a download previously selected for manual | 182 // Triggers the response for a download previously selected for manual |
| 178 // triggering via SetRunCallbackManuallyForUrl(). | 183 // triggering via SetRunCallbackManuallyForUrl(). |
| 179 bool RunCallbackManually() { | 184 bool RunCallbackManually() { |
| 180 if (!HasPendingManualCallback()) | 185 if (!HasPendingManualCallback()) |
| 181 return false; | 186 return false; |
| 182 manual_callback_.Run(); | 187 manual_callback_.Run(); |
| 183 manual_callback_.Reset(); | 188 manual_callback_.Reset(); |
| 184 return true; | 189 return true; |
| 185 } | 190 } |
| 186 | 191 |
| 187 // Returns pending and completed download URLs. | |
| 188 const URLVector& downloads() const { return downloads_; } | |
| 189 | |
| 190 void ClearDownloads() { downloads_.clear(); } | |
| 191 | |
| 192 private: | 192 private: |
| 193 URLVector* downloads_; | |
| 193 int next_download_id_; | 194 int next_download_id_; |
| 194 | 195 |
| 195 // Pending and completed download URLs. | |
| 196 URLVector downloads_; | |
| 197 | |
| 198 // URL to disable automatic callbacks for. | 196 // URL to disable automatic callbacks for. |
| 199 GURL manual_callback_url_; | 197 GURL manual_callback_url_; |
| 200 | 198 |
| 201 // Callback for DownloadImage() request for |manual_callback_url_|. | 199 // Callback for DownloadImage() request for |manual_callback_url_|. |
| 202 base::Closure manual_callback_; | 200 base::Closure manual_callback_; |
| 203 | 201 |
| 204 // Registered responses. | 202 // Registered responses. |
| 205 std::map<GURL, Response> responses_; | 203 std::map<GURL, Response> responses_; |
| 206 | 204 |
| 207 DISALLOW_COPY_AND_ASSIGN(FakeImageDownloader); | 205 DISALLOW_COPY_AND_ASSIGN(FakeImageDownloader); |
| 208 }; | 206 }; |
| 209 | 207 |
| 208 // Fake that implements the calls to FaviconHandler::Delegate's | |
| 209 // DownloadManifest(), delegated to this class through MockDelegate. | |
| 210 class FakeManifestDownloader { | |
| 211 public: | |
| 212 struct Response { | |
| 213 std::vector<favicon::FaviconURL> favicon_urls; | |
| 214 }; | |
| 215 | |
| 216 // |downloads| must not be nullptr and must outlive this object. | |
| 217 FakeManifestDownloader(URLVector* downloads) : downloads_(downloads) {} | |
| 218 | |
| 219 // Implementation of FaviconHalder::Delegate's DownloadManifest(). If a given | |
|
pkotwicz
2017/05/12 06:13:29
Nit: FaviconHalder -> FaviconHandler
| |
| 220 // URL is not known (i.e. not previously added via Add()), it produces 404s. | |
| 221 void DownloadManifest( | |
| 222 const GURL& url, | |
| 223 FaviconHandler::Delegate::ManifestDownloadCallback callback) { | |
| 224 downloads_->push_back(url); | |
| 225 | |
| 226 const Response& response = responses_[url]; | |
| 227 base::Closure bound_callback = base::Bind(callback, response.favicon_urls); | |
| 228 if (url == manual_callback_url_) | |
| 229 manual_callback_ = bound_callback; | |
| 230 else | |
| 231 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, bound_callback); | |
| 232 } | |
| 233 | |
| 234 void Add(const GURL& manifest_url, | |
| 235 const std::vector<favicon::FaviconURL>& favicon_urls) { | |
| 236 Response response; | |
| 237 response.favicon_urls = favicon_urls; | |
| 238 responses_[manifest_url] = response; | |
| 239 } | |
| 240 | |
| 241 void AddError(const GURL& manifest_url) { | |
| 242 responses_[manifest_url] = Response(); | |
| 243 } | |
| 244 | |
| 245 // Disables automatic callback for |url|. This is useful for emulating a | |
| 246 // download taking a long time. The callback for DownloadManifest() will be | |
| 247 // stored in |manual_callback_|. | |
| 248 void SetRunCallbackManuallyForUrl(const GURL& url) { | |
| 249 manual_callback_url_ = url; | |
| 250 } | |
| 251 | |
| 252 // Returns whether an ongoing download exists for a url previously selected | |
| 253 // via SetRunCallbackManuallyForUrl(). | |
| 254 bool HasPendingManualCallback() { return !manual_callback_.is_null(); } | |
| 255 | |
| 256 // Triggers the response for a download previously selected for manual | |
| 257 // triggering via SetRunCallbackManuallyForUrl(). | |
| 258 bool RunCallbackManually() { | |
| 259 if (!HasPendingManualCallback()) | |
| 260 return false; | |
| 261 manual_callback_.Run(); | |
| 262 manual_callback_.Reset(); | |
| 263 return true; | |
| 264 } | |
| 265 | |
| 266 private: | |
| 267 URLVector* downloads_; | |
| 268 | |
| 269 // URL to disable automatic callbacks for. | |
| 270 GURL manual_callback_url_; | |
| 271 | |
| 272 // Callback for DownloadManifest() request for |manual_callback_url_|. | |
| 273 base::Closure manual_callback_; | |
| 274 | |
| 275 // Registered responses. | |
| 276 std::map<GURL, Response> responses_; | |
| 277 | |
| 278 DISALLOW_COPY_AND_ASSIGN(FakeManifestDownloader); | |
| 279 }; | |
| 280 | |
| 210 class MockDelegate : public FaviconHandler::Delegate { | 281 class MockDelegate : public FaviconHandler::Delegate { |
| 211 public: | 282 public: |
| 212 MockDelegate() { | 283 MockDelegate() |
| 284 : fake_image_downloader_(&downloads_), | |
| 285 fake_manifest_downloader_(&downloads_) { | |
| 213 // Delegate image downloading to FakeImageDownloader. | 286 // Delegate image downloading to FakeImageDownloader. |
| 214 ON_CALL(*this, DownloadImage(_, _, _)) | 287 ON_CALL(*this, DownloadImage(_, _, _)) |
| 215 .WillByDefault(Invoke(&fake_image_downloader_, | 288 .WillByDefault(Invoke(&fake_image_downloader_, |
| 216 &FakeImageDownloader::DownloadImage)); | 289 &FakeImageDownloader::DownloadImage)); |
| 290 // Delegate manifest downloading to FakeManifestDownloader. | |
| 291 ON_CALL(*this, DownloadManifest(_, _)) | |
| 292 .WillByDefault(Invoke(&fake_manifest_downloader_, | |
| 293 &FakeManifestDownloader::DownloadManifest)); | |
| 217 } | 294 } |
| 218 | 295 |
| 219 MOCK_METHOD3(DownloadImage, | 296 MOCK_METHOD3(DownloadImage, |
| 220 int(const GURL& url, | 297 int(const GURL& url, |
| 221 int max_image_size, | 298 int max_image_size, |
| 222 ImageDownloadCallback callback)); | 299 ImageDownloadCallback callback)); |
| 300 MOCK_METHOD2(DownloadManifest, | |
| 301 void(const GURL& url, ManifestDownloadCallback callback)); | |
| 223 MOCK_METHOD0(IsOffTheRecord, bool()); | 302 MOCK_METHOD0(IsOffTheRecord, bool()); |
| 224 MOCK_METHOD1(IsBookmarked, bool(const GURL& url)); | 303 MOCK_METHOD1(IsBookmarked, bool(const GURL& url)); |
| 225 MOCK_METHOD5(OnFaviconUpdated, | 304 MOCK_METHOD5(OnFaviconUpdated, |
| 226 void(const GURL& page_url, | 305 void(const GURL& page_url, |
| 227 FaviconDriverObserver::NotificationIconType type, | 306 FaviconDriverObserver::NotificationIconType type, |
| 228 const GURL& icon_url, | 307 const GURL& icon_url, |
| 229 bool icon_url_changed, | 308 bool icon_url_changed, |
| 230 const gfx::Image& image)); | 309 const gfx::Image& image)); |
| 231 | 310 |
| 232 FakeImageDownloader& fake_image_downloader() { | 311 FakeImageDownloader& fake_image_downloader() { |
| 233 return fake_image_downloader_; | 312 return fake_image_downloader_; |
| 234 } | 313 } |
| 235 | 314 |
| 236 // Convenience getter for test readability. Returns pending and completed | 315 FakeManifestDownloader& fake_manifest_downloader() { |
| 237 // download URLs. | 316 return fake_manifest_downloader_; |
| 238 const URLVector& downloads() const { | |
| 239 return fake_image_downloader_.downloads(); | |
| 240 } | 317 } |
| 241 | 318 |
| 319 // Returns pending and completed download URLs. | |
| 320 const URLVector& downloads() const { return downloads_; } | |
| 321 | |
| 322 void ClearDownloads() { downloads_.clear(); } | |
| 323 | |
| 242 private: | 324 private: |
| 325 // Pending and completed download URLs. | |
| 326 URLVector downloads_; | |
| 243 FakeImageDownloader fake_image_downloader_; | 327 FakeImageDownloader fake_image_downloader_; |
| 328 FakeManifestDownloader fake_manifest_downloader_; | |
| 244 }; | 329 }; |
| 245 | 330 |
| 246 // FakeFaviconService mimics a FaviconService backend that allows setting up | 331 // FakeFaviconService mimics a FaviconService backend that allows setting up |
| 247 // test data stored via Store(). If Store() has not been called for a | 332 // test data stored via Store(). If Store() has not been called for a |
| 248 // particular URL, the callback is called with empty database results. | 333 // particular URL, the callback is called with empty database results. |
| 249 class FakeFaviconService { | 334 class FakeFaviconService { |
| 250 public: | 335 public: |
| 251 FakeFaviconService() | 336 FakeFaviconService() |
| 252 : manual_callback_task_runner_(new base::TestSimpleTaskRunner()) {} | 337 : manual_callback_task_runner_(new base::TestSimpleTaskRunner()) {} |
| 253 | 338 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 // a downloaded bitmap in FaviconHandler::OnDidDownloadFavicon(). | 482 // a downloaded bitmap in FaviconHandler::OnDidDownloadFavicon(). |
| 398 // Force the values of the scale factors so that the tests produce the same | 483 // Force the values of the scale factors so that the tests produce the same |
| 399 // results on all platforms. | 484 // results on all platforms. |
| 400 scoped_set_supported_scale_factors_.reset( | 485 scoped_set_supported_scale_factors_.reset( |
| 401 new ui::test::ScopedSetSupportedScaleFactors({ui::SCALE_FACTOR_100P})); | 486 new ui::test::ScopedSetSupportedScaleFactors({ui::SCALE_FACTOR_100P})); |
| 402 } | 487 } |
| 403 | 488 |
| 404 bool VerifyAndClearExpectations() { | 489 bool VerifyAndClearExpectations() { |
| 405 base::RunLoop().RunUntilIdle(); | 490 base::RunLoop().RunUntilIdle(); |
| 406 favicon_service_.fake()->ClearDbRequests(); | 491 favicon_service_.fake()->ClearDbRequests(); |
| 407 delegate_.fake_image_downloader().ClearDownloads(); | 492 delegate_.ClearDownloads(); |
| 408 return testing::Mock::VerifyAndClearExpectations(&favicon_service_) && | 493 return testing::Mock::VerifyAndClearExpectations(&favicon_service_) && |
| 409 testing::Mock::VerifyAndClearExpectations(&delegate_); | 494 testing::Mock::VerifyAndClearExpectations(&delegate_); |
| 410 } | 495 } |
| 411 | 496 |
| 412 // Creates a new handler and feeds in the page URL and the candidates. | 497 // Creates a new handler and feeds in the page URL and the candidates. |
| 413 // Returns the handler in case tests want to exercise further steps. | 498 // Returns the handler in case tests want to exercise further steps. |
| 414 std::unique_ptr<FaviconHandler> RunHandlerWithCandidates( | 499 std::unique_ptr<FaviconHandler> RunHandlerWithCandidates( |
| 415 FaviconDriverObserver::NotificationIconType handler_type, | 500 FaviconDriverObserver::NotificationIconType handler_type, |
| 416 const std::vector<favicon::FaviconURL>& candidates) { | 501 const std::vector<favicon::FaviconURL>& candidates, |
| 502 const base::Optional<GURL>& manifest_url = base::nullopt) { | |
| 417 auto handler = base::MakeUnique<FaviconHandler>(&favicon_service_, | 503 auto handler = base::MakeUnique<FaviconHandler>(&favicon_service_, |
| 418 &delegate_, handler_type); | 504 &delegate_, handler_type); |
| 419 handler->FetchFavicon(kPageURL); | 505 handler->FetchFavicon(kPageURL); |
| 420 // The first RunUntilIdle() causes the FaviconService lookups be faster than | 506 // The first RunUntilIdle() causes the FaviconService lookups be faster than |
| 421 // OnUpdateCandidates(), which is the most likely scenario. | 507 // OnUpdateCandidates(), which is the most likely scenario. |
| 422 base::RunLoop().RunUntilIdle(); | 508 base::RunLoop().RunUntilIdle(); |
| 423 handler->OnUpdateCandidates(kPageURL, candidates); | 509 handler->OnUpdateCandidates(kPageURL, candidates, manifest_url); |
| 424 base::RunLoop().RunUntilIdle(); | 510 base::RunLoop().RunUntilIdle(); |
| 425 return handler; | 511 return handler; |
| 426 } | 512 } |
| 427 | 513 |
| 428 // Same as above, but for the simplest case where all types are FAVICON and | 514 // Same as above, but for the simplest case where all types are FAVICON and |
| 429 // no sizes are provided, using a FaviconHandler of type NON_TOUCH_16_DIP. | 515 // no sizes are provided, using a FaviconHandler of type NON_TOUCH_16_DIP. |
| 430 std::unique_ptr<FaviconHandler> RunHandlerWithSimpleFaviconCandidates( | 516 std::unique_ptr<FaviconHandler> RunHandlerWithSimpleFaviconCandidates( |
| 431 const std::vector<GURL>& urls) { | 517 const std::vector<GURL>& urls, |
| 518 const base::Optional<GURL>& manifest_url = base::nullopt) { | |
| 432 std::vector<favicon::FaviconURL> candidates; | 519 std::vector<favicon::FaviconURL> candidates; |
| 433 for (const GURL& url : urls) { | 520 for (const GURL& url : urls) { |
| 434 candidates.emplace_back(url, FAVICON, kEmptySizes); | 521 candidates.emplace_back(url, FAVICON, kEmptySizes); |
| 435 } | 522 } |
| 436 return RunHandlerWithCandidates(FaviconDriverObserver::NON_TOUCH_16_DIP, | 523 return RunHandlerWithCandidates(FaviconDriverObserver::NON_TOUCH_16_DIP, |
| 437 candidates); | 524 candidates, manifest_url); |
| 438 } | 525 } |
| 439 | 526 |
| 440 base::test::ScopedTaskEnvironment scoped_task_environment_; | 527 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 441 std::unique_ptr<ui::test::ScopedSetSupportedScaleFactors> | 528 std::unique_ptr<ui::test::ScopedSetSupportedScaleFactors> |
| 442 scoped_set_supported_scale_factors_; | 529 scoped_set_supported_scale_factors_; |
| 443 testing::NiceMock<MockFaviconServiceWithFake> favicon_service_; | 530 testing::NiceMock<MockFaviconServiceWithFake> favicon_service_; |
| 444 testing::NiceMock<MockDelegate> delegate_; | 531 testing::NiceMock<MockDelegate> delegate_; |
| 445 }; | 532 }; |
| 446 | 533 |
| 447 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { | 534 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 ASSERT_TRUE(favicon_service_.fake()->RunCallbackManually()); | 584 ASSERT_TRUE(favicon_service_.fake()->RunCallbackManually()); |
| 498 ASSERT_TRUE(VerifyAndClearExpectations()); | 585 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 499 | 586 |
| 500 EXPECT_CALL(favicon_service_, SetFavicons(kPageURL, kIconURL16x16, FAVICON, | 587 EXPECT_CALL(favicon_service_, SetFavicons(kPageURL, kIconURL16x16, FAVICON, |
| 501 ImageSizeIs(16, 16))); | 588 ImageSizeIs(16, 16))); |
| 502 EXPECT_CALL(delegate_, OnFaviconUpdated( | 589 EXPECT_CALL(delegate_, OnFaviconUpdated( |
| 503 kPageURL, FaviconDriverObserver::NON_TOUCH_16_DIP, | 590 kPageURL, FaviconDriverObserver::NON_TOUCH_16_DIP, |
| 504 kIconURL16x16, /*icon_url_changed=*/true, _)); | 591 kIconURL16x16, /*icon_url_changed=*/true, _)); |
| 505 // Feed in favicons now that the database lookup is completed. | 592 // Feed in favicons now that the database lookup is completed. |
| 506 handler.OnUpdateCandidates(kPageURL, | 593 handler.OnUpdateCandidates(kPageURL, |
| 507 {FaviconURL(kIconURL16x16, FAVICON, kEmptySizes)}); | 594 {FaviconURL(kIconURL16x16, FAVICON, kEmptySizes)}, |
| 595 base::nullopt); | |
| 508 base::RunLoop().RunUntilIdle(); | 596 base::RunLoop().RunUntilIdle(); |
| 509 | 597 |
| 510 EXPECT_THAT(favicon_service_.fake()->db_requests(), | 598 EXPECT_THAT(favicon_service_.fake()->db_requests(), |
| 511 ElementsAre(kIconURL16x16)); | 599 ElementsAre(kIconURL16x16)); |
| 512 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL16x16)); | 600 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL16x16)); |
| 513 } | 601 } |
| 514 | 602 |
| 515 // Test that the FaviconHandler process finishes when: | 603 // Test that the FaviconHandler process finishes when: |
| 516 // - There is data in the database for neither the page URL nor the icon URL. | 604 // - There is data in the database for neither the page URL nor the icon URL. |
| 517 // AND | 605 // AND |
| 518 // - FaviconService::GetFaviconForPageURL() callback returns after | 606 // - FaviconService::GetFaviconForPageURL() callback returns after |
| 519 // FaviconHandler::OnUpdateCandidates() is called. | 607 // FaviconHandler::OnUpdateCandidates() is called. |
| 520 TEST_F(FaviconHandlerTest, DownloadUnknownFaviconIfCandidatesFaster) { | 608 TEST_F(FaviconHandlerTest, DownloadUnknownFaviconIfCandidatesFaster) { |
| 521 // Defer the database lookup completion to control the exact timing. | 609 // Defer the database lookup completion to control the exact timing. |
| 522 favicon_service_.fake()->SetRunCallbackManuallyForUrl(kPageURL); | 610 favicon_service_.fake()->SetRunCallbackManuallyForUrl(kPageURL); |
| 523 | 611 |
| 524 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)).Times(0); | 612 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)).Times(0); |
| 525 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)).Times(0); | 613 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)).Times(0); |
| 526 | 614 |
| 527 FaviconHandler handler(&favicon_service_, &delegate_, | 615 FaviconHandler handler(&favicon_service_, &delegate_, |
| 528 FaviconDriverObserver::NON_TOUCH_16_DIP); | 616 FaviconDriverObserver::NON_TOUCH_16_DIP); |
| 529 handler.FetchFavicon(kPageURL); | 617 handler.FetchFavicon(kPageURL); |
| 530 base::RunLoop().RunUntilIdle(); | 618 base::RunLoop().RunUntilIdle(); |
| 531 // Feed in favicons before completing the database lookup. | 619 // Feed in favicons before completing the database lookup. |
| 532 handler.OnUpdateCandidates(kPageURL, | 620 handler.OnUpdateCandidates(kPageURL, |
| 533 {FaviconURL(kIconURL16x16, FAVICON, kEmptySizes)}); | 621 {FaviconURL(kIconURL16x16, FAVICON, kEmptySizes)}, |
| 622 base::nullopt); | |
| 534 | 623 |
| 535 ASSERT_TRUE(VerifyAndClearExpectations()); | 624 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 536 // Database lookup for |kPageURL| is ongoing. | 625 // Database lookup for |kPageURL| is ongoing. |
| 537 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); | 626 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); |
| 538 | 627 |
| 539 EXPECT_CALL(favicon_service_, SetFavicons(kPageURL, kIconURL16x16, FAVICON, | 628 EXPECT_CALL(favicon_service_, SetFavicons(kPageURL, kIconURL16x16, FAVICON, |
| 540 ImageSizeIs(16, 16))); | 629 ImageSizeIs(16, 16))); |
| 541 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL16x16, _, _)); | 630 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL16x16, _, _)); |
| 542 | 631 |
| 543 // Complete the lookup for |kPageURL|. | 632 // Complete the lookup for |kPageURL|. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 std::unique_ptr<FaviconHandler> handler = | 826 std::unique_ptr<FaviconHandler> handler = |
| 738 RunHandlerWithSimpleFaviconCandidates({kIconURL1, kIconURL2}); | 827 RunHandlerWithSimpleFaviconCandidates({kIconURL1, kIconURL2}); |
| 739 | 828 |
| 740 ASSERT_TRUE(VerifyAndClearExpectations()); | 829 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 741 ASSERT_TRUE(delegate_.fake_image_downloader().HasPendingManualCallback()); | 830 ASSERT_TRUE(delegate_.fake_image_downloader().HasPendingManualCallback()); |
| 742 | 831 |
| 743 // Favicon update should invalidate the ongoing download. | 832 // Favicon update should invalidate the ongoing download. |
| 744 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL3, _, _)); | 833 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL3, _, _)); |
| 745 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL3, _, _)); | 834 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL3, _, _)); |
| 746 | 835 |
| 747 handler->OnUpdateCandidates(kPageURL, | 836 handler->OnUpdateCandidates( |
| 748 {FaviconURL(kIconURL3, FAVICON, kEmptySizes)}); | 837 kPageURL, {FaviconURL(kIconURL3, FAVICON, kEmptySizes)}, base::nullopt); |
| 749 | 838 |
| 750 // Finalizes download, which should be thrown away as the favicon URLs were | 839 // Finalizes download, which should be thrown away as the favicon URLs were |
| 751 // updated. | 840 // updated. |
| 752 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually()); | 841 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually()); |
| 753 base::RunLoop().RunUntilIdle(); | 842 base::RunLoop().RunUntilIdle(); |
| 754 | 843 |
| 755 EXPECT_THAT(favicon_service_.fake()->db_requests(), ElementsAre(kIconURL3)); | 844 EXPECT_THAT(favicon_service_.fake()->db_requests(), ElementsAre(kIconURL3)); |
| 756 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL3)); | 845 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL3)); |
| 757 } | 846 } |
| 758 | 847 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 774 RunHandlerWithSimpleFaviconCandidates(URLVector{kIconURL1}); | 863 RunHandlerWithSimpleFaviconCandidates(URLVector{kIconURL1}); |
| 775 | 864 |
| 776 ASSERT_TRUE(VerifyAndClearExpectations()); | 865 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 777 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); | 866 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); |
| 778 | 867 |
| 779 // SetFavicons() and OnFaviconUpdated() should be called for the new icon URL | 868 // SetFavicons() and OnFaviconUpdated() should be called for the new icon URL |
| 780 // and not |kIconURL1|. | 869 // and not |kIconURL1|. |
| 781 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL2, _, _)); | 870 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL2, _, _)); |
| 782 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL2, _, _)); | 871 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL2, _, _)); |
| 783 | 872 |
| 784 handler->OnUpdateCandidates(kPageURL, | 873 handler->OnUpdateCandidates( |
| 785 {FaviconURL(kIconURL2, FAVICON, kEmptySizes)}); | 874 kPageURL, {FaviconURL(kIconURL2, FAVICON, kEmptySizes)}, base::nullopt); |
| 786 | 875 |
| 787 // Finalizes the DB lookup, which should be thrown away as the favicon URLs | 876 // Finalizes the DB lookup, which should be thrown away as the favicon URLs |
| 788 // were updated. | 877 // were updated. |
| 789 EXPECT_TRUE(favicon_service_.fake()->RunCallbackManually()); | 878 EXPECT_TRUE(favicon_service_.fake()->RunCallbackManually()); |
| 790 base::RunLoop().RunUntilIdle(); | 879 base::RunLoop().RunUntilIdle(); |
| 791 | 880 |
| 792 EXPECT_THAT(favicon_service_.fake()->db_requests(), ElementsAre(kIconURL2)); | 881 EXPECT_THAT(favicon_service_.fake()->db_requests(), ElementsAre(kIconURL2)); |
| 793 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL2)); | 882 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL2)); |
| 794 } | 883 } |
| 795 | 884 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 812 std::unique_ptr<FaviconHandler> handler = RunHandlerWithCandidates( | 901 std::unique_ptr<FaviconHandler> handler = RunHandlerWithCandidates( |
| 813 FaviconDriverObserver::NON_TOUCH_16_DIP, favicon_urls); | 902 FaviconDriverObserver::NON_TOUCH_16_DIP, favicon_urls); |
| 814 | 903 |
| 815 ASSERT_THAT(favicon_service_.fake()->db_requests(), | 904 ASSERT_THAT(favicon_service_.fake()->db_requests(), |
| 816 ElementsAre(kPageURL, kIconURL64x64, kSlowLoadingIconURL)); | 905 ElementsAre(kPageURL, kIconURL64x64, kSlowLoadingIconURL)); |
| 817 ASSERT_TRUE(VerifyAndClearExpectations()); | 906 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 818 ASSERT_TRUE(delegate_.fake_image_downloader().HasPendingManualCallback()); | 907 ASSERT_TRUE(delegate_.fake_image_downloader().HasPendingManualCallback()); |
| 819 | 908 |
| 820 // Calling OnUpdateCandidates() with the same icon URLs should have no effect, | 909 // Calling OnUpdateCandidates() with the same icon URLs should have no effect, |
| 821 // despite the ongoing download. | 910 // despite the ongoing download. |
| 822 handler->OnUpdateCandidates(kPageURL, favicon_urls); | 911 handler->OnUpdateCandidates(kPageURL, favicon_urls, base::nullopt); |
| 823 base::RunLoop().RunUntilIdle(); | 912 base::RunLoop().RunUntilIdle(); |
| 824 EXPECT_THAT(favicon_service_.fake()->db_requests(), IsEmpty()); | 913 EXPECT_THAT(favicon_service_.fake()->db_requests(), IsEmpty()); |
| 825 EXPECT_THAT(delegate_.downloads(), IsEmpty()); | 914 EXPECT_THAT(delegate_.downloads(), IsEmpty()); |
| 826 | 915 |
| 827 // Complete the download. | 916 // Complete the download. |
| 828 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)); | 917 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)); |
| 829 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)); | 918 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)); |
| 830 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually()); | 919 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually()); |
| 831 base::RunLoop().RunUntilIdle(); | 920 base::RunLoop().RunUntilIdle(); |
| 832 EXPECT_THAT(delegate_.downloads(), IsEmpty()); | 921 EXPECT_THAT(delegate_.downloads(), IsEmpty()); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 846 | 935 |
| 847 // Ongoing database lookup. | 936 // Ongoing database lookup. |
| 848 ASSERT_THAT(favicon_service_.fake()->db_requests(), | 937 ASSERT_THAT(favicon_service_.fake()->db_requests(), |
| 849 ElementsAre(kPageURL, kIconURL64x64)); | 938 ElementsAre(kPageURL, kIconURL64x64)); |
| 850 ASSERT_THAT(delegate_.downloads(), IsEmpty()); | 939 ASSERT_THAT(delegate_.downloads(), IsEmpty()); |
| 851 ASSERT_TRUE(VerifyAndClearExpectations()); | 940 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 852 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); | 941 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); |
| 853 | 942 |
| 854 // Calling OnUpdateCandidates() with the same icon URLs should have no effect, | 943 // Calling OnUpdateCandidates() with the same icon URLs should have no effect, |
| 855 // despite the ongoing DB lookup. | 944 // despite the ongoing DB lookup. |
| 856 handler->OnUpdateCandidates(kPageURL, favicon_urls); | 945 handler->OnUpdateCandidates(kPageURL, favicon_urls, base::nullopt); |
| 857 base::RunLoop().RunUntilIdle(); | 946 base::RunLoop().RunUntilIdle(); |
| 858 EXPECT_THAT(favicon_service_.fake()->db_requests(), IsEmpty()); | 947 EXPECT_THAT(favicon_service_.fake()->db_requests(), IsEmpty()); |
| 859 EXPECT_THAT(delegate_.downloads(), IsEmpty()); | 948 EXPECT_THAT(delegate_.downloads(), IsEmpty()); |
| 860 | 949 |
| 861 // Complete the lookup. | 950 // Complete the lookup. |
| 862 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)); | 951 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)); |
| 863 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)); | 952 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)); |
| 864 EXPECT_TRUE(favicon_service_.fake()->RunCallbackManually()); | 953 EXPECT_TRUE(favicon_service_.fake()->RunCallbackManually()); |
| 865 base::RunLoop().RunUntilIdle(); | 954 base::RunLoop().RunUntilIdle(); |
| 866 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL64x64)); | 955 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL64x64)); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 877 | 966 |
| 878 std::unique_ptr<FaviconHandler> handler = RunHandlerWithCandidates( | 967 std::unique_ptr<FaviconHandler> handler = RunHandlerWithCandidates( |
| 879 FaviconDriverObserver::NON_TOUCH_16_DIP, favicon_urls); | 968 FaviconDriverObserver::NON_TOUCH_16_DIP, favicon_urls); |
| 880 | 969 |
| 881 ASSERT_TRUE(VerifyAndClearExpectations()); | 970 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 882 | 971 |
| 883 // Calling OnUpdateCandidates() with identical data should be a no-op. | 972 // Calling OnUpdateCandidates() with identical data should be a no-op. |
| 884 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)).Times(0); | 973 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, _, _, _)).Times(0); |
| 885 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)).Times(0); | 974 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)).Times(0); |
| 886 | 975 |
| 887 handler->OnUpdateCandidates(kPageURL, favicon_urls); | 976 handler->OnUpdateCandidates(kPageURL, favicon_urls, base::nullopt); |
| 888 base::RunLoop().RunUntilIdle(); | 977 base::RunLoop().RunUntilIdle(); |
| 889 EXPECT_THAT(favicon_service_.fake()->db_requests(), IsEmpty()); | 978 EXPECT_THAT(favicon_service_.fake()->db_requests(), IsEmpty()); |
| 890 EXPECT_THAT(delegate_.downloads(), IsEmpty()); | 979 EXPECT_THAT(delegate_.downloads(), IsEmpty()); |
| 891 } | 980 } |
| 892 | 981 |
| 893 // Fixes crbug.com/544560 | 982 // Fixes crbug.com/544560 |
| 894 // Tests that Delegate::OnFaviconUpdated() is called if: | 983 // Tests that Delegate::OnFaviconUpdated() is called if: |
| 895 // - The best icon on the initial page is not the last icon. | 984 // - The best icon on the initial page is not the last icon. |
| 896 // - All of the initial page's icons are downloaded. | 985 // - All of the initial page's icons are downloaded. |
| 897 // AND | 986 // AND |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 919 // database and downloaded. |kIconURL2| should have been fetched from the | 1008 // database and downloaded. |kIconURL2| should have been fetched from the |
| 920 // database and downloaded last. | 1009 // database and downloaded last. |
| 921 ASSERT_THAT(delegate_.downloads(), ElementsAre(kIconURL1, kIconURL2)); | 1010 ASSERT_THAT(delegate_.downloads(), ElementsAre(kIconURL1, kIconURL2)); |
| 922 ASSERT_THAT(favicon_service_.fake()->db_requests(), | 1011 ASSERT_THAT(favicon_service_.fake()->db_requests(), |
| 923 ElementsAre(kPageURL, kIconURL1, kIconURL2)); | 1012 ElementsAre(kPageURL, kIconURL1, kIconURL2)); |
| 924 ASSERT_TRUE(VerifyAndClearExpectations()); | 1013 ASSERT_TRUE(VerifyAndClearExpectations()); |
| 925 | 1014 |
| 926 // Simulate the page changing it's icon URL to just |kIconURL2| via | 1015 // Simulate the page changing it's icon URL to just |kIconURL2| via |
| 927 // Javascript. | 1016 // Javascript. |
| 928 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL2, _, _)); | 1017 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL2, _, _)); |
| 929 handler->OnUpdateCandidates(kPageURL, | 1018 handler->OnUpdateCandidates( |
| 930 {FaviconURL(kIconURL2, FAVICON, kEmptySizes)}); | 1019 kPageURL, {FaviconURL(kIconURL2, FAVICON, kEmptySizes)}, base::nullopt); |
| 931 base::RunLoop().RunUntilIdle(); | 1020 base::RunLoop().RunUntilIdle(); |
| 932 } | 1021 } |
| 933 | 1022 |
| 934 // Test the favicon which is selected when the web page provides several | 1023 // Test the favicon which is selected when the web page provides several |
| 935 // favicons and none of the favicons are cached in history. | 1024 // favicons and none of the favicons are cached in history. |
| 936 // The goal of this test is to be more of an integration test than | 1025 // The goal of this test is to be more of an integration test than |
| 937 // SelectFaviconFramesTest.*. | 1026 // SelectFaviconFramesTest.*. |
| 938 class FaviconHandlerMultipleFaviconsTest : public FaviconHandlerTest { | 1027 class FaviconHandlerMultipleFaviconsTest : public FaviconHandlerTest { |
| 939 protected: | 1028 protected: |
| 940 FaviconHandlerMultipleFaviconsTest() { | 1029 FaviconHandlerMultipleFaviconsTest() { |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1363 .WillByDefault(Return(true)); | 1452 .WillByDefault(Return(true)); |
| 1364 | 1453 |
| 1365 RunHandlerWithSimpleFaviconCandidates({k404IconURL}); | 1454 RunHandlerWithSimpleFaviconCandidates({k404IconURL}); |
| 1366 | 1455 |
| 1367 EXPECT_THAT( | 1456 EXPECT_THAT( |
| 1368 histogram_tester.GetAllSamples("Favicons.DownloadOutcome"), | 1457 histogram_tester.GetAllSamples("Favicons.DownloadOutcome"), |
| 1369 ElementsAre(base::Bucket(static_cast<int>(DownloadOutcome::SKIPPED), | 1458 ElementsAre(base::Bucket(static_cast<int>(DownloadOutcome::SKIPPED), |
| 1370 /*expected_count=*/1))); | 1459 /*expected_count=*/1))); |
| 1371 } | 1460 } |
| 1372 | 1461 |
| 1462 // Test that the support for Web Manifest is disabled by default, unless the | |
| 1463 // feature is enabled. | |
| 1464 TEST_F(FaviconHandlerTest, IgnoreWebManifestByDefault) { | |
| 1465 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1466 | |
| 1467 RunHandlerWithSimpleFaviconCandidates({kIconURL16x16}, kManifestURL); | |
| 1468 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1469 Not(Contains(kManifestURL))); | |
| 1470 EXPECT_THAT(delegate_.downloads(), Not(Contains(kManifestURL))); | |
| 1471 } | |
| 1472 | |
| 1473 class FaviconHandlerManifestsEnabledTest : public FaviconHandlerTest { | |
| 1474 protected: | |
| 1475 FaviconHandlerManifestsEnabledTest() { | |
| 1476 override_features_.InitAndEnableFeature(kFaviconsFromWebManifest); | |
| 1477 } | |
| 1478 | |
| 1479 private: | |
| 1480 base::test::ScopedFeatureList override_features_; | |
|
pkotwicz
2017/05/12 07:20:26
Nit: DISALLOW_COPY_AND_ASSIGN(FaviconHandlerManife
mastiz
2017/05/12 13:31:33
Done, although it's unnecessary because the base c
| |
| 1481 }; | |
| 1482 | |
| 1483 // Test that a favicon corresponding to a web manifest is reported when: | |
| 1484 // - There is data in the favicon database for the manifest URL. | |
| 1485 // AND | |
| 1486 // - FaviconService::OnFaviconDataForManifestFromFaviconService() runs before | |
| 1487 // FaviconHandler::OnUpdateCandidates() is called. | |
|
pkotwicz
2017/05/12 07:20:26
You mean FaviconHandler::OnFaviconDataForInitialUR
mastiz
2017/05/12 13:31:33
Done.
| |
| 1488 TEST_F(FaviconHandlerManifestsEnabledTest, | |
| 1489 GetFaviconFromManifestInHistoryIfCandidatesSlower) { | |
| 1490 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1491 | |
| 1492 favicon_service_.fake()->Store(kPageURL, kManifestURL, | |
| 1493 CreateRawBitmapResult(kManifestURL)); | |
| 1494 | |
| 1495 EXPECT_CALL(favicon_service_, UnableToDownloadFavicon(_)).Times(0); | |
| 1496 | |
| 1497 EXPECT_CALL(favicon_service_, | |
| 1498 UpdateFaviconMappingsAndFetch(_, kManifestURL, FAVICON, | |
| 1499 /*desired_size_in_dip=*/16, _, _)); | |
| 1500 EXPECT_CALL(delegate_, | |
| 1501 OnFaviconUpdated(_, FaviconDriverObserver::NON_TOUCH_16_DIP, | |
| 1502 kManifestURL, _, _)) | |
| 1503 .Times(2); | |
| 1504 | |
| 1505 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1506 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1507 ElementsAre(kPageURL, kManifestURL)); | |
| 1508 EXPECT_THAT(delegate_.downloads(), IsEmpty()); | |
| 1509 } | |
| 1510 | |
| 1511 // Test that a favicon corresponding to a web manifest is reported when: | |
| 1512 // - There is data in the favicon database for the manifest URL. | |
| 1513 // AND | |
| 1514 // - FaviconHandler::OnUpdateCandidates() is called before | |
| 1515 // FaviconService::OnFaviconDataForManifestFromFaviconService() runs. | |
|
pkotwicz
2017/05/12 07:20:26
You mean FaviconHandler::OnFaviconDataForInitialUR
mastiz
2017/05/12 13:31:33
Done.
| |
| 1516 TEST_F(FaviconHandlerManifestsEnabledTest, | |
| 1517 GetFaviconFromManifestInHistoryIfCandidatesFaster) { | |
| 1518 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1519 | |
| 1520 favicon_service_.fake()->Store(kPageURL, kManifestURL, | |
| 1521 CreateRawBitmapResult(kManifestURL)); | |
| 1522 | |
| 1523 EXPECT_CALL(favicon_service_, UnableToDownloadFavicon(_)).Times(0); | |
| 1524 | |
| 1525 EXPECT_CALL(favicon_service_, | |
| 1526 UpdateFaviconMappingsAndFetch(_, kManifestURL, FAVICON, | |
| 1527 /*desired_size_in_dip=*/16, _, _)); | |
| 1528 EXPECT_CALL(delegate_, | |
| 1529 OnFaviconUpdated(_, FaviconDriverObserver::NON_TOUCH_16_DIP, | |
| 1530 kManifestURL, _, _)) | |
| 1531 .Times(2); | |
| 1532 | |
| 1533 FaviconHandler handler(&favicon_service_, &delegate_, | |
| 1534 FaviconDriverObserver::NON_TOUCH_16_DIP); | |
| 1535 handler.FetchFavicon(kPageURL); | |
| 1536 // Feed in candidates without processing posted tasks (RunUntilIdle()). | |
| 1537 handler.OnUpdateCandidates(kPageURL, | |
| 1538 {FaviconURL(kIconURL12x12, FAVICON, kEmptySizes)}, | |
| 1539 kManifestURL); | |
| 1540 base::RunLoop().RunUntilIdle(); | |
| 1541 | |
| 1542 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1543 ElementsAre(kPageURL, kManifestURL)); | |
| 1544 EXPECT_THAT(delegate_.downloads(), IsEmpty()); | |
| 1545 } | |
| 1546 | |
| 1547 // Test that a favicon corresponding to a web manifest is reported when there is | |
| 1548 // data in the database for neither the page URL nor the manifest URL. | |
| 1549 TEST_F(FaviconHandlerManifestsEnabledTest, GetFaviconFromUnknownManifest) { | |
| 1550 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1551 const std::vector<favicon::FaviconURL> kManifestIcons = { | |
| 1552 FaviconURL(kIconURL16x16, FAVICON, kEmptySizes), | |
| 1553 }; | |
| 1554 | |
| 1555 delegate_.fake_manifest_downloader().Add(kManifestURL, kManifestIcons); | |
| 1556 | |
| 1557 EXPECT_CALL(favicon_service_, UnableToDownloadFavicon(_)).Times(0); | |
| 1558 | |
| 1559 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL, FAVICON, _)); | |
| 1560 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL, _, _)); | |
| 1561 | |
| 1562 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1563 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1564 ElementsAre(kPageURL, kManifestURL)); | |
| 1565 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL16x16)); | |
| 1566 } | |
| 1567 | |
| 1568 // Test that the manifest and icon are redownloaded if the icon cached for the | |
| 1569 // page URL expired. | |
| 1570 TEST_F(FaviconHandlerManifestsEnabledTest, GetFaviconFromExpiredManifest) { | |
| 1571 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1572 const std::vector<favicon::FaviconURL> kManifestIcons = { | |
| 1573 FaviconURL(kIconURL64x64, FAVICON, kEmptySizes), | |
| 1574 }; | |
| 1575 | |
| 1576 favicon_service_.fake()->Store(kPageURL, kManifestURL, | |
| 1577 CreateRawBitmapResult(kManifestURL, FAVICON, | |
| 1578 /*expired=*/true)); | |
| 1579 delegate_.fake_manifest_downloader().Add(kManifestURL, kManifestIcons); | |
| 1580 | |
| 1581 // The third notification is unnecessary, but allows simplifying the code. | |
| 1582 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL, _, _)).Times(3); | |
| 1583 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL, _, _)); | |
| 1584 | |
| 1585 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1586 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1587 ElementsAre(kPageURL, kManifestURL)); | |
| 1588 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL64x64)); | |
| 1589 } | |
| 1590 | |
| 1591 // Test that the manifest and icon are redownloaded if the icon cached for the | |
| 1592 // manifest URL expired, which was observed during a visit to a different page | |
| 1593 // URL. | |
| 1594 TEST_F(FaviconHandlerManifestsEnabledTest, | |
| 1595 GetFaviconFromExpiredManifestLinkedFromOtherPage) { | |
| 1596 const GURL kSomePreviousPageURL("https://www.google.com/previous"); | |
| 1597 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1598 const std::vector<favicon::FaviconURL> kManifestIcons = { | |
| 1599 FaviconURL(kIconURL64x64, FAVICON, kEmptySizes), | |
| 1600 }; | |
| 1601 | |
| 1602 favicon_service_.fake()->Store(kSomePreviousPageURL, kManifestURL, | |
| 1603 CreateRawBitmapResult(kManifestURL, FAVICON, | |
| 1604 /*expired=*/true)); | |
| 1605 delegate_.fake_manifest_downloader().Add(kManifestURL, kManifestIcons); | |
| 1606 | |
| 1607 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL, _, _)).Times(2); | |
| 1608 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL, _, _)); | |
| 1609 | |
| 1610 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1611 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1612 ElementsAre(kPageURL, kManifestURL)); | |
| 1613 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL64x64)); | |
| 1614 } | |
| 1615 | |
| 1616 // Test that a favicon corresponding to a web manifest is reported when: | |
| 1617 // - There is data in the database for neither the page URL nor the manifest | |
| 1618 // URL. | |
| 1619 // - There is data in the database for the icon URL listed in the manifest. | |
| 1620 TEST_F(FaviconHandlerManifestsEnabledTest, | |
| 1621 GetFaviconFromUnknownManifestButKnownIcon) { | |
| 1622 const GURL kSomePreviousPageURL("https://www.google.com/previous"); | |
| 1623 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1624 const std::vector<favicon::FaviconURL> kManifestIcons = { | |
| 1625 FaviconURL(kIconURL16x16, FAVICON, kEmptySizes), | |
| 1626 }; | |
| 1627 | |
| 1628 favicon_service_.fake()->Store(kSomePreviousPageURL, kIconURL16x16, | |
| 1629 CreateRawBitmapResult(kIconURL16x16)); | |
| 1630 delegate_.fake_manifest_downloader().Add(kManifestURL, kManifestIcons); | |
| 1631 | |
| 1632 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL, FAVICON, _)); | |
|
pkotwicz
2017/05/12 07:20:26
We don't care about the icon type here
mastiz
2017/05/12 13:31:33
Done.
| |
| 1633 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL, _, _)); | |
| 1634 | |
| 1635 RunHandlerWithSimpleFaviconCandidates(URLVector(), kManifestURL); | |
| 1636 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1637 ElementsAre(kPageURL, kManifestURL)); | |
| 1638 // In the current implementation, the icon is downloaded although it's in the | |
| 1639 // database. This is because the icon has been cached earlier using the icon | |
| 1640 // URL instead of the manifest's URL. | |
|
pkotwicz
2017/05/12 07:20:26
How about: "This is because FaviconHandler only ch
mastiz
2017/05/12 13:31:33
Done.
| |
| 1641 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL16x16)); | |
| 1642 } | |
| 1643 | |
| 1644 // Test that attempting to download a manifest that returns a 404 gets | |
| 1645 // blacklisted via UnableToDownloadFavicon() AND that the regular favicon is | |
| 1646 // selected as fallback. | |
| 1647 TEST_F(FaviconHandlerManifestsEnabledTest, UnknownManifestReturning404) { | |
| 1648 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1649 | |
| 1650 EXPECT_CALL(favicon_service_, UnableToDownloadFavicon(kManifestURL)); | |
| 1651 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL12x12, FAVICON, _)); | |
|
pkotwicz
2017/05/12 07:20:26
We don't care about the icon type here either
mastiz
2017/05/12 13:31:33
Done.
| |
| 1652 | |
| 1653 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1654 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1655 ElementsAre(kPageURL, kManifestURL, kIconURL12x12)); | |
| 1656 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL12x12)); | |
| 1657 } | |
| 1658 | |
| 1659 // Test that a manifest that was previously blacklisted via | |
| 1660 // UnableToDownloadFavicon() is ignored and that the regular favicon is selected | |
| 1661 // as fallback. | |
| 1662 TEST_F(FaviconHandlerManifestsEnabledTest, IgnoreManifestWithPrior404) { | |
| 1663 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1664 | |
| 1665 ON_CALL(favicon_service_, WasUnableToDownloadFavicon(kManifestURL)) | |
| 1666 .WillByDefault(Return(true)); | |
| 1667 | |
| 1668 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL12x12, FAVICON, _)); | |
| 1669 | |
| 1670 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1671 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1672 ElementsAre(kPageURL, kIconURL12x12)); | |
| 1673 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL12x12)); | |
| 1674 } | |
| 1675 | |
| 1676 // Test that the regular favicon is selected when: | |
| 1677 // - The page links to a Web Manifest. | |
| 1678 // - The Web Manifest does not contain any icon URLs (it is not a 404). | |
| 1679 // - The page has an icon URL provided via a <link rel="icon"> tag. | |
| 1680 // - The database does not know about the page URL, manifest URL or icon URL. | |
| 1681 TEST_F(FaviconHandlerManifestsEnabledTest, UnknownManifestWithoutIcons) { | |
| 1682 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1683 | |
| 1684 delegate_.fake_manifest_downloader().Add(kManifestURL, | |
| 1685 std::vector<favicon::FaviconURL>()); | |
| 1686 | |
| 1687 // UnableToDownloadFavicon() is expected to prevent repeated downloads of the | |
| 1688 // same manifest (which is not otherwise cached, since it doesn't contain | |
| 1689 // icons). | |
| 1690 EXPECT_CALL(favicon_service_, UnableToDownloadFavicon(kManifestURL)); | |
| 1691 EXPECT_CALL(favicon_service_, SetFavicons(_, kIconURL12x12, FAVICON, _)); | |
| 1692 | |
| 1693 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1694 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1695 ElementsAre(kPageURL, kManifestURL, kIconURL12x12)); | |
| 1696 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL12x12)); | |
| 1697 } | |
| 1698 | |
| 1699 // Test that the regular favicon is selected when: | |
| 1700 // - The page links to a Web Manifest. | |
| 1701 // - The Web Manifest does not contain any icon URLs (it is not a 404). | |
| 1702 // - The page has an icon URL provided via a <link rel="icon"> tag. | |
| 1703 // - The database does not know about the page URL. | |
| 1704 // - The database does not know about the manifest URL. | |
| 1705 // - The database knows about the icon URL. | |
| 1706 TEST_F(FaviconHandlerManifestsEnabledTest, | |
| 1707 UnknownManifestWithoutIconsAndKnownRegularIcons) { | |
| 1708 const GURL kSomePreviousPageURL("https://www.google.com/previous"); | |
| 1709 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1710 | |
| 1711 delegate_.fake_manifest_downloader().Add(kManifestURL, | |
| 1712 std::vector<favicon::FaviconURL>()); | |
| 1713 favicon_service_.fake()->Store(kSomePreviousPageURL, kIconURL12x12, | |
| 1714 CreateRawBitmapResult(kIconURL12x12)); | |
| 1715 | |
| 1716 EXPECT_CALL(favicon_service_, SetFavicons(_, _, _, _)).Times(0); | |
| 1717 | |
| 1718 // UnableToDownloadFavicon() is expected to prevent repeated downloads of the | |
| 1719 // same manifest (which is not otherwise cached, since it doesn't contain | |
| 1720 // icons). | |
| 1721 EXPECT_CALL(favicon_service_, UnableToDownloadFavicon(kManifestURL)); | |
| 1722 EXPECT_CALL(favicon_service_, | |
| 1723 UpdateFaviconMappingsAndFetch(_, kManifestURL, _, _, _, _)); | |
| 1724 EXPECT_CALL(favicon_service_, | |
| 1725 UpdateFaviconMappingsAndFetch(_, kIconURL12x12, _, _, _, _)); | |
| 1726 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL12x12, _, _)); | |
| 1727 | |
| 1728 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1729 EXPECT_THAT(favicon_service_.fake()->db_requests(), | |
| 1730 ElementsAre(kPageURL, kManifestURL, kIconURL12x12)); | |
| 1731 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL)); | |
| 1732 } | |
| 1733 | |
| 1734 // Test that Delegate::OnFaviconUpdated() is called if a page uses Javascript to | |
| 1735 // modify the page's <link rel="manifest"> tag to point to a different manifest. | |
| 1736 TEST_F(FaviconHandlerManifestsEnabledTest, ManifestUpdateViaJavascript) { | |
| 1737 const GURL kManifestURL1("http://www.google.com/manifest1.json"); | |
| 1738 const GURL kManifestURL2("http://www.google.com/manifest2.json"); | |
| 1739 const std::vector<favicon::FaviconURL> kManifestIcons1 = { | |
| 1740 FaviconURL(kIconURL64x64, FAVICON, kEmptySizes), | |
| 1741 }; | |
| 1742 const std::vector<favicon::FaviconURL> kManifestIcons2 = { | |
| 1743 FaviconURL(kIconURL10x10, FAVICON, kEmptySizes), | |
| 1744 }; | |
| 1745 | |
| 1746 delegate_.fake_manifest_downloader().Add(kManifestURL1, kManifestIcons1); | |
| 1747 delegate_.fake_manifest_downloader().Add(kManifestURL2, kManifestIcons2); | |
| 1748 | |
| 1749 std::unique_ptr<FaviconHandler> handler = | |
| 1750 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL1); | |
| 1751 ASSERT_THAT(favicon_service_.fake()->db_requests(), | |
| 1752 ElementsAre(kPageURL, kManifestURL1)); | |
| 1753 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL1, kIconURL64x64)); | |
| 1754 ASSERT_TRUE(VerifyAndClearExpectations()); | |
| 1755 | |
| 1756 // Simulate the page changing it's manifest URL via Javascript. | |
| 1757 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL2, _, _)); | |
| 1758 handler->OnUpdateCandidates(kPageURL, | |
| 1759 {FaviconURL(kIconURL12x12, FAVICON, kEmptySizes)}, | |
| 1760 kManifestURL2); | |
| 1761 base::RunLoop().RunUntilIdle(); | |
| 1762 ASSERT_THAT(favicon_service_.fake()->db_requests(), | |
| 1763 ElementsAre(kManifestURL2)); | |
| 1764 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL2, kIconURL10x10)); | |
| 1765 } | |
| 1766 | |
| 1767 // Test that Delegate::OnFaviconUpdated() is called if a page uses Javascript to | |
| 1768 // remove the page's <link rel="manifest"> tag (i.e. no web manifest) WHILE a | |
| 1769 // lookup to the history database is ongoing for the manifest URL. | |
| 1770 TEST_F(FaviconHandlerManifestsEnabledTest, | |
| 1771 RemoveManifestViaJavascriptWhileHistoryQuery) { | |
| 1772 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1773 const std::vector<favicon::FaviconURL> kManifestIcons = { | |
| 1774 FaviconURL(kIconURL64x64, FAVICON, kEmptySizes), | |
| 1775 }; | |
| 1776 | |
| 1777 delegate_.fake_manifest_downloader().Add(kManifestURL, kManifestIcons); | |
| 1778 // Defer the database lookup completion such that RunUntilIdle() doesn't | |
| 1779 // complete it. | |
| 1780 favicon_service_.fake()->SetRunCallbackManuallyForUrl(kManifestURL); | |
| 1781 | |
| 1782 std::unique_ptr<FaviconHandler> handler = | |
| 1783 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}, kManifestURL); | |
| 1784 ASSERT_THAT(favicon_service_.fake()->db_requests(), | |
| 1785 ElementsAre(kPageURL, kManifestURL)); | |
| 1786 // Database lookup for |kManifestURL1| is ongoing. | |
| 1787 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); | |
| 1788 | |
| 1789 // Simulate the page changing it's manifest URL to empty via Javascript. | |
| 1790 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kIconURL12x12, _, _)); | |
| 1791 handler->OnUpdateCandidates(kPageURL, | |
| 1792 {FaviconURL(kIconURL12x12, FAVICON, kEmptySizes)}, | |
| 1793 base::nullopt); | |
| 1794 // Complete the lookup. | |
| 1795 EXPECT_TRUE(favicon_service_.fake()->RunCallbackManually()); | |
| 1796 base::RunLoop().RunUntilIdle(); | |
| 1797 ASSERT_THAT(favicon_service_.fake()->db_requests(), | |
| 1798 ElementsAre(kPageURL, kManifestURL, kIconURL12x12)); | |
| 1799 EXPECT_THAT(delegate_.downloads(), ElementsAre(kIconURL12x12)); | |
| 1800 } | |
| 1801 | |
| 1802 // Test that Delegate::OnFaviconUpdated() is called a page without manifest uses | |
| 1803 // Javascript to add a <link rel="manifest"> tag (i.e. a new web manifest) WHILE | |
| 1804 // a lookup to the history database is ongoing for the icon URL. | |
| 1805 TEST_F(FaviconHandlerManifestsEnabledTest, | |
| 1806 AddManifestViaJavascriptWhileHistoryQuery) { | |
| 1807 const GURL kManifestURL("http://www.google.com/manifest.json"); | |
| 1808 const std::vector<favicon::FaviconURL> kManifestIcons = { | |
| 1809 FaviconURL(kIconURL64x64, FAVICON, kEmptySizes), | |
| 1810 }; | |
| 1811 | |
| 1812 delegate_.fake_manifest_downloader().Add(kManifestURL, kManifestIcons); | |
| 1813 // Defer the database lookup completion such that RunUntilIdle() doesn't | |
| 1814 // complete it. | |
| 1815 favicon_service_.fake()->SetRunCallbackManuallyForUrl(kIconURL12x12); | |
| 1816 | |
| 1817 std::unique_ptr<FaviconHandler> handler = | |
| 1818 RunHandlerWithSimpleFaviconCandidates({kIconURL12x12}); | |
| 1819 ASSERT_THAT(favicon_service_.fake()->db_requests(), | |
| 1820 ElementsAre(kPageURL, kIconURL12x12)); | |
| 1821 // Database lookup for |kIconURL12x12| is ongoing. | |
| 1822 ASSERT_TRUE(favicon_service_.fake()->HasPendingManualCallback()); | |
| 1823 | |
| 1824 // Simulate the page changing it's manifest URL to |kManifestURL| via | |
| 1825 // Javascript. | |
| 1826 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL, _, _)); | |
| 1827 handler->OnUpdateCandidates(kPageURL, | |
| 1828 {FaviconURL(kIconURL12x12, FAVICON, kEmptySizes)}, | |
| 1829 kManifestURL); | |
| 1830 // Complete the lookup. | |
| 1831 EXPECT_TRUE(favicon_service_.fake()->RunCallbackManually()); | |
| 1832 base::RunLoop().RunUntilIdle(); | |
| 1833 ASSERT_THAT(favicon_service_.fake()->db_requests(), | |
| 1834 ElementsAre(kPageURL, kIconURL12x12, kManifestURL)); | |
| 1835 EXPECT_THAT(delegate_.downloads(), ElementsAre(kManifestURL, kIconURL64x64)); | |
| 1836 } | |
| 1837 | |
| 1373 } // namespace | 1838 } // namespace |
| 1374 } // namespace favicon | 1839 } // namespace favicon |
| OLD | NEW |