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

Side by Side Diff: chrome/browser/themes/browser_theme_pack_unittest.cc

Issue 2051123002: Make COLOR_CONTROL_BACKGROUND customizable from a theme extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and increase kThemePackVersion Created 4 years, 6 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 | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/themes/theme_properties.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 "chrome/browser/themes/browser_theme_pack.h" 5 #include "chrome/browser/themes/browser_theme_pack.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Verifies the data in star gazing. We do this multiple times for different 206 // Verifies the data in star gazing. We do this multiple times for different
207 // BrowserThemePack objects to make sure it works in generated and mmapped 207 // BrowserThemePack objects to make sure it works in generated and mmapped
208 // mode correctly. 208 // mode correctly.
209 void VerifyStarGazing(BrowserThemePack* pack) { 209 void VerifyStarGazing(BrowserThemePack* pack) {
210 // First check that values we know exist, exist. 210 // First check that values we know exist, exist.
211 SkColor color; 211 SkColor color;
212 EXPECT_TRUE(pack->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, 212 EXPECT_TRUE(pack->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT,
213 &color)); 213 &color));
214 EXPECT_EQ(SK_ColorBLACK, color); 214 EXPECT_EQ(SK_ColorBLACK, color);
215 215
216 EXPECT_TRUE(
217 pack->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND, &color));
218 EXPECT_EQ(SkColorSetRGB(10, 234, 123), color);
219
216 EXPECT_TRUE(pack->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND, 220 EXPECT_TRUE(pack->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND,
217 &color)); 221 &color));
218 EXPECT_EQ(SkColorSetRGB(57, 137, 194), color); 222 EXPECT_EQ(SkColorSetRGB(57, 137, 194), color);
219 223
220 color_utils::HSL expected = { 0.6, 0.553, 0.5 }; 224 color_utils::HSL expected = { 0.6, 0.553, 0.5 };
221 color_utils::HSL actual; 225 color_utils::HSL actual;
222 EXPECT_TRUE(pack->GetTint(ThemeProperties::TINT_BUTTONS, &actual)); 226 EXPECT_TRUE(pack->GetTint(ThemeProperties::TINT_BUTTONS, &actual));
223 EXPECT_DOUBLE_EQ(expected.h, actual.h); 227 EXPECT_DOUBLE_EQ(expected.h, actual.h);
224 EXPECT_DOUBLE_EQ(expected.s, actual.s); 228 EXPECT_DOUBLE_EQ(expected.s, actual.s);
225 EXPECT_DOUBLE_EQ(expected.l, actual.l); 229 EXPECT_DOUBLE_EQ(expected.l, actual.l);
(...skipping 15 matching lines...) Expand all
241 // they're included in the theme pack, they were autogenerated and 245 // they're included in the theme pack, they were autogenerated and
242 // therefore shouldn't show up when calling HasCustomImage(). 246 // therefore shouldn't show up when calling HasCustomImage().
243 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INACTIVE)); 247 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INACTIVE));
244 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO)); 248 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO));
245 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO_INACTIVE)); 249 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO_INACTIVE));
246 #if !defined(OS_MACOSX) 250 #if !defined(OS_MACOSX)
247 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_TAB_BACKGROUND_INCOGNITO)); 251 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_TAB_BACKGROUND_INCOGNITO));
248 #endif 252 #endif
249 253
250 // Make sure we don't have phantom data. 254 // Make sure we don't have phantom data.
251 EXPECT_FALSE(pack->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND,
252 &color));
253 EXPECT_FALSE(pack->GetTint(ThemeProperties::TINT_FRAME, &actual)); 255 EXPECT_FALSE(pack->GetTint(ThemeProperties::TINT_FRAME, &actual));
254 } 256 }
255 257
256 void VerifyHiDpiTheme(BrowserThemePack* pack) { 258 void VerifyHiDpiTheme(BrowserThemePack* pack) {
257 // The high DPI theme defines the following images: 259 // The high DPI theme defines the following images:
258 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME)); 260 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME));
259 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME_INACTIVE)); 261 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME_INACTIVE));
260 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO)); 262 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO));
261 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO_INACTIVE)); 263 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO_INACTIVE));
262 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_TOOLBAR)); 264 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_TOOLBAR));
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } 652 }
651 653
652 // Part 2: Try to read back the data pack that we just wrote to disk. 654 // Part 2: Try to read back the data pack that we just wrote to disk.
653 { 655 {
654 scoped_refptr<BrowserThemePack> pack = 656 scoped_refptr<BrowserThemePack> pack =
655 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); 657 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag");
656 ASSERT_TRUE(pack.get()); 658 ASSERT_TRUE(pack.get());
657 VerifyHiDpiTheme(pack.get()); 659 VerifyHiDpiTheme(pack.get());
658 } 660 }
659 } 661 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/themes/theme_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698