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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work Created 4 years, 2 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 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/CSSPrimitiveValue.h" 7 #include "core/css/CSSIdentifierValue.h"
8 #include "core/css/CSSValueList.h" 8 #include "core/css/CSSValueList.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 TEST(CSSParserFastPathsTest, ParseKeyword) 13 TEST(CSSParserFastPathsTest, ParseKeyword)
14 { 14 {
15 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyFloat, "lef t", HTMLStandardMode); 15 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyFloat, "lef t", HTMLStandardMode);
16 ASSERT_NE(nullptr, value); 16 ASSERT_NE(nullptr, value);
17 EXPECT_TRUE(value->isPrimitiveValue()); 17 EXPECT_TRUE(value->isIdentifierValue());
18 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 18 CSSIdentifierValue* identifierValue = toCSSIdentifierValue(value);
19 EXPECT_TRUE(primitiveValue->isValueID()); 19 EXPECT_EQ(CSSValueLeft, identifierValue->getValueID());
20 EXPECT_EQ(CSSValueLeft, primitiveValue->getValueID());
21 value = CSSParserFastPaths::maybeParseValue(CSSPropertyFloat, "foo", HTMLSta ndardMode); 20 value = CSSParserFastPaths::maybeParseValue(CSSPropertyFloat, "foo", HTMLSta ndardMode);
22 ASSERT_EQ(nullptr, value); 21 ASSERT_EQ(nullptr, value);
23 } 22 }
24 TEST(CSSParserFastPathsTest, ParseInitialAndInheritKeyword) 23 TEST(CSSParserFastPathsTest, ParseInitialAndInheritKeyword)
25 { 24 {
26 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyMarginTop, "inherit", HTMLStandardMode); 25 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyMarginTop, "inherit", HTMLStandardMode);
27 ASSERT_NE(nullptr, value); 26 ASSERT_NE(nullptr, value);
28 EXPECT_TRUE(value->isInheritedValue()); 27 EXPECT_TRUE(value->isInheritedValue());
29 value = CSSParserFastPaths::maybeParseValue(CSSPropertyMarginRight, "InHeriT ", HTMLStandardMode); 28 value = CSSParserFastPaths::maybeParseValue(CSSPropertyMarginRight, "InHeriT ", HTMLStandardMode);
30 ASSERT_NE(nullptr, value); 29 ASSERT_NE(nullptr, value);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 83
85 TEST(CSSParserFastPathsTest, ParseInvalidTransform) 84 TEST(CSSParserFastPathsTest, ParseInvalidTransform)
86 { 85 {
87 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "rotateX(1deg", HTMLStandardMode); 86 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "rotateX(1deg", HTMLStandardMode);
88 ASSERT_EQ(nullptr, value); 87 ASSERT_EQ(nullptr, value);
89 value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translate Z(1px) (1px, 1px) rotateX(1deg", HTMLStandardMode); 88 value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translate Z(1px) (1px, 1px) rotateX(1deg", HTMLStandardMode);
90 ASSERT_EQ(nullptr, value); 89 ASSERT_EQ(nullptr, value);
91 } 90 }
92 91
93 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698