Chromium Code Reviews| 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 "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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 LoadColorJSON(color_json); | 428 LoadColorJSON(color_json); |
| 429 | 429 |
| 430 std::map<int, SkColor> colors = GetDefaultColorMap(); | 430 std::map<int, SkColor> colors = GetDefaultColorMap(); |
| 431 colors[ThemeProperties::COLOR_NTP_HEADER] = SkColorSetRGB(120, 120, 120); | 431 colors[ThemeProperties::COLOR_NTP_HEADER] = SkColorSetRGB(120, 120, 120); |
| 432 colors[ThemeProperties::COLOR_NTP_SECTION] = SkColorSetRGB(190, 190, 190); | 432 colors[ThemeProperties::COLOR_NTP_SECTION] = SkColorSetRGB(190, 190, 190); |
| 433 VerifyColorMap(colors); | 433 VerifyColorMap(colors); |
| 434 } | 434 } |
| 435 | 435 |
| 436 TEST_F(BrowserThemePackTest, SupportsAlpha) { | 436 TEST_F(BrowserThemePackTest, SupportsAlpha) { |
| 437 // Verify that valid alpha values are parsed correctly. | 437 // Verify that valid alpha values are parsed correctly. |
| 438 std::string color_json = "{ \"toolbar\": [0, 20, 40, 0], " | 438 // The toolbar color's alpha value is intentionally ignored by theme provider. |
|
Peter Kasting
2016/07/01 21:03:14
Nit: I would place this comment below, just above
| |
| 439 " \"tab_text\": [60, 80, 100, 1], " | 439 std::string color_json = |
| 440 " \"tab_background_text\": [120, 140, 160, 0.0], " | 440 "{ \"toolbar\": [0, 20, 40, 1], " |
| 441 " \"bookmark_text\": [180, 200, 220, 1.0], " | 441 " \"tab_text\": [60, 80, 100, 1], " |
| 442 " \"ntp_text\": [240, 255, 0, 0.5] }"; | 442 " \"tab_background_text\": [120, 140, 160, 0.0], " |
| 443 " \"bookmark_text\": [180, 200, 220, 1.0], " | |
| 444 " \"ntp_text\": [240, 255, 0, 0.5] }"; | |
| 443 LoadColorJSON(color_json); | 445 LoadColorJSON(color_json); |
| 444 | 446 |
| 445 std::map<int, SkColor> colors = GetDefaultColorMap(); | 447 std::map<int, SkColor> colors = GetDefaultColorMap(); |
| 446 colors[ThemeProperties::COLOR_TOOLBAR] = SkColorSetARGB(0, 0, 20, 40); | 448 colors[ThemeProperties::COLOR_TOOLBAR] = SkColorSetARGB(255, 0, 20, 40); |
| 447 colors[ThemeProperties::COLOR_TAB_TEXT] = SkColorSetARGB(255, 60, 80, 100); | 449 colors[ThemeProperties::COLOR_TAB_TEXT] = SkColorSetARGB(255, 60, 80, 100); |
| 448 colors[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = | 450 colors[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = |
| 449 SkColorSetARGB(0, 120, 140, 160); | 451 SkColorSetARGB(0, 120, 140, 160); |
| 450 colors[ThemeProperties::COLOR_BOOKMARK_TEXT] = | 452 colors[ThemeProperties::COLOR_BOOKMARK_TEXT] = |
| 451 SkColorSetARGB(255, 180, 200, 220); | 453 SkColorSetARGB(255, 180, 200, 220); |
| 452 colors[ThemeProperties::COLOR_NTP_TEXT] = SkColorSetARGB(128, 240, 255, 0); | 454 colors[ThemeProperties::COLOR_NTP_TEXT] = SkColorSetARGB(128, 240, 255, 0); |
| 453 VerifyColorMap(colors); | 455 VerifyColorMap(colors); |
| 454 } | 456 } |
| 455 | 457 |
| 456 TEST_F(BrowserThemePackTest, OutOfRangeColors) { | 458 TEST_F(BrowserThemePackTest, OutOfRangeColors) { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 } |
| OLD | NEW |