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/StyleSheetContents.h" | 8 #include "core/css/StyleSheetContents.h" |
9 #include "core/css/parser/CSSParserContext.h" | 9 #include "core/css/parser/CSSParserContext.h" |
10 #include "core/css/parser/CSSTokenizer.h" | 10 #include "core/css/parser/CSSTokenizer.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 SCOPED_TRACE(testCase[0]); | 324 SCOPED_TRACE(testCase[0]); |
325 CSSTokenizer tokenizer(testCase[0]); | 325 CSSTokenizer tokenizer(testCase[0]); |
326 CSSParserTokenRange range = tokenizer.tokenRange(); | 326 CSSParserTokenRange range = tokenizer.tokenRange(); |
327 CSSSelectorList list = | 327 CSSSelectorList list = |
328 CSSSelectorParser::parseSelector(range, context, sheet); | 328 CSSSelectorParser::parseSelector(range, context, sheet); |
329 EXPECT_TRUE(list.isValid()); | 329 EXPECT_TRUE(list.isValid()); |
330 EXPECT_STREQ(testCase[1], list.selectorsText().ascii().data()); | 330 EXPECT_STREQ(testCase[1], list.selectorsText().ascii().data()); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
| 334 TEST(CSSSelectorParserTest, AttributeSelectorUniversalInvalid) { |
| 335 const char* testCases[] = {"[*]", "[*|*]"}; |
| 336 |
| 337 CSSParserContext* context = CSSParserContext::create(HTMLStandardMode); |
| 338 StyleSheetContents* sheet = StyleSheetContents::create(context); |
| 339 |
| 340 for (auto testCase : testCases) { |
| 341 SCOPED_TRACE(testCase); |
| 342 CSSTokenizer tokenizer(testCase); |
| 343 CSSParserTokenRange range = tokenizer.tokenRange(); |
| 344 CSSSelectorList list = |
| 345 CSSSelectorParser::parseSelector(range, context, sheet); |
| 346 EXPECT_FALSE(list.isValid()); |
| 347 } |
| 348 } |
| 349 |
334 } // namespace blink | 350 } // namespace blink |
OLD | NEW |