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

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

Issue 1574323003: Split compound selector after consume finished. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@upload-base
Patch Set: Removed obsolete serialization hack and fixed unit tests. Created 4 years, 11 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/parser/CSSTokenizer.h" 8 #include "core/css/parser/CSSTokenizer.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 CSSTokenizer::Scope scope(testCases[i]); 108 CSSTokenizer::Scope scope(testCases[i]);
109 CSSParserTokenRange range = scope.tokenRange(); 109 CSSParserTokenRange range = scope.tokenRange();
110 bool passed = CSSSelectorParser::consumeANPlusB(range, ab); 110 bool passed = CSSSelectorParser::consumeANPlusB(range, ab);
111 EXPECT_FALSE(passed); 111 EXPECT_FALSE(passed);
112 } 112 }
113 } 113 }
114 114
115 TEST(CSSSelectorParserTest, ShadowDomPseudoInCompound) 115 TEST(CSSSelectorParserTest, ShadowDomPseudoInCompound)
116 { 116 {
117 const char* testCases[][2] = { 117 const char* testCases[][2] = {
118 { "::shadow", "*::shadow" }, // crbug.com/478969 118 { "::shadow", "::shadow" },
119 { ".a::shadow", ".a::shadow" }, 119 { ".a::shadow", ".a::shadow" },
120 { "::content", "::content" }, 120 { "::content", "::content" },
121 { ".a::content", ".a::content" }, 121 { ".a::content", ".a::content" },
122 { "::content.a", ".a::content" }, 122 { "::content.a", "::content.a" },
123 { "::content.a.b", ".b.a::content" }, 123 { "::content.a.b", "::content.a.b" },
124 { ".a::content.b", ".b.a::content" }, 124 { ".a::content.b", ".a::content.b" },
125 }; 125 };
126 126
127 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) { 127 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) {
128 SCOPED_TRACE(testCases[i][0]); 128 SCOPED_TRACE(testCases[i][0]);
129 CSSTokenizer::Scope scope(testCases[i][0]); 129 CSSTokenizer::Scope scope(testCases[i][0]);
130 CSSParserTokenRange range = scope.tokenRange(); 130 CSSParserTokenRange range = scope.tokenRange();
131 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr); 131 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr);
132 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data()); 132 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data());
133 } 133 }
134 } 134 }
(...skipping 17 matching lines...) Expand all
152 152
153 for (auto testCase : testCases) { 153 for (auto testCase : testCases) {
154 CSSTokenizer::Scope scope(testCase); 154 CSSTokenizer::Scope scope(testCase);
155 CSSParserTokenRange range = scope.tokenRange(); 155 CSSParserTokenRange range = scope.tokenRange();
156 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr); 156 CSSSelectorList list = CSSSelectorParser::parseSelector(range, CSSParser Context(HTMLStandardMode, nullptr), nullptr);
157 EXPECT_FALSE(list.isValid()); 157 EXPECT_FALSE(list.isValid());
158 } 158 }
159 } 159 }
160 160
161 } // namespace 161 } // namespace
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