| 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 "core/css/parser/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
| 6 | 6 |
| 7 #include "core/css/CSSValueList.h" | 7 #include "core/css/CSSValueList.h" |
| 8 #include "core/css/parser/CSSParser.h" | 8 #include "core/css/parser/CSSParser.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 static int computeNumberOfTracks(const CSSValueList* valueList) { | 13 static int computeNumberOfTracks(const CSSValueList* valueList) { |
| 14 int numberOfTracks = 0; | 14 int numberOfTracks = 0; |
| 15 for (auto& value : *valueList) { | 15 for (auto& value : *valueList) { |
| 16 if (value->isGridLineNamesValue()) | 16 if (value->isGridLineNamesValue()) |
| 17 continue; | 17 continue; |
| 18 ++numberOfTracks; | 18 ++numberOfTracks; |
| 19 } | 19 } |
| 20 return numberOfTracks; | 20 return numberOfTracks; |
| 21 } | 21 } |
| 22 | 22 |
| 23 TEST(CSSPropertyParserTest, CSSPaint_Functions) { |
| 24 const CSSValue* value = CSSParser::parseSingleValue( |
| 25 CSSPropertyBackgroundImage, "paint(foo, func1(1px, 3px), red)"); |
| 26 ASSERT_TRUE(value); |
| 27 ASSERT_TRUE(value->isImageGeneratorValue()); |
| 28 EXPECT_EQ(value->cssText(), "paint(foo, func1(1px, 3px), red)"); |
| 29 } |
| 30 |
| 23 TEST(CSSPropertyParserTest, CSSPaint_NoArguments) { | 31 TEST(CSSPropertyParserTest, CSSPaint_NoArguments) { |
| 24 const CSSValue* value = | 32 const CSSValue* value = |
| 25 CSSParser::parseSingleValue(CSSPropertyBackgroundImage, "paint(foo)"); | 33 CSSParser::parseSingleValue(CSSPropertyBackgroundImage, "paint(foo)"); |
| 26 ASSERT_TRUE(value); | 34 ASSERT_TRUE(value); |
| 27 ASSERT_TRUE(value->isImageGeneratorValue()); | 35 ASSERT_TRUE(value->isImageGeneratorValue()); |
| 28 EXPECT_EQ(value->cssText(), "paint(foo)"); | 36 EXPECT_EQ(value->cssText(), "paint(foo)"); |
| 29 } | 37 } |
| 30 | 38 |
| 31 TEST(CSSPropertyParserTest, CSSPaint_ValidArguments) { | 39 TEST(CSSPropertyParserTest, CSSPaint_ValidArguments) { |
| 32 const CSSValue* value = CSSParser::parseSingleValue( | 40 const CSSValue* value = CSSParser::parseSingleValue( |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 259 } |
| 252 | 260 |
| 253 TEST(CSSPropertyParserTest, GridPositionLimit8) { | 261 TEST(CSSPropertyParserTest, GridPositionLimit8) { |
| 254 const CSSValue* value = | 262 const CSSValue* value = |
| 255 CSSParser::parseSingleValue(CSSPropertyGridRowEnd, "-5000000000"); | 263 CSSParser::parseSingleValue(CSSPropertyGridRowEnd, "-5000000000"); |
| 256 DCHECK(value); | 264 DCHECK(value); |
| 257 EXPECT_EQ(getGridPositionInteger(*value), -1000); | 265 EXPECT_EQ(getGridPositionInteger(*value), -1000); |
| 258 } | 266 } |
| 259 | 267 |
| 260 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |