OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/base/material_design/material_design_controller.h" | |
5 #include "ui/native_theme/native_theme_mac.h" | 6 #include "ui/native_theme/native_theme_mac.h" |
6 | 7 |
7 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 namespace ui { | 11 namespace ui { |
11 | 12 |
12 // Test to ensure any system colors that are looked up by name exist on all Mac | 13 // Test to ensure any system colors that are looked up by name exist on all Mac |
13 // platforms Chrome supports, and that their colorspace and component count is | 14 // platforms Chrome supports, and that their colorspace and component count is |
14 // sane. | 15 // sane. |
15 TEST(NativeThemeMacTest, SystemColorsExist) { | 16 TEST(NativeThemeMacTest, SystemColorsExist) { |
17 MaterialDesignController::Initialize(); | |
Peter Kasting
2016/07/06 20:57:07
Wouldn't we need this in the next test too?
In fa
shrike
2016/07/07 19:40:47
I agree with pkasting@ that it should be more gene
| |
16 NativeTheme* native_theme = NativeThemeMac::instance(); | 18 NativeTheme* native_theme = NativeThemeMac::instance(); |
17 ASSERT_TRUE(native_theme); | 19 ASSERT_TRUE(native_theme); |
18 for (int i = 0; i < NativeTheme::kColorId_NumColors; ++i) { | 20 for (int i = 0; i < NativeTheme::kColorId_NumColors; ++i) { |
19 // While 0 is a valid color, no system color should be fully transparent. | 21 // While 0 is a valid color, no system color should be fully transparent. |
20 // This is also to probe for CHECKs. | 22 // This is also to probe for CHECKs. |
21 EXPECT_NE( | 23 EXPECT_NE( |
22 static_cast<SkColor>(0), | 24 static_cast<SkColor>(0), |
23 native_theme->GetSystemColor(static_cast<NativeTheme::ColorId>(i))) | 25 native_theme->GetSystemColor(static_cast<NativeTheme::ColorId>(i))) |
24 << "GetSystemColor() unexpectedly gave a fully transparent color."; | 26 << "GetSystemColor() unexpectedly gave a fully transparent color."; |
25 } | 27 } |
26 } | 28 } |
27 | 29 |
28 // Spot-check some system colours that can't be changed through System | 30 // Spot-check some system colours that can't be changed through System |
29 // Preferences. | 31 // Preferences. |
30 TEST(NativeThemeMacTest, SystemColorSpotChecks) { | 32 TEST(NativeThemeMacTest, SystemColorSpotChecks) { |
31 NativeTheme* native_theme = NativeThemeMac::instance(); | 33 NativeTheme* native_theme = NativeThemeMac::instance(); |
32 const SkColor kWindowColorCatsMavericks = SkColorSetARGB(255, 232, 232, 232); | 34 const SkColor kWindowColorCatsMavericks = SkColorSetARGB(255, 232, 232, 232); |
33 const SkColor kWindowColorYosemite = SkColorSetARGB(255, 236, 236, 236); | 35 const SkColor kWindowColorYosemite = SkColorSetARGB(255, 236, 236, 236); |
34 SkColor dialogColor = | 36 SkColor dialogColor = |
35 native_theme->GetSystemColor(NativeTheme::kColorId_WindowBackground); | 37 native_theme->GetSystemColor(NativeTheme::kColorId_WindowBackground); |
36 if (base::mac::IsOSYosemiteOrLater()) | 38 if (base::mac::IsOSYosemiteOrLater()) |
37 EXPECT_EQ(dialogColor, kWindowColorYosemite); | 39 EXPECT_EQ(dialogColor, kWindowColorYosemite); |
38 else | 40 else |
39 EXPECT_EQ(dialogColor, kWindowColorCatsMavericks); | 41 EXPECT_EQ(dialogColor, kWindowColorCatsMavericks); |
40 } | 42 } |
41 | 43 |
42 } // namespace ui | 44 } // namespace ui |
OLD | NEW |