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

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

Issue 1749713002: Allow simple selectors after ::content for compat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/StyleSheetContents.h" 8 #include "core/css/StyleSheetContents.h"
9 #include "core/css/parser/CSSTokenizer.h" 9 #include "core/css/parser/CSSTokenizer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 } 114 }
115 115
116 TEST(CSSSelectorParserTest, ShadowDomPseudoInCompound) 116 TEST(CSSSelectorParserTest, ShadowDomPseudoInCompound)
117 { 117 {
118 const char* testCases[][2] = { 118 const char* testCases[][2] = {
119 { "::shadow", "::shadow" }, 119 { "::shadow", "::shadow" },
120 { ".a::shadow", ".a::shadow" }, 120 { ".a::shadow", ".a::shadow" },
121 { "::content", "::content" }, 121 { "::content", "::content" },
122 { ".a::content", ".a::content" }, 122 { ".a::content", ".a::content" },
123 { "::content.a", "::content.a" },
124 { "::content.a.b", "::content.a.b" },
125 { ".a::content.b", ".a::content.b" },
126 { "::content:not(#id)", "::content:not(#id)" }
123 }; 127 };
124 128
125 for (auto testCase : testCases) { 129 for (auto testCase : testCases) {
126 SCOPED_TRACE(testCase[0]); 130 SCOPED_TRACE(testCase[0]);
127 CSSTokenizer::Scope scope(testCase[0]); 131 CSSTokenizer::Scope scope(testCase[0]);
128 CSSParserTokenRange range = scope.tokenRange(); 132 CSSParserTokenRange range = scope.tokenRange();
129 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr); 133 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr);
130 EXPECT_STREQ(testCase[1], list.selectorsText().ascii().data()); 134 EXPECT_STREQ(testCase[1], list.selectorsText().ascii().data());
131 } 135 }
132 } 136 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 180
177 TEST(CSSSelectorParserTest, InvalidSimpleAfterPseudoElementInCompound) 181 TEST(CSSSelectorParserTest, InvalidSimpleAfterPseudoElementInCompound)
178 { 182 {
179 const char* testCases[] = { 183 const char* testCases[] = {
180 "::before#id", 184 "::before#id",
181 "::after:hover", 185 "::after:hover",
182 ".class::content::before", 186 ".class::content::before",
183 "::shadow.class", 187 "::shadow.class",
184 "::selection:window-inactive::before", 188 "::selection:window-inactive::before",
185 "::-webkit-volume-slider.class", 189 "::-webkit-volume-slider.class",
186 "::content.a",
187 "::content.a.b",
188 ".a::content.b",
189 "::before:not(.a)", 190 "::before:not(.a)",
190 "::shadow:not(::after)", 191 "::shadow:not(::after)",
191 "::content:not(#id)",
192 "::-webkit-scrollbar:vertical:not(:first-child)", 192 "::-webkit-scrollbar:vertical:not(:first-child)",
193 "video::-webkit-media-text-track-region-container.scrolling", 193 "video::-webkit-media-text-track-region-container.scrolling",
194 "div ::before.a" 194 "div ::before.a"
195 }; 195 };
196 196
197 for (auto testCase : testCases) { 197 for (auto testCase : testCases) {
198 CSSTokenizer::Scope scope(testCase); 198 CSSTokenizer::Scope scope(testCase);
199 CSSParserTokenRange range = scope.tokenRange(); 199 CSSParserTokenRange range = scope.tokenRange();
200 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr); 200 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr);
201 EXPECT_FALSE(list.isValid()); 201 EXPECT_FALSE(list.isValid());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SCOPED_TRACE(testCase[0]); 299 SCOPED_TRACE(testCase[0]);
300 CSSTokenizer::Scope scope(testCase[0]); 300 CSSTokenizer::Scope scope(testCase[0]);
301 CSSParserTokenRange range = scope.tokenRange(); 301 CSSParserTokenRange range = scope.tokenRange();
302 CSSSelectorList list = CSSSelectorParser::parseSelector(range, context, sheet.get()); 302 CSSSelectorList list = CSSSelectorParser::parseSelector(range, context, sheet.get());
303 EXPECT_TRUE(list.isValid()); 303 EXPECT_TRUE(list.isValid());
304 EXPECT_STREQ(testCase[1], list.selectorsText().ascii().data()); 304 EXPECT_STREQ(testCase[1], list.selectorsText().ascii().data());
305 } 305 }
306 } 306 }
307 307
308 } // namespace blink 308 } // namespace blink
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