OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/CSSSelectorParser.h" | 6 #include "core/css/parser/CSSSelectorParser.h" |
7 | 7 |
| 8 #include "core/css/CSSSelectorList.h" |
8 #include "core/css/parser/CSSTokenizer.h" | 9 #include "core/css/parser/CSSTokenizer.h" |
9 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 typedef struct { | 14 typedef struct { |
14 const char* input; | 15 const char* input; |
15 const int a; | 16 const int a; |
16 const int b; | 17 const int b; |
17 } ANPlusBTestCase; | 18 } ANPlusBTestCase; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 SCOPED_TRACE(testCases[i]); | 106 SCOPED_TRACE(testCases[i]); |
106 | 107 |
107 std::pair<int, int> ab; | 108 std::pair<int, int> ab; |
108 CSSTokenizer::Scope scope(testCases[i]); | 109 CSSTokenizer::Scope scope(testCases[i]); |
109 CSSParserTokenRange range = scope.tokenRange(); | 110 CSSParserTokenRange range = scope.tokenRange(); |
110 bool passed = CSSSelectorParser::consumeANPlusB(range, ab); | 111 bool passed = CSSSelectorParser::consumeANPlusB(range, ab); |
111 EXPECT_FALSE(passed); | 112 EXPECT_FALSE(passed); |
112 } | 113 } |
113 } | 114 } |
114 | 115 |
| 116 TEST(CSSSelectorParserTest, ContentPseudoInCompound) |
| 117 { |
| 118 const char* testCases[][2] = { |
| 119 { "::content", "*::content" }, // crbug.com/478969 |
| 120 { ".a::content", ".a::content" }, |
| 121 { "::content.a", ".a::content" }, |
| 122 { "::content.a.b", ".b.a::content" }, |
| 123 { ".a::content.b", ".b.a::content" }, |
| 124 }; |
| 125 |
| 126 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { |
| 127 SCOPED_TRACE(testCases[i][0]); |
| 128 CSSTokenizer::Scope scope(testCases[i][0]); |
| 129 CSSParserTokenRange range = scope.tokenRange(); |
| 130 CSSSelectorList list; |
| 131 CSSSelectorParser::parseSelector(range, CSSParserContext(HTMLStandardMod
e, nullptr), nullAtom, nullptr, list); |
| 132 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data()); |
| 133 } |
| 134 } |
| 135 |
115 } // namespace | 136 } // namespace |
OLD | NEW |