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

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

Issue 1576553002: Pseudo element selectors in compound selector lists are invalid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review issues Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698