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

Side by Side Diff: third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp

Issue 2493003003: Introduce CSS parser mode for distinguishing static/dynamic profile (Closed)
Patch Set: Address review comments Created 4 years, 1 month 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/dom/SelectorQuery.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/dom/SelectorQuery.h" 5 #include "core/dom/SelectorQuery.h"
6 6
7 #include "core/css/parser/CSSParser.h" 7 #include "core/css/parser/CSSParser.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/html/HTMLHtmlElement.h" 9 #include "core/html/HTMLHtmlElement.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include <memory> 11 #include <memory>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 TEST(SelectorQueryTest, NotMatchingPseudoElement) { 15 TEST(SelectorQueryTest, NotMatchingPseudoElement) {
16 Document* document = Document::create(); 16 Document* document = Document::create();
17 HTMLHtmlElement* html = HTMLHtmlElement::create(*document); 17 HTMLHtmlElement* html = HTMLHtmlElement::create(*document);
18 document->appendChild(html); 18 document->appendChild(html);
19 document->documentElement()->setInnerHTML( 19 document->documentElement()->setInnerHTML(
20 "<body><style>span::before { content: 'X' }</style><span></span></body>", 20 "<body><style>span::before { content: 'X' }</style><span></span></body>",
21 ASSERT_NO_EXCEPTION); 21 ASSERT_NO_EXCEPTION);
22 22
23 CSSSelectorList selectorList = CSSParser::parseSelector( 23 CSSSelectorList selectorList = CSSParser::parseSelector(
24 CSSParserContext(*document, nullptr), nullptr, "span::before"); 24 CSSParserContext(*document, nullptr, KURL(), emptyString(),
25 CSSParserContext::StaticProfile),
26 nullptr, "span::before");
25 std::unique_ptr<SelectorQuery> query = 27 std::unique_ptr<SelectorQuery> query =
26 SelectorQuery::adopt(std::move(selectorList)); 28 SelectorQuery::adopt(std::move(selectorList));
27 Element* elm = query->queryFirst(*document); 29 Element* elm = query->queryFirst(*document);
28 EXPECT_EQ(nullptr, elm); 30 EXPECT_EQ(nullptr, elm);
29 31
30 selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr), 32 selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr),
31 nullptr, "span"); 33 nullptr, "span");
32 query = SelectorQuery::adopt(std::move(selectorList)); 34 query = SelectorQuery::adopt(std::move(selectorList));
33 elm = query->queryFirst(*document); 35 elm = query->queryFirst(*document);
34 EXPECT_NE(nullptr, elm); 36 EXPECT_NE(nullptr, elm);
35 } 37 }
36 38
37 } // namespace blink 39 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/SelectorQuery.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698