| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/favicon_downloader.h" | 5 #include "chrome/browser/extensions/favicon_downloader.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 9 #include "content/public/common/favicon_url.h" | 9 #include "content/public/common/favicon_url.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 void CompleteImageDownload( | 81 void CompleteImageDownload( |
| 82 int id, | 82 int id, |
| 83 const GURL& image_url, | 83 const GURL& image_url, |
| 84 const std::vector<gfx::Size>& original_bitmap_sizes) { | 84 const std::vector<gfx::Size>& original_bitmap_sizes) { |
| 85 FaviconDownloader::DidDownloadFavicon(id, 200, image_url, | 85 FaviconDownloader::DidDownloadFavicon(id, 200, image_url, |
| 86 CreateTestBitmaps(original_bitmap_sizes), original_bitmap_sizes); | 86 CreateTestBitmaps(original_bitmap_sizes), original_bitmap_sizes); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void UpdateFaviconURLs(const std::vector<content::FaviconURL>& candidates) { | 89 void UpdateFaviconURLs(const std::vector<content::FaviconURL>& candidates) { |
| 90 FaviconDownloader::DidUpdateFaviconURL(0, candidates); | 90 FaviconDownloader::DidUpdateFaviconURL(candidates); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void set_initial_favicon_urls(const std::vector<content::FaviconURL>& urls) { | 93 void set_initial_favicon_urls(const std::vector<content::FaviconURL>& urls) { |
| 94 initial_favicon_urls_ = urls; | 94 initial_favicon_urls_ = urls; |
| 95 } | 95 } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 std::vector<content::FaviconURL> initial_favicon_urls_; | 98 std::vector<content::FaviconURL> initial_favicon_urls_; |
| 99 FaviconDownloader::FaviconMap favicon_map_; | 99 FaviconDownloader::FaviconMap favicon_map_; |
| 100 int id_counter_; | 100 int id_counter_; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // Only 1 download should have been initiated for |empty_favicon| even though | 184 // Only 1 download should have been initiated for |empty_favicon| even though |
| 185 // the URL was in both the web app info and the favicon urls. | 185 // the URL was in both the web app info and the favicon urls. |
| 186 downloader.CompleteImageDownload(2, empty_favicon, std::vector<gfx::Size>()); | 186 downloader.CompleteImageDownload(2, empty_favicon, std::vector<gfx::Size>()); |
| 187 EXPECT_EQ(0u, downloader.pending_requests()); | 187 EXPECT_EQ(0u, downloader.pending_requests()); |
| 188 | 188 |
| 189 EXPECT_EQ(3u, downloader.favicon_map().size()); | 189 EXPECT_EQ(3u, downloader.favicon_map().size()); |
| 190 EXPECT_EQ(0u, downloader.favicon_map()[empty_favicon].size()); | 190 EXPECT_EQ(0u, downloader.favicon_map()[empty_favicon].size()); |
| 191 EXPECT_EQ(1u, downloader.favicon_map()[favicon_url_1].size()); | 191 EXPECT_EQ(1u, downloader.favicon_map()[favicon_url_1].size()); |
| 192 EXPECT_EQ(2u, downloader.favicon_map()[favicon_url_2].size()); | 192 EXPECT_EQ(2u, downloader.favicon_map()[favicon_url_2].size()); |
| 193 } | 193 } |
| OLD | NEW |