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

Side by Side Diff: extensions/common/image_util_unittest.cc

Issue 1781563003: chrome.browserAction.setBadgeBackgroundColor accepts color keyword (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <string> 5 #include <string>
6 6
7 #include "extensions/common/image_util.h" 7 #include "extensions/common/image_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/gfx/color_utils.h" 10 #include "ui/gfx/color_utils.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 SkColorSetARGB(0x7F, 0xFF, 0x00, 0x00)); 101 SkColorSetARGB(0x7F, 0xFF, 0x00, 0x00));
102 RunPassHslTest("hsla(0, 100%, 50%, 0.25)", 102 RunPassHslTest("hsla(0, 100%, 50%, 0.25)",
103 SkColorSetARGB(0x3F, 0xFF, 0x00, 0x00)); 103 SkColorSetARGB(0x3F, 0xFF, 0x00, 0x00));
104 RunPassHslTest("hsla(0, 100%, 50%, 0.75)", 104 RunPassHslTest("hsla(0, 100%, 50%, 0.75)",
105 SkColorSetARGB(0xBF, 0xFF, 0x00, 0x00)); 105 SkColorSetARGB(0xBF, 0xFF, 0x00, 0x00));
106 106
107 // We should able to parse integer alpha value. 107 // We should able to parse integer alpha value.
108 RunPassHslTest("hsla(0, 100%, 50%, 1)", SK_ColorRED); 108 RunPassHslTest("hsla(0, 100%, 50%, 1)", SK_ColorRED);
109 } 109 }
110 110
111 TEST(ImageUtilTest, BasicColorKeyword) {
112 SkColor color = 0;
113 EXPECT_TRUE(image_util::ParseCssColorString("red", &color));
114 EXPECT_EQ(color, SK_ColorRED);
115
116 EXPECT_TRUE(image_util::ParseCssColorString("blue", &color));
117 EXPECT_EQ(color, SK_ColorBLUE);
118
119 EXPECT_FALSE(image_util::ParseCssColorString("my_red", &color));
120 }
121
111 } // namespace extensions 122 } // namespace extensions
OLDNEW
« extensions/common/image_util.cc ('K') | « extensions/common/image_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698