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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "chrome/browser/favicon/favicon_handler.h" | 6 #include "chrome/browser/favicon/favicon_handler.h" |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.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/browser/invalidate_type.h" | 9 #include "content/public/browser/invalidate_type.h" |
10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 history_handler_.reset(new HistoryRequestHandler(page_url, GURL(), | 293 history_handler_.reset(new HistoryRequestHandler(page_url, GURL(), |
294 icon_types, callback)); | 294 icon_types, callback)); |
295 } | 295 } |
296 | 296 |
297 virtual int DownloadFavicon(const GURL& image_url, int image_size) OVERRIDE { | 297 virtual int DownloadFavicon(const GURL& image_url, int image_size) OVERRIDE { |
298 download_id_++; | 298 download_id_++; |
299 download_handler_->AddDownload(download_id_, image_url, image_size); | 299 download_handler_->AddDownload(download_id_, image_url, image_size); |
300 return download_id_; | 300 return download_id_; |
301 } | 301 } |
302 | 302 |
303 virtual void SetHistoryFavicon(const GURL& page_url, | 303 virtual void SetHistoryFavicons(const GURL& page_url, |
304 const GURL& icon_url, | 304 const GURL& icon_url, |
305 const std::vector<unsigned char>& bitmap_data, | 305 history::IconType icon_type, |
306 history::IconType icon_type) OVERRIDE { | 306 const gfx::Image& image) OVERRIDE { |
| 307 std::vector<unsigned char> bitmap_data; |
| 308 if (!image.IsEmpty()) |
| 309 bitmap_data = *image.ToImagePNG(); |
307 history_handler_.reset(new HistoryRequestHandler( | 310 history_handler_.reset(new HistoryRequestHandler( |
308 page_url, icon_url,icon_type, bitmap_data, | 311 page_url, icon_url, icon_type, bitmap_data, |
309 FaviconService::FaviconResultsCallback())); | 312 FaviconService::FaviconResultsCallback())); |
310 } | 313 } |
311 | 314 |
312 virtual FaviconService* GetFaviconService() OVERRIDE { | 315 virtual FaviconService* GetFaviconService() OVERRIDE { |
313 // Just give none NULL value, so overridden methods can be hit. | 316 // Just give none NULL value, so overridden methods can be hit. |
314 return (FaviconService*)(1); | 317 return (FaviconService*)(1); |
315 } | 318 } |
316 | 319 |
317 virtual bool ShouldSaveFavicon(const GURL& url) OVERRIDE { | 320 virtual bool ShouldSaveFavicon(const GURL& url) OVERRIDE { |
318 return true; | 321 return true; |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 download_handler->SetImageSize(kLargeSize); | 1006 download_handler->SetImageSize(kLargeSize); |
1004 download_handler->InvokeCallback(); | 1007 download_handler->InvokeCallback(); |
1005 | 1008 |
1006 // Check that the callback was invoked with the unresized bitmap. | 1009 // Check that the callback was invoked with the unresized bitmap. |
1007 const gfx::Size& downloaded_bitmap_size = downloader.downloaded_bitmap_size(); | 1010 const gfx::Size& downloaded_bitmap_size = downloader.downloaded_bitmap_size(); |
1008 EXPECT_EQ(kLargeSize, downloaded_bitmap_size.width()); | 1011 EXPECT_EQ(kLargeSize, downloaded_bitmap_size.width()); |
1009 EXPECT_EQ(kLargeSize, downloaded_bitmap_size.height()); | 1012 EXPECT_EQ(kLargeSize, downloaded_bitmap_size.height()); |
1010 } | 1013 } |
1011 | 1014 |
1012 } // namespace. | 1015 } // namespace. |
OLD | NEW |