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

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

Issue 370663002: Revert 281304 "Pass an instance of FaviconClient to FaviconService." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 | « no previous file | trunk/src/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/chrome_favicon_client.h"
7 #include "chrome/browser/favicon/favicon_handler.h" 6 #include "chrome/browser/favicon/favicon_handler.h"
8 #include "chrome/browser/favicon/favicon_service.h" 7 #include "chrome/browser/favicon/favicon_service.h"
9 #include "chrome/browser/favicon/favicon_service_factory.h" 8 #include "chrome/browser/favicon/favicon_service_factory.h"
10 #include "chrome/browser/history/history_service_factory.h" 9 #include "chrome/browser/history/history_service_factory.h"
11 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 11 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/gfx/codec/png_codec.h" 13 #include "ui/gfx/codec/png_codec.h"
15 #include "ui/gfx/favicon_size.h" 14 #include "ui/gfx/favicon_size.h"
16 #include "ui/gfx/image/image.h" 15 #include "ui/gfx/image/image.h"
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 handler1.download_handler()->SetImageSizes(sizes); 1397 handler1.download_handler()->SetImageSizes(sizes);
1399 handler1.download_handler()->InvokeCallback(); 1398 handler1.download_handler()->InvokeCallback();
1400 1399
1401 // Verify icon2 has been saved into history. 1400 // Verify icon2 has been saved into history.
1402 EXPECT_EQ(kSourceIconURLs[1].icon_url, handler1.history_handler()->icon_url_); 1401 EXPECT_EQ(kSourceIconURLs[1].icon_url, handler1.history_handler()->icon_url_);
1403 EXPECT_EQ(gfx::Size(actual_size2, actual_size2), 1402 EXPECT_EQ(gfx::Size(actual_size2, actual_size2),
1404 handler1.history_handler()->size_); 1403 handler1.history_handler()->size_);
1405 } 1404 }
1406 1405
1407 static KeyedService* BuildFaviconService(content::BrowserContext* profile) { 1406 static KeyedService* BuildFaviconService(content::BrowserContext* profile) {
1408 FaviconClient* favicon_client = 1407 return new FaviconService(static_cast<Profile*>(profile));
1409 new ChromeFaviconClient(static_cast<Profile*>(profile));
1410 return new FaviconService(static_cast<Profile*>(profile), favicon_client);
1411 } 1408 }
1412 1409
1413 static KeyedService* BuildHistoryService(content::BrowserContext* profile) { 1410 static KeyedService* BuildHistoryService(content::BrowserContext* profile) {
1414 return NULL; 1411 return NULL;
1415 } 1412 }
1416 1413
1417 // Test that Favicon is not requested repeatedly during the same session if 1414 // Test that Favicon is not requested repeatedly during the same session if
1418 // server returns HTTP 404 status. 1415 // server returns HTTP 404 status.
1419 TEST_F(FaviconHandlerTest, UnableToDownloadFavicon) { 1416 TEST_F(FaviconHandlerTest, UnableToDownloadFavicon) {
1420 const GURL missing_icon_url("http://www.google.com/favicon.ico"); 1417 const GURL missing_icon_url("http://www.google.com/favicon.ico");
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0); 1480 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0);
1484 EXPECT_NE(0, download_id); 1481 EXPECT_NE(0, download_id);
1485 // Report download success with HTTP 200 status. 1482 // Report download success with HTTP 200 status.
1486 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url, 1483 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url,
1487 empty_icons, empty_icon_sizes); 1484 empty_icons, empty_icon_sizes);
1488 // Icon is not marked as UnableToDownload as HTTP status is not 404. 1485 // Icon is not marked as UnableToDownload as HTTP status is not 404.
1489 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url)); 1486 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url));
1490 } 1487 }
1491 1488
1492 } // namespace. 1489 } // namespace.
OLDNEW
« no previous file with comments | « no previous file | trunk/src/chrome/browser/favicon/favicon_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698