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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
7 | 7 |
8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
9 #include "core/css/parser/CSSParser.h" | 9 #include "core/css/parser/CSSParser.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 { | 27 { |
28 struct { | 28 struct { |
29 const CSSPropertyID propertyID; | 29 const CSSPropertyID propertyID; |
30 const char* input; | 30 const char* input; |
31 const size_t output; | 31 const size_t output; |
32 } testCases[] = { | 32 } testCases[] = { |
33 {CSSPropertyGridTemplateColumns, "repeat(999999, 20px)", 999999}, | 33 {CSSPropertyGridTemplateColumns, "repeat(999999, 20px)", 999999}, |
34 {CSSPropertyGridTemplateRows, "repeat(999999, 20px)", 999999}, | 34 {CSSPropertyGridTemplateRows, "repeat(999999, 20px)", 999999}, |
35 {CSSPropertyGridTemplateColumns, "repeat(1000000, 10%)", 1000000}, | 35 {CSSPropertyGridTemplateColumns, "repeat(1000000, 10%)", 1000000}, |
36 {CSSPropertyGridTemplateRows, "repeat(1000000, 10%)", 1000000}, | 36 {CSSPropertyGridTemplateRows, "repeat(1000000, 10%)", 1000000}, |
37 {CSSPropertyGridTemplateColumns, "repeat(1000000, (first) min-content (l
ast))", 1000000}, | 37 {CSSPropertyGridTemplateColumns, "repeat(1000000, [first] min-content [l
ast])", 1000000}, |
38 {CSSPropertyGridTemplateRows, "repeat(1000000, (first) min-content (last
))", 1000000}, | 38 {CSSPropertyGridTemplateRows, "repeat(1000000, [first] min-content [last
])", 1000000}, |
39 {CSSPropertyGridTemplateColumns, "repeat(1000001, auto)", 1000000}, | 39 {CSSPropertyGridTemplateColumns, "repeat(1000001, auto)", 1000000}, |
40 {CSSPropertyGridTemplateRows, "repeat(1000001, auto)", 1000000}, | 40 {CSSPropertyGridTemplateRows, "repeat(1000001, auto)", 1000000}, |
41 {CSSPropertyGridTemplateColumns, "repeat(400000, 2em minmax(10px, max-co
ntent) 0.5fr)", 999999}, | 41 {CSSPropertyGridTemplateColumns, "repeat(400000, 2em minmax(10px, max-co
ntent) 0.5fr)", 999999}, |
42 {CSSPropertyGridTemplateRows, "repeat(400000, 2em minmax(10px, max-conte
nt) 0.5fr)", 999999}, | 42 {CSSPropertyGridTemplateRows, "repeat(400000, 2em minmax(10px, max-conte
nt) 0.5fr)", 999999}, |
43 {CSSPropertyGridTemplateColumns, "repeat(600000, (first) 3vh 10% 2fr (na
v) 10px auto 1fr 6em (last))", 999999}, | 43 {CSSPropertyGridTemplateColumns, "repeat(600000, [first] 3vh 10% 2fr [na
v] 10px auto 1fr 6em [last])", 999999}, |
44 {CSSPropertyGridTemplateRows, "repeat(600000, (first) 3vh 10% 2fr (nav)
10px auto 1fr 6em (last))", 999999}, | 44 {CSSPropertyGridTemplateRows, "repeat(600000, [first] 3vh 10% 2fr [nav]
10px auto 1fr 6em [last])", 999999}, |
45 {CSSPropertyGridTemplateColumns, "repeat(100000000000000000000, 10% 1fr)
", 1000000}, | 45 {CSSPropertyGridTemplateColumns, "repeat(100000000000000000000, 10% 1fr)
", 1000000}, |
46 {CSSPropertyGridTemplateRows, "repeat(100000000000000000000, 10% 1fr)",
1000000}, | 46 {CSSPropertyGridTemplateRows, "repeat(100000000000000000000, 10% 1fr)",
1000000}, |
47 {CSSPropertyGridTemplateColumns, "repeat(100000000000000000000, 10% 5em
1fr auto auto 15px min-content)", 999999}, | 47 {CSSPropertyGridTemplateColumns, "repeat(100000000000000000000, 10% 5em
1fr auto auto 15px min-content)", 999999}, |
48 {CSSPropertyGridTemplateRows, "repeat(100000000000000000000, 10% 5em 1fr
auto auto 15px min-content)", 999999}, | 48 {CSSPropertyGridTemplateRows, "repeat(100000000000000000000, 10% 5em 1fr
auto auto 15px min-content)", 999999}, |
49 }; | 49 }; |
50 | 50 |
51 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { | 51 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { |
52 RefPtrWillBeRawPtr<CSSValue> value = CSSParser::parseSingleValue(testCas
es[i].propertyID, testCases[i].input); | 52 RefPtrWillBeRawPtr<CSSValue> value = CSSParser::parseSingleValue(testCas
es[i].propertyID, testCases[i].input); |
53 ASSERT_TRUE(value); | 53 ASSERT_TRUE(value); |
54 ASSERT_TRUE(value->isValueList()); | 54 ASSERT_TRUE(value->isValueList()); |
55 EXPECT_EQ(computeNumberOfTracks(toCSSValueList(value.get())), testCases[
i].output); | 55 EXPECT_EQ(computeNumberOfTracks(toCSSValueList(value.get())), testCases[
i].output); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 } // namespace blink | 59 } // namespace blink |
OLD | NEW |