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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSSelectorParser.h" | 6 #include "core/css/parser/CSSSelectorParser.h" |
7 | 7 |
8 #include "core/css/CSSSelectorList.h" | 8 #include "core/css/CSSSelectorList.h" |
9 #include "core/css/parser/CSSTokenizer.h" | 9 #include "core/css/parser/CSSTokenizer.h" |
10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 SCOPED_TRACE(testCases[i]); | 106 SCOPED_TRACE(testCases[i]); |
107 | 107 |
108 std::pair<int, int> ab; | 108 std::pair<int, int> ab; |
109 CSSTokenizer::Scope scope(testCases[i]); | 109 CSSTokenizer::Scope scope(testCases[i]); |
110 CSSParserTokenRange range = scope.tokenRange(); | 110 CSSParserTokenRange range = scope.tokenRange(); |
111 bool passed = CSSSelectorParser::consumeANPlusB(range, ab); | 111 bool passed = CSSSelectorParser::consumeANPlusB(range, ab); |
112 EXPECT_FALSE(passed); | 112 EXPECT_FALSE(passed); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 TEST(CSSSelectorParserTest, ContentPseudoInCompound) | 116 TEST(CSSSelectorParserTest, ShadowDomPseudoInCompound) |
117 { | 117 { |
118 const char* testCases[][2] = { | 118 const char* testCases[][2] = { |
119 { "::content", "*::content" }, // crbug.com/478969 | 119 { "::shadow", "*::shadow" }, // crbug.com/478969 |
| 120 { ".a::shadow", ".a::shadow" }, |
| 121 { "::content", "::content" }, |
120 { ".a::content", ".a::content" }, | 122 { ".a::content", ".a::content" }, |
121 { "::content.a", ".a::content" }, | 123 { "::content.a", ".a::content" }, |
122 { "::content.a.b", ".b.a::content" }, | 124 { "::content.a.b", ".b.a::content" }, |
123 { ".a::content.b", ".b.a::content" }, | 125 { ".a::content.b", ".b.a::content" }, |
124 }; | 126 }; |
125 | 127 |
126 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { | 128 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { |
127 SCOPED_TRACE(testCases[i][0]); | 129 SCOPED_TRACE(testCases[i][0]); |
128 CSSTokenizer::Scope scope(testCases[i][0]); | 130 CSSTokenizer::Scope scope(testCases[i][0]); |
129 CSSParserTokenRange range = scope.tokenRange(); | 131 CSSParserTokenRange range = scope.tokenRange(); |
130 CSSSelectorList list; | 132 CSSSelectorList list; |
131 CSSSelectorParser::parseSelector(range, CSSParserContext(HTMLStandardMod
e, nullptr), nullAtom, nullptr, list); | 133 CSSSelectorParser::parseSelector(range, CSSParserContext(HTMLStandardMod
e, nullptr), nullptr, list); |
132 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data()); | 134 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data()); |
133 } | 135 } |
134 } | 136 } |
135 | 137 |
136 } // namespace | 138 } // namespace |
OLD | NEW |