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 "chrome/browser/favicon/favicon_handler.h" | 5 #include "chrome/browser/favicon/favicon_handler.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/favicon/chrome_favicon_client.h" | 8 #include "chrome/browser/favicon/chrome_favicon_client.h" |
9 #include "chrome/browser/favicon/chrome_favicon_client_factory.h" | 9 #include "chrome/browser/favicon/chrome_favicon_client_factory.h" |
10 #include "chrome/browser/favicon/favicon_service.h" | 10 #include "chrome/browser/favicon/favicon_service.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return -1; | 220 return -1; |
221 } | 221 } |
222 | 222 |
223 void NotifyFaviconUpdated(bool icon_url_changed) override { | 223 void NotifyFaviconUpdated(bool icon_url_changed) override { |
224 ADD_FAILURE() << "TestFaviconDriver::NotifyFaviconUpdated() " | 224 ADD_FAILURE() << "TestFaviconDriver::NotifyFaviconUpdated() " |
225 << "should never be called in tests."; | 225 << "should never be called in tests."; |
226 } | 226 } |
227 | 227 |
228 void SetActiveURL(GURL url) { url_ = url; } | 228 void SetActiveURL(GURL url) { url_ = url; } |
229 | 229 |
| 230 void OnFaviconAvailable(const gfx::Image& image) { available_image_ = image; } |
| 231 |
| 232 const gfx::Image GetAvailableImage() { return available_image_; } |
| 233 |
230 private: | 234 private: |
231 GURL favicon_url_; | 235 GURL favicon_url_; |
232 GURL url_; | 236 GURL url_; |
233 gfx::Image image_; | 237 gfx::Image image_; |
234 bool favicon_validity_; | 238 bool favicon_validity_; |
| 239 gfx::Image available_image_; |
235 DISALLOW_COPY_AND_ASSIGN(TestFaviconDriver); | 240 DISALLOW_COPY_AND_ASSIGN(TestFaviconDriver); |
236 }; | 241 }; |
237 | 242 |
238 // This class is used to catch the FaviconHandler's download and history | 243 // This class is used to catch the FaviconHandler's download and history |
239 // request, and also provide the methods to access the FaviconHandler | 244 // request, and also provide the methods to access the FaviconHandler |
240 // internals. | 245 // internals. |
241 class TestFaviconHandler : public FaviconHandler { | 246 class TestFaviconHandler : public FaviconHandler { |
242 public: | 247 public: |
243 static int GetMaximalIconSize(favicon_base::IconType icon_type) { | 248 static int GetMaximalIconSize(favicon_base::IconType icon_type) { |
244 return FaviconHandler::GetMaximalIconSize(icon_type); | 249 return FaviconHandler::GetMaximalIconSize(icon_type); |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0); | 1547 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0); |
1543 EXPECT_NE(0, download_id); | 1548 EXPECT_NE(0, download_id); |
1544 // Report download success with HTTP 200 status. | 1549 // Report download success with HTTP 200 status. |
1545 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url, | 1550 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url, |
1546 empty_icons, empty_icon_sizes); | 1551 empty_icons, empty_icon_sizes); |
1547 // Icon is not marked as UnableToDownload as HTTP status is not 404. | 1552 // Icon is not marked as UnableToDownload as HTTP status is not 404. |
1548 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url)); | 1553 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url)); |
1549 } | 1554 } |
1550 | 1555 |
1551 } // namespace. | 1556 } // namespace. |
OLD | NEW |