OLD | NEW |
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 <memory> |
7 #include "core/css/parser/CSSParser.h" | 8 #include "core/css/parser/CSSParser.h" |
8 #include "core/css/parser/CSSParserContext.h" | 9 #include "core/css/parser/CSSParserContext.h" |
9 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
10 #include "core/html/HTMLDocument.h" | 11 #include "core/html/HTMLDocument.h" |
11 #include "core/html/HTMLHtmlElement.h" | 12 #include "core/html/HTMLHtmlElement.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include <memory> | |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 TEST(SelectorQueryTest, NotMatchingPseudoElement) { | 17 TEST(SelectorQueryTest, NotMatchingPseudoElement) { |
18 Document* document = Document::create(); | 18 Document* document = Document::create(); |
19 HTMLHtmlElement* html = HTMLHtmlElement::create(*document); | 19 HTMLHtmlElement* html = HTMLHtmlElement::create(*document); |
20 document->appendChild(html); | 20 document->appendChild(html); |
21 document->documentElement()->setInnerHTML( | 21 document->documentElement()->setInnerHTML( |
22 "<body><style>span::before { content: 'X' }</style><span></span></body>"); | 22 "<body><style>span::before { content: 'X' }</style><span></span></body>"); |
23 | 23 |
(...skipping 29 matching lines...) Expand all Loading... |
53 CSSParserContext::StaticProfile), | 53 CSSParserContext::StaticProfile), |
54 nullptr, "p:last-of-type"); | 54 nullptr, "p:last-of-type"); |
55 std::unique_ptr<SelectorQuery> query = | 55 std::unique_ptr<SelectorQuery> query = |
56 SelectorQuery::adopt(std::move(selectorList)); | 56 SelectorQuery::adopt(std::move(selectorList)); |
57 Element* elm = query->queryFirst(*document); | 57 Element* elm = query->queryFirst(*document); |
58 ASSERT_TRUE(elm); | 58 ASSERT_TRUE(elm); |
59 EXPECT_EQ("last", elm->idForStyleResolution()); | 59 EXPECT_EQ("last", elm->idForStyleResolution()); |
60 } | 60 } |
61 | 61 |
62 } // namespace blink | 62 } // namespace blink |
OLD | NEW |