Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: chrome/browser/favicon/favicon_handler_unittest.cc

Issue 10910212: Enable hidpi favicons for favicons history does not know about (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/favicon/favicon_handler.cc ('k') | chrome/browser/favicon/favicon_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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.
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_handler.cc ('k') | chrome/browser/favicon/favicon_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698