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

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

Issue 1607873002: Serialize namespaced type/* selectors according to CSSOM spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@queryselector-no-pseudoelm-20160118
Patch Set: Rebased Created 4 years, 10 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 RefPtrWillBeRawPtr<StyleSheetContents> sheet = StyleSheetContents::create(co ntext); 264 RefPtrWillBeRawPtr<StyleSheetContents> sheet = StyleSheetContents::create(co ntext);
265 265
266 for (auto testCase : testCases) { 266 for (auto testCase : testCases) {
267 CSSTokenizer::Scope scope(testCase); 267 CSSTokenizer::Scope scope(testCase);
268 CSSParserTokenRange range = scope.tokenRange(); 268 CSSParserTokenRange range = scope.tokenRange();
269 CSSSelectorList list = CSSSelectorParser::parseSelector(range, context, sheet.get()); 269 CSSSelectorList list = CSSSelectorParser::parseSelector(range, context, sheet.get());
270 EXPECT_FALSE(list.isValid()); 270 EXPECT_FALSE(list.isValid());
271 } 271 }
272 } 272 }
273 273
274 TEST(CSSSelectorParserTest, SerializedUniversal)
275 {
276 const char* testCases[][2] = {
277 { "*::-webkit-volume-slider", "::-webkit-volume-slider" },
278 { "*::cue(i)", "::cue(i)" },
279 { "*::shadow", "::shadow" },
280 { "*:host-context(.x)", "*:host-context(.x)" },
281 { "*:host", "*:host" },
282 { "|*::-webkit-volume-slider", "|*::-webkit-volume-slider" },
283 { "|*::cue(i)", "|*::cue(i)" },
284 { "|*::shadow", "|*::shadow" },
285 { "*|*::-webkit-volume-slider", "::-webkit-volume-slider" },
286 { "*|*::cue(i)", "::cue(i)" },
287 { "*|*::shadow", "::shadow" },
288 { "ns|*::-webkit-volume-slider", "ns|*::-webkit-volume-slider" },
289 { "ns|*::cue(i)", "ns|*::cue(i)" },
290 { "ns|*::shadow", "ns|*::shadow" }
291 };
292
293 CSSParserContext context(HTMLStandardMode, nullptr);
294 RefPtrWillBeRawPtr<StyleSheetContents> sheet = StyleSheetContents::create(co ntext);
295 sheet->parserAddNamespace("ns", "http://ns.org");
296
297 for (auto testCase : testCases) {
298 SCOPED_TRACE(testCase[0]);
299 CSSTokenizer::Scope scope(testCase[0]);
300 CSSParserTokenRange range = scope.tokenRange();
301 CSSSelectorList list = CSSSelectorParser::parseSelector(range, context, sheet.get());
302 EXPECT_TRUE(list.isValid());
303 EXPECT_STREQ(testCase[1], list.selectorsText().ascii().data());
304 }
305 }
306
274 } // namespace blink 307 } // 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