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

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

Issue 1094213002: Refactored compound selector parsing methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addresses review issues Created 5 years, 8 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 | « 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 "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/parser/CSSTokenizer.h" 9 #include "core/css/parser/CSSTokenizer.h"
9 #include <gtest/gtest.h> 10 #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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 SCOPED_TRACE(testCases[i]); 106 SCOPED_TRACE(testCases[i]);
106 107
107 std::pair<int, int> ab; 108 std::pair<int, int> ab;
108 CSSTokenizer::Scope scope(testCases[i]); 109 CSSTokenizer::Scope scope(testCases[i]);
109 CSSParserTokenRange range = scope.tokenRange(); 110 CSSParserTokenRange range = scope.tokenRange();
110 bool passed = CSSSelectorParser::consumeANPlusB(range, ab); 111 bool passed = CSSSelectorParser::consumeANPlusB(range, ab);
111 EXPECT_FALSE(passed); 112 EXPECT_FALSE(passed);
112 } 113 }
113 } 114 }
114 115
116 TEST(CSSSelectorParserTest, ContentPseudoInCompound)
117 {
118 const char* testCases[][2] = {
119 { "::content", "*::content" }, // crbug.com/478969
120 { ".a::content", ".a::content" },
121 { "::content.a", ".a::content" },
122 { "::content.a.b", ".b.a::content" },
123 { ".a::content.b", ".b.a::content" },
124 };
125
126 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(testCases); ++i) {
127 SCOPED_TRACE(testCases[i][0]);
128 CSSTokenizer::Scope scope(testCases[i][0]);
129 CSSParserTokenRange range = scope.tokenRange();
130 CSSSelectorList list;
131 CSSSelectorParser::parseSelector(range, CSSParserContext(HTMLStandardMod e, nullptr), nullAtom, nullptr, list);
132 EXPECT_STREQ(testCases[i][1], list.selectorsText().ascii().data());
133 }
134 }
135
115 } // namespace 136 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSSelectorParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698