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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, 1); |
305 } | 305 } |
306 | 306 |
307 class FaviconHandlerTest : public ChromeRenderViewHostTestHarness { | 307 class FaviconHandlerTest : public ChromeRenderViewHostTestHarness { |
308 }; | 308 }; |
309 | 309 |
310 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { | 310 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { |
311 const GURL page_url("http://www.google.com"); | 311 const GURL page_url("http://www.google.com"); |
312 const GURL icon_url("http://www.google.com/favicon"); | 312 const GURL icon_url("http://www.google.com/favicon"); |
313 | 313 |
314 TestFaviconHandlerDelegate delegate(contents()); | 314 TestFaviconHandlerDelegate delegate(contents()); |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 | 948 |
949 // Verify correct icon size chosen. | 949 // Verify correct icon size chosen. |
950 EXPECT_EQ(icon_url_preferred1, handler.GetEntry()->GetFavicon().url); | 950 EXPECT_EQ(icon_url_preferred1, handler.GetEntry()->GetFavicon().url); |
951 EXPECT_TRUE(handler.GetEntry()->GetFavicon().valid); | 951 EXPECT_TRUE(handler.GetEntry()->GetFavicon().valid); |
952 EXPECT_FALSE(handler.GetEntry()->GetFavicon().image.IsEmpty()); | 952 EXPECT_FALSE(handler.GetEntry()->GetFavicon().image.IsEmpty()); |
953 EXPECT_EQ(gfx::kFaviconSize, | 953 EXPECT_EQ(gfx::kFaviconSize, |
954 handler.GetEntry()->GetFavicon().image.ToSkBitmap()->width()); | 954 handler.GetEntry()->GetFavicon().image.ToSkBitmap()->width()); |
955 } | 955 } |
956 | 956 |
957 } // namespace. | 957 } // namespace. |
OLD | NEW |