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

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

Issue 7892007: Add ChromeRenderViewHostTestHarness to get rid of the dependency from RVHTH to profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/favicon/favicon_handler.h" 5 #include "chrome/browser/favicon/favicon_handler.h"
6 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
7 #include "content/browser/renderer_host/test_render_view_host.h" 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
8 #include "content/browser/tab_contents/navigation_entry.h" 8 #include "content/browser/tab_contents/navigation_entry.h"
9 #include "content/browser/tab_contents/test_tab_contents.h" 9 #include "content/browser/tab_contents/test_tab_contents.h"
10 #include "ui/gfx/codec/png_codec.h" 10 #include "ui/gfx/codec/png_codec.h"
11 #include "ui/gfx/favicon_size.h" 11 #include "ui/gfx/favicon_size.h"
12 #include "ui/gfx/image/image.h" 12 #include "ui/gfx/image/image.h"
13 13
14 class TestFaviconHandler; 14 class TestFaviconHandler;
15 15
16 namespace { 16 namespace {
17 17
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void DownloadHandler::InvokeCallback() { 298 void DownloadHandler::InvokeCallback() {
299 gfx::Image image(new SkBitmap(bitmap_)); 299 gfx::Image image(new SkBitmap(bitmap_));
300 favicon_helper_->OnDidDownloadFavicon(download_id_, image_url_, failed_, 300 favicon_helper_->OnDidDownloadFavicon(download_id_, image_url_, failed_,
301 image); 301 image);
302 } 302 }
303 303
304 void HistoryRequestHandler::InvokeCallback() { 304 void HistoryRequestHandler::InvokeCallback() {
305 callback_->Run(0, favicon_data_); 305 callback_->Run(0, favicon_data_);
306 } 306 }
307 307
308 class FaviconHandlerTest : public RenderViewHostTestHarness { 308 class FaviconHandlerTest : public ChromeRenderViewHostTestHarness {
309 }; 309 };
310 310
311 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { 311 TEST_F(FaviconHandlerTest, GetFaviconFromHistory) {
312 const GURL page_url("http://www.google.com"); 312 const GURL page_url("http://www.google.com");
313 const GURL icon_url("http://www.google.com/favicon"); 313 const GURL icon_url("http://www.google.com/favicon");
314 314
315 TestFaviconHandlerDelegate delegate(contents()); 315 TestFaviconHandlerDelegate delegate(contents());
316 Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); 316 Profile* profile = Profile::FromBrowserContext(contents()->browser_context());
317 TestFaviconHandler helper(page_url, profile, 317 TestFaviconHandler helper(page_url, profile,
318 &delegate, FaviconHandler::FAVICON); 318 &delegate, FaviconHandler::FAVICON);
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 FillBitmap(kFaviconSize, kFaviconSize, &data->data()); 810 FillBitmap(kFaviconSize, kFaviconSize, &data->data());
811 handler->favicon_data_.image_data = data; 811 handler->favicon_data_.image_data = data;
812 812
813 handler->InvokeCallback(); 813 handler->InvokeCallback();
814 814
815 // No download request. 815 // No download request.
816 EXPECT_FALSE(helper.download_handler()); 816 EXPECT_FALSE(helper.download_handler());
817 } 817 }
818 818
819 } // namespace. 819 } // namespace.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698