Chromium Code Reviews| Index: components/history/core/browser/history_backend_unittest.cc |
| diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc |
| index b89d0a76ecceba163ac9d3d04778bf924dd9ce55..1f5a352bc37d847f15fe883e0db4cc8362158c53 100644 |
| --- a/components/history/core/browser/history_backend_unittest.cc |
| +++ b/components/history/core/browser/history_backend_unittest.cc |
| @@ -2998,6 +2998,42 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBExpired) { |
| EXPECT_TRUE(bitmap_results_out[0].expired); |
| } |
| +// Test that GetFaviconsForURL() returns result for the bitmap which most |
| +// closely matches the passed in desired pixel size, resizes the bitmap to the |
| +// desired size while keeping the information about the original size stored in |
| +// the DB. |
|
pkotwicz
2017/02/07 04:55:55
How about: "Test that |FaviconBitmapResult::pixel_
|
| +TEST_F(HistoryBackendTest, |
| + GetFaviconsForURLSelectClosestMatchResizeAndKeepSizeInDB) { |
| + const GURL page_url("http://www.google.com/"); |
| + const GURL icon_url("http://www.google.com/icon1"); |
| + std::vector<SkBitmap> bitmaps; |
| + bitmaps.push_back(CreateBitmap(SK_ColorWHITE, kTinyEdgeSize)); |
| + bitmaps.push_back(CreateBitmap(SK_ColorBLUE, kSmallEdgeSize)); |
| + bitmaps.push_back(CreateBitmap(SK_ColorRED, kLargeEdgeSize)); |
|
pkotwicz
2017/02/07 04:55:55
Given that you are not testing selecting the bitma
|
| + |
| + backend_->SetFavicons(page_url, favicon_base::FAVICON, icon_url, bitmaps); |
| + |
| + std::vector<int> sizes; |
| + // Choose slightly different sizes from the ones stored in the DB. |
| + const gfx::Size kSmallSizeMinusOne = |
| + gfx::Size(kSmallEdgeSize - 1, kSmallEdgeSize - 1); |
| + sizes.push_back(kSmallEdgeSize - 1); |
| + |
| + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out; |
| + backend_->GetFaviconsForURL(page_url, favicon_base::FAVICON, sizes, |
| + &bitmap_results_out); |
| + |
| + EXPECT_EQ(1u, bitmap_results_out.size()); |
| + |
| + EXPECT_FALSE(bitmap_results_out[0].expired); |
| + EXPECT_TRUE( |
| + BitmapColorEqual(SK_ColorBLUE, bitmap_results_out[0].bitmap_data)); |
| + EXPECT_EQ(kSmallSizeMinusOne, bitmap_results_out[0].pixel_size); |
| + EXPECT_EQ(kSmallSize, bitmap_results_out[0].pixel_size_in_db); |
| + EXPECT_EQ(icon_url, bitmap_results_out[0].icon_url); |
| + EXPECT_EQ(favicon_base::FAVICON, bitmap_results_out[0].icon_type); |
|
pkotwicz
2017/02/07 04:55:55
Testing the color, icon_url and type are not neces
|
| +} |
| + |
| // Check that UpdateFaviconMappingsAndFetch() call back to the UI when there is |
| // no valid thumbnail database. |
| TEST_F(HistoryBackendTest, UpdateFaviconMappingsAndFetchNoDB) { |