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/favicon/favicon_service_factory.h" | 7 #include "chrome/browser/favicon/favicon_service_factory.h" |
8 #include "chrome/browser/history/history_service_factory.h" | 8 #include "chrome/browser/history/history_service_factory.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "ui/gfx/codec/png_codec.h" | 12 #include "ui/gfx/codec/png_codec.h" |
13 #include "ui/gfx/favicon_size.h" | 13 #include "ui/gfx/favicon_size.h" |
14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
| 15 #if defined(OS_WIN) |
| 16 #include "ui/gfx/win/dpi.h" |
| 17 #endif |
15 | 18 |
16 class TestFaviconHandler; | 19 class TestFaviconHandler; |
17 | 20 |
18 using content::FaviconURL; | 21 using content::FaviconURL; |
19 | 22 |
20 namespace { | 23 namespace { |
21 | 24 |
22 // Fill the given bmp with valid png data. | 25 // Fill the given bmp with valid png data. |
23 void FillDataToBitmap(int w, int h, SkBitmap* bmp) { | 26 void FillDataToBitmap(int w, int h, SkBitmap* bmp) { |
24 bmp->setConfig(SkBitmap::kARGB_8888_Config, w, h); | 27 bmp->setConfig(SkBitmap::kARGB_8888_Config, w, h); |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 EXPECT_FALSE(download_handler->HasDownload()); | 1029 EXPECT_FALSE(download_handler->HasDownload()); |
1027 } | 1030 } |
1028 | 1031 |
1029 #if !defined(OS_ANDROID) | 1032 #if !defined(OS_ANDROID) |
1030 | 1033 |
1031 // Test the favicon which is selected when the web page provides several | 1034 // Test the favicon which is selected when the web page provides several |
1032 // favicons and none of the favicons are cached in history. | 1035 // favicons and none of the favicons are cached in history. |
1033 // The goal of this test is to be more of an integration test than | 1036 // The goal of this test is to be more of an integration test than |
1034 // SelectFaviconFramesTest.*. | 1037 // SelectFaviconFramesTest.*. |
1035 TEST_F(FaviconHandlerTest, MultipleFavicons) { | 1038 TEST_F(FaviconHandlerTest, MultipleFavicons) { |
| 1039 #if defined(OS_WIN) |
| 1040 // High DPI breaks multi-resolution handling. Bail. |
| 1041 if (gfx::IsHighDPIEnabled()) |
| 1042 return; |
| 1043 #endif |
| 1044 |
1036 const GURL kPageURL("http://www.google.com"); | 1045 const GURL kPageURL("http://www.google.com"); |
1037 const FaviconURL kSourceIconURLs[] = { | 1046 const FaviconURL kSourceIconURLs[] = { |
1038 FaviconURL(GURL("http://www.google.com/a"), | 1047 FaviconURL(GURL("http://www.google.com/a"), |
1039 FaviconURL::FAVICON, | 1048 FaviconURL::FAVICON, |
1040 std::vector<gfx::Size>()), | 1049 std::vector<gfx::Size>()), |
1041 FaviconURL(GURL("http://www.google.com/b"), | 1050 FaviconURL(GURL("http://www.google.com/b"), |
1042 FaviconURL::FAVICON, | 1051 FaviconURL::FAVICON, |
1043 std::vector<gfx::Size>()), | 1052 std::vector<gfx::Size>()), |
1044 FaviconURL(GURL("http://www.google.com/c"), | 1053 FaviconURL(GURL("http://www.google.com/c"), |
1045 FaviconURL::FAVICON, | 1054 FaviconURL::FAVICON, |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0); | 1502 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0); |
1494 EXPECT_NE(0, download_id); | 1503 EXPECT_NE(0, download_id); |
1495 // Report download success with HTTP 200 status. | 1504 // Report download success with HTTP 200 status. |
1496 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url, | 1505 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url, |
1497 empty_icons, empty_icon_sizes); | 1506 empty_icons, empty_icon_sizes); |
1498 // Icon is not marked as UnableToDownload as HTTP status is not 404. | 1507 // Icon is not marked as UnableToDownload as HTTP status is not 404. |
1499 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url)); | 1508 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url)); |
1500 } | 1509 } |
1501 | 1510 |
1502 } // namespace. | 1511 } // namespace. |
OLD | NEW |