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/CSSColorValue.h" |
8 #include "core/css/CSSIdentifierValue.h" | 8 #include "core/css/CSSIdentifierValue.h" |
9 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
| 14 using namespace cssvalue; |
| 15 |
14 TEST(CSSParserFastPathsTest, ParseKeyword) { | 16 TEST(CSSParserFastPathsTest, ParseKeyword) { |
15 CSSValue* value = CSSParserFastPaths::maybeParseValue( | 17 CSSValue* value = CSSParserFastPaths::maybeParseValue( |
16 CSSPropertyFloat, "left", HTMLStandardMode); | 18 CSSPropertyFloat, "left", HTMLStandardMode); |
17 ASSERT_NE(nullptr, value); | 19 ASSERT_NE(nullptr, value); |
18 EXPECT_TRUE(value->isIdentifierValue()); | 20 EXPECT_TRUE(value->isIdentifierValue()); |
19 CSSIdentifierValue* identifierValue = toCSSIdentifierValue(value); | 21 CSSIdentifierValue* identifierValue = toCSSIdentifierValue(value); |
20 EXPECT_EQ(CSSValueLeft, identifierValue->getValueID()); | 22 EXPECT_EQ(CSSValueLeft, identifierValue->getValueID()); |
21 value = CSSParserFastPaths::maybeParseValue(CSSPropertyFloat, "foo", | 23 value = CSSParserFastPaths::maybeParseValue(CSSPropertyFloat, "foo", |
22 HTMLStandardMode); | 24 HTMLStandardMode); |
23 ASSERT_EQ(nullptr, value); | 25 ASSERT_EQ(nullptr, value); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 103 |
102 TEST(CSSParserFastPathsTest, ParseColorWithLargeAlpha) { | 104 TEST(CSSParserFastPathsTest, ParseColorWithLargeAlpha) { |
103 CSSValue* value = CSSParserFastPaths::parseColor("rgba(0,0,0,1893205797.13)", | 105 CSSValue* value = CSSParserFastPaths::parseColor("rgba(0,0,0,1893205797.13)", |
104 HTMLStandardMode); | 106 HTMLStandardMode); |
105 EXPECT_NE(nullptr, value); | 107 EXPECT_NE(nullptr, value); |
106 EXPECT_TRUE(value->isColorValue()); | 108 EXPECT_TRUE(value->isColorValue()); |
107 EXPECT_EQ(Color::black, toCSSColorValue(*value).value()); | 109 EXPECT_EQ(Color::black, toCSSColorValue(*value).value()); |
108 } | 110 } |
109 | 111 |
110 } // namespace blink | 112 } // namespace blink |
OLD | NEW |