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

Side by Side Diff: ui/native_theme/native_theme_mac_unittest.cc

Issue 1461923002: Change name of NativeTheme::instance() to make it clear it's web only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NATIVE_THEME_EXPORT for mac Created 5 years 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 | « ui/native_theme/native_theme_mac.mm ('k') | ui/views/button_drag_utils.cc » ('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 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/native_theme/native_theme_mac.h" 5 #include "ui/native_theme/native_theme_mac.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 // Test to ensure any system colors that are looked up by name exist on all Mac 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 13 // platforms Chrome supports, and that their colorspace and component count is
14 // sane. 14 // sane.
15 TEST(NativeThemeMacTest, SystemColorsExist) { 15 TEST(NativeThemeMacTest, SystemColorsExist) {
16 NativeTheme* native_theme = NativeTheme::instance(); 16 NativeTheme* native_theme = NativeThemeMac::instance();
17 ASSERT_TRUE(native_theme); 17 ASSERT_TRUE(native_theme);
18 for (int i = 0; i < NativeTheme::kColorId_NumColors; ++i) { 18 for (int i = 0; i < NativeTheme::kColorId_NumColors; ++i) {
19 // While 0 is a valid color, no system color should be fully transparent. 19 // While 0 is a valid color, no system color should be fully transparent.
20 // This is also to probe for CHECKs. 20 // This is also to probe for CHECKs.
21 EXPECT_NE( 21 EXPECT_NE(
22 static_cast<SkColor>(0), 22 static_cast<SkColor>(0),
23 native_theme->GetSystemColor(static_cast<NativeTheme::ColorId>(i))) 23 native_theme->GetSystemColor(static_cast<NativeTheme::ColorId>(i)))
24 << "GetSystemColor() unexpectedly gave a fully transparent color."; 24 << "GetSystemColor() unexpectedly gave a fully transparent color.";
25 } 25 }
26 } 26 }
27 27
28 // Spot-check some system colours that can't be changed through System 28 // Spot-check some system colours that can't be changed through System
29 // Preferences. 29 // Preferences.
30 TEST(NativeThemeMacTest, SystemColorSpotChecks) { 30 TEST(NativeThemeMacTest, SystemColorSpotChecks) {
31 NativeTheme* native_theme = NativeTheme::instance(); 31 NativeTheme* native_theme = NativeThemeMac::instance();
32 const SkColor kWindowColorCatsMavericks = SkColorSetARGB(255, 232, 232, 232); 32 const SkColor kWindowColorCatsMavericks = SkColorSetARGB(255, 232, 232, 232);
33 const SkColor kWindowColorYosemite = SkColorSetARGB(255, 236, 236, 236); 33 const SkColor kWindowColorYosemite = SkColorSetARGB(255, 236, 236, 236);
34 SkColor dialogColor = 34 SkColor dialogColor =
35 native_theme->GetSystemColor(NativeTheme::kColorId_WindowBackground); 35 native_theme->GetSystemColor(NativeTheme::kColorId_WindowBackground);
36 if (base::mac::IsOSYosemiteOrLater()) 36 if (base::mac::IsOSYosemiteOrLater())
37 EXPECT_EQ(dialogColor, kWindowColorYosemite); 37 EXPECT_EQ(dialogColor, kWindowColorYosemite);
38 else 38 else
39 EXPECT_EQ(dialogColor, kWindowColorCatsMavericks); 39 EXPECT_EQ(dialogColor, kWindowColorCatsMavericks);
40 } 40 }
41 41
42 } // namespace ui 42 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_mac.mm ('k') | ui/views/button_drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698