| 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 <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 Loading... |
| 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 |
| OLD | NEW |