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

Side by Side Diff: ios/chrome/browser/favicon/large_icon_cache_unittest.cc

Issue 2374753002: Track when fallback icon color is the default. (Closed)
Patch Set: Merge branch 'refs/heads/master' into default-color Created 4 years, 2 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
« no previous file with comments | « components/favicon_base/fallback_icon_url_parser_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/favicon/large_icon_cache.h" 5 #include "ios/chrome/browser/favicon/large_icon_cache.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "components/favicon_base/fallback_icon_style.h" 8 #include "components/favicon_base/fallback_icon_style.h"
9 #include "components/favicon_base/favicon_types.h" 9 #include "components/favicon_base/favicon_types.h"
10 #include "skia/ext/skia_utils_ios.h" 10 #include "skia/ext/skia_utils_ios.h"
(...skipping 25 matching lines...) Expand all
36 result.icon_type = favicon_base::TOUCH_ICON; 36 result.icon_type = favicon_base::TOUCH_ICON;
37 CHECK(result.is_valid()); 37 CHECK(result.is_valid());
38 return result; 38 return result;
39 } 39 }
40 40
41 class LargeIconCacheTest : public testing::Test { 41 class LargeIconCacheTest : public testing::Test {
42 public: 42 public:
43 LargeIconCacheTest() { 43 LargeIconCacheTest() {
44 expected_fallback_icon_style_.reset(new favicon_base::FallbackIconStyle()); 44 expected_fallback_icon_style_.reset(new favicon_base::FallbackIconStyle());
45 expected_fallback_icon_style_->background_color = kTestColor; 45 expected_fallback_icon_style_->background_color = kTestColor;
46 expected_fallback_icon_style_->is_default_background_color = false;
46 expected_bitmap_ = CreateTestBitmap(24, 24, kTestColor); 47 expected_bitmap_ = CreateTestBitmap(24, 24, kTestColor);
47 large_icon_cache_.reset(new LargeIconCache); 48 large_icon_cache_.reset(new LargeIconCache);
48 } 49 }
49 50
50 ~LargeIconCacheTest() override {} 51 ~LargeIconCacheTest() override {}
51 52
52 protected: 53 protected:
53 std::unique_ptr<LargeIconCache> large_icon_cache_; 54 std::unique_ptr<LargeIconCache> large_icon_cache_;
54 favicon_base::FaviconRawBitmapResult expected_bitmap_; 55 favicon_base::FaviconRawBitmapResult expected_bitmap_;
55 std::unique_ptr<favicon_base::FallbackIconStyle> 56 std::unique_ptr<favicon_base::FallbackIconStyle>
(...skipping 23 matching lines...) Expand all
79 std::unique_ptr<favicon_base::LargeIconResult> result1 = 80 std::unique_ptr<favicon_base::LargeIconResult> result1 =
80 large_icon_cache_->GetCachedResult(GURL(kDummyUrl)); 81 large_icon_cache_->GetCachedResult(GURL(kDummyUrl));
81 EXPECT_EQ(true, result1->bitmap.is_valid()); 82 EXPECT_EQ(true, result1->bitmap.is_valid());
82 EXPECT_EQ(expected_result1->bitmap.pixel_size, result1->bitmap.pixel_size); 83 EXPECT_EQ(expected_result1->bitmap.pixel_size, result1->bitmap.pixel_size);
83 84
84 std::unique_ptr<favicon_base::LargeIconResult> result2 = 85 std::unique_ptr<favicon_base::LargeIconResult> result2 =
85 large_icon_cache_->GetCachedResult(GURL(kDummyUrl2)); 86 large_icon_cache_->GetCachedResult(GURL(kDummyUrl2));
86 EXPECT_EQ(false, result2->bitmap.is_valid()); 87 EXPECT_EQ(false, result2->bitmap.is_valid());
87 EXPECT_EQ(expected_result2->fallback_icon_style->background_color, 88 EXPECT_EQ(expected_result2->fallback_icon_style->background_color,
88 result2->fallback_icon_style->background_color); 89 result2->fallback_icon_style->background_color);
90 EXPECT_FALSE(result2->fallback_icon_style->is_default_background_color);
89 91
90 // Test overwriting kDummyUrl. 92 // Test overwriting kDummyUrl.
91 large_icon_cache_->SetCachedResult(GURL(kDummyUrl), *expected_result2); 93 large_icon_cache_->SetCachedResult(GURL(kDummyUrl), *expected_result2);
92 std::unique_ptr<favicon_base::LargeIconResult> result3 = 94 std::unique_ptr<favicon_base::LargeIconResult> result3 =
93 large_icon_cache_->GetCachedResult(GURL(kDummyUrl2)); 95 large_icon_cache_->GetCachedResult(GURL(kDummyUrl2));
94 EXPECT_EQ(false, result3->bitmap.is_valid()); 96 EXPECT_EQ(false, result3->bitmap.is_valid());
95 EXPECT_EQ(expected_result2->fallback_icon_style->background_color, 97 EXPECT_EQ(expected_result2->fallback_icon_style->background_color,
96 result3->fallback_icon_style->background_color); 98 result3->fallback_icon_style->background_color);
99 EXPECT_FALSE(result2->fallback_icon_style->is_default_background_color);
97 } 100 }
98 101
99 } // namespace 102 } // namespace
OLDNEW
« no previous file with comments | « components/favicon_base/fallback_icon_url_parser_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698