OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/css/parser/CSSParserFastPaths.h" | 5 #include "core/css/parser/CSSParserFastPaths.h" |
6 | 6 |
| 7 #include "core/css/CSSColorValue.h" |
7 #include "core/css/CSSIdentifierValue.h" | 8 #include "core/css/CSSIdentifierValue.h" |
8 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 TEST(CSSParserFastPathsTest, ParseKeyword) { | 14 TEST(CSSParserFastPathsTest, ParseKeyword) { |
14 CSSValue* value = CSSParserFastPaths::maybeParseValue( | 15 CSSValue* value = CSSParserFastPaths::maybeParseValue( |
15 CSSPropertyFloat, "left", HTMLStandardMode); | 16 CSSPropertyFloat, "left", HTMLStandardMode); |
16 ASSERT_NE(nullptr, value); | 17 ASSERT_NE(nullptr, value); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 TEST(CSSParserFastPathsTest, ParseInvalidTransform) { | 92 TEST(CSSParserFastPathsTest, ParseInvalidTransform) { |
92 CSSValue* value = CSSParserFastPaths::maybeParseValue( | 93 CSSValue* value = CSSParserFastPaths::maybeParseValue( |
93 CSSPropertyTransform, "rotateX(1deg", HTMLStandardMode); | 94 CSSPropertyTransform, "rotateX(1deg", HTMLStandardMode); |
94 ASSERT_EQ(nullptr, value); | 95 ASSERT_EQ(nullptr, value); |
95 value = CSSParserFastPaths::maybeParseValue( | 96 value = CSSParserFastPaths::maybeParseValue( |
96 CSSPropertyTransform, "translateZ(1px) (1px, 1px) rotateX(1deg", | 97 CSSPropertyTransform, "translateZ(1px) (1px, 1px) rotateX(1deg", |
97 HTMLStandardMode); | 98 HTMLStandardMode); |
98 ASSERT_EQ(nullptr, value); | 99 ASSERT_EQ(nullptr, value); |
99 } | 100 } |
100 | 101 |
| 102 TEST(CSSParserFastPathsTest, ParseColorWithLargeAlpha) { |
| 103 CSSValue* value = CSSParserFastPaths::parseColor("rgba(0,0,0,1893205797.13)", |
| 104 HTMLStandardMode); |
| 105 EXPECT_NE(nullptr, value); |
| 106 EXPECT_TRUE(value->isColorValue()); |
| 107 EXPECT_EQ(Color::black, toCSSColorValue(*value).value()); |
| 108 } |
| 109 |
101 } // namespace blink | 110 } // namespace blink |
OLD | NEW |