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

Unified Diff: chrome/browser/favicon/favicon_handler_unittest.cc

Issue 10918186: Expire favicons which were added with default favicon sizes (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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/favicon/favicon_handler_unittest.cc
diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc
index f31c6cc9728659012005cab6ae4fea2f36f23c05..5dd50e177fc75eac8332fb1a6e6253f433a7257f 100644
--- a/chrome/browser/favicon/favicon_handler_unittest.cc
+++ b/chrome/browser/favicon/favicon_handler_unittest.cc
@@ -54,7 +54,8 @@ void SetFaviconBitmapResult(
history::FaviconBitmapResult bitmap_result;
bitmap_result.expired = expired;
bitmap_result.bitmap_data = data;
- bitmap_result.pixel_size = gfx::Size();
+ // Use a pixel size other than (0,0) as (0,0) has a special meaning.
+ bitmap_result.pixel_size = gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize);
bitmap_result.icon_type = icon_type;
bitmap_result.icon_url = icon_url;
@@ -339,8 +340,20 @@ class TestFaviconHandler : public FaviconHandler {
namespace {
void HistoryRequestHandler::InvokeCallback() {
- if (!callback_.is_null())
- callback_.Run(0, history_results_, history::IconURLSizesMap());
+ if (!callback_.is_null()) {
+ history::IconURLSizesMap icon_url_sizes;
+ // Build IconURLSizesMap such that the requirement that all the icon URLs
+ // in |history_results_| be present in |icon_url_sizes| holds.
+ // Add the pixel size for each of |history_results_| to |icon_url_sizes|
+ // as empty favicon sizes has a special meaning.
+ for (size_t i = 0; i < history_results_.size(); ++i) {
+ const history::FaviconBitmapResult& bitmap_result = history_results_[i];
+ const GURL& icon_url = bitmap_result.icon_url;
+ icon_url_sizes[icon_url].push_back(bitmap_result.pixel_size);
+ }
+
+ callback_.Run(0, history_results_, icon_url_sizes);
+ }
}
void DownloadHandler::InvokeCallback() {
« no previous file with comments | « chrome/browser/favicon/favicon_handler.cc ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698