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 "core/css/parser/CSSSelectorParser.h" | 5 #include "core/css/parser/CSSSelectorParser.h" |
6 | 6 |
7 #include "core/css/CSSSelectorList.h" | 7 #include "core/css/CSSSelectorList.h" |
8 #include "core/css/parser/CSSTokenizer.h" | 8 #include "core/css/parser/CSSTokenizer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { | 127 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { |
128 SCOPED_TRACE(testCases[i][0]); | 128 SCOPED_TRACE(testCases[i][0]); |
129 CSSTokenizer::Scope scope(testCases[i][0]); | 129 CSSTokenizer::Scope scope(testCases[i][0]); |
130 CSSParserTokenRange range = scope.tokenRange(); | 130 CSSParserTokenRange range = scope.tokenRange(); |
131 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser
Context(HTMLStandardMode, nullptr), nullptr); | 131 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser
Context(HTMLStandardMode, nullptr), nullptr); |
132 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data()); | 132 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data()); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
| 136 TEST(CSSSelectorParserTest, PseudoElementsInCompoundLists) |
| 137 { |
| 138 const char* testCases[] = { |
| 139 ":not(::before)", |
| 140 ":not(::content)", |
| 141 ":not(::shadow)", |
| 142 ":host(::before)", |
| 143 ":host(::content)", |
| 144 ":host(::shadow)", |
| 145 ":host-context(::before)", |
| 146 ":host-context(::content)", |
| 147 ":host-context(::shadow)", |
| 148 ":-webkit-any(::after, ::before)", |
| 149 ":-webkit-any(::content, span)", |
| 150 ":-webkit-any(div, ::shadow)" |
| 151 }; |
| 152 |
| 153 for (auto testCase : testCases) { |
| 154 CSSTokenizer::Scope scope(testCase); |
| 155 CSSParserTokenRange range = scope.tokenRange(); |
| 156 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser
Context(HTMLStandardMode, nullptr), nullptr); |
| 157 EXPECT_FALSE(list.isValid()); |
| 158 } |
| 159 } |
| 160 |
136 } // namespace | 161 } // namespace |
OLD | NEW |