Update V8 to version 4.7.45.
[chromium-blink-merge.git] / ui / native_theme / native_theme_mac_unittest.cc
blob0607034f56adb886ae2a94f4b9026211abaa4bfe
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
3 // found in the LICENSE file.
5 #include "ui/native_theme/native_theme_mac.h"
7 #include "base/mac/mac_util.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace ui {
12 // 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 // sane.
15 TEST(NativeThemeMacTest, SystemColorsExist) {
16 NativeTheme* native_theme = NativeTheme::instance();
17 ASSERT_TRUE(native_theme);
18 for (int i = 0; i < NativeTheme::kColorId_NumColors; ++i) {
19 // While 0 is a valid color, no system color should be fully transparent.
20 // This is also to probe for CHECKs.
21 EXPECT_NE(
22 static_cast<SkColor>(0),
23 native_theme->GetSystemColor(static_cast<NativeTheme::ColorId>(i)))
24 << "GetSystemColor() unexpectedly gave a fully transparent color.";
28 // Spot-check some system colours that can't be changed through System
29 // Preferences.
30 TEST(NativeThemeMacTest, SystemColorSpotChecks) {
31 NativeTheme* native_theme = NativeTheme::instance();
32 const SkColor kWindowColorCatsMavericks = SkColorSetARGB(255, 232, 232, 232);
33 const SkColor kWindowColorYosemite = SkColorSetARGB(255, 236, 236, 236);
34 SkColor dialogColor =
35 native_theme->GetSystemColor(NativeTheme::kColorId_WindowBackground);
36 if (base::mac::IsOSYosemiteOrLater())
37 EXPECT_EQ(dialogColor, kWindowColorYosemite);
38 else
39 EXPECT_EQ(dialogColor, kWindowColorCatsMavericks);
42 } // namespace ui