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

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

Issue 10824319: Give SelectFaviconFrames a quality score. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 8 years, 4 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
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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 callback_.Run(0, favicon_data_); 294 callback_.Run(0, favicon_data_);
295 } 295 }
296 296
297 void DownloadHandler::InvokeCallback() { 297 void DownloadHandler::InvokeCallback() {
298 SkBitmap bitmap; 298 SkBitmap bitmap;
299 int bitmap_size = (download_->image_size > 0) ? 299 int bitmap_size = (download_->image_size > 0) ?
300 download_->image_size : gfx::kFaviconSize; 300 download_->image_size : gfx::kFaviconSize;
301 FillDataToBitmap(bitmap_size, bitmap_size, &bitmap); 301 FillDataToBitmap(bitmap_size, bitmap_size, &bitmap);
302 gfx::Image image(bitmap); 302 gfx::Image image(bitmap);
303 favicon_helper_->OnDidDownloadFavicon( 303 favicon_helper_->OnDidDownloadFavicon(
304 download_->download_id, download_->image_url, failed_, image); 304 download_->download_id, download_->image_url, failed_, image,
305 download_->image_size == gfx::kFaviconSize);
305 } 306 }
306 307
307 class FaviconHandlerTest : public ChromeRenderViewHostTestHarness { 308 class FaviconHandlerTest : public ChromeRenderViewHostTestHarness {
308 }; 309 };
309 310
310 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { 311 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) {
311 const GURL page_url("http://www.google.com"); 312 const GURL page_url("http://www.google.com");
312 const GURL icon_url("http://www.google.com/favicon"); 313 const GURL icon_url("http://www.google.com/favicon");
313 314
314 TestFaviconHandlerDelegate delegate(contents()); 315 TestFaviconHandlerDelegate delegate(contents());
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 949
949 // Verify correct icon size chosen. 950 // Verify correct icon size chosen.
950 EXPECT_EQ(icon_url_preferred1, handler.GetEntry()->GetFavicon().url); 951 EXPECT_EQ(icon_url_preferred1, handler.GetEntry()->GetFavicon().url);
951 EXPECT_TRUE(handler.GetEntry()->GetFavicon().valid); 952 EXPECT_TRUE(handler.GetEntry()->GetFavicon().valid);
952 EXPECT_FALSE(handler.GetEntry()->GetFavicon().image.IsEmpty()); 953 EXPECT_FALSE(handler.GetEntry()->GetFavicon().image.IsEmpty());
953 EXPECT_EQ(gfx::kFaviconSize, 954 EXPECT_EQ(gfx::kFaviconSize,
954 handler.GetEntry()->GetFavicon().image.ToSkBitmap()->width()); 955 handler.GetEntry()->GetFavicon().image.ToSkBitmap()->width());
955 } 956 }
956 957
957 } // namespace. 958 } // namespace.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698