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/parser/CSSTokenizer.h" | 9 #include "core/css/parser/CSSTokenizer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 typedef struct { | 14 typedef struct { |
14 const char* input; | 15 const char* input; |
15 const int a; | 16 const int a; |
16 const int b; | 17 const int b; |
17 } ANPlusBTestCase; | 18 } ANPlusBTestCase; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 }; | 245 }; |
245 | 246 |
246 for (auto testCase : testCases) { | 247 for (auto testCase : testCases) { |
247 CSSTokenizer::Scope scope(testCase); | 248 CSSTokenizer::Scope scope(testCase); |
248 CSSParserTokenRange range = scope.tokenRange(); | 249 CSSParserTokenRange range = scope.tokenRange(); |
249 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser
Context(HTMLStandardMode, nullptr), nullptr); | 250 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser
Context(HTMLStandardMode, nullptr), nullptr); |
250 EXPECT_FALSE(list.isValid()); | 251 EXPECT_FALSE(list.isValid()); |
251 } | 252 } |
252 } | 253 } |
253 | 254 |
| 255 TEST(CSSSelectorParserTest, UnresolvedNamespacePrefix) |
| 256 { |
| 257 const char* testCases[] = { |
| 258 "ns|div", |
| 259 "div ns|div", |
| 260 "div ns|div " |
| 261 }; |
| 262 |
| 263 CSSParserContext context(HTMLStandardMode, nullptr); |
| 264 RefPtrWillBeRawPtr<StyleSheetContents> sheet = StyleSheetContents::create(co
ntext); |
| 265 |
| 266 for (auto testCase : testCases) { |
| 267 CSSTokenizer::Scope scope(testCase); |
| 268 CSSParserTokenRange range = scope.tokenRange(); |
| 269 CSSSelectorList list = CSSSelectorParser::parseSelector(range, context,
sheet.get()); |
| 270 EXPECT_FALSE(list.isValid()); |
| 271 } |
| 272 } |
| 273 |
254 } // namespace | 274 } // namespace |
OLD | NEW |