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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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>
12 11
13 namespace blink { 12 namespace blink {
14 13
15 TEST(SelectorQueryTest, NotMatchingPseudoElement) 14 TEST(SelectorQueryTest, NotMatchingPseudoElement)
16 { 15 {
17 Document* document = Document::create(); 16 Document* document = Document::create();
18 HTMLHtmlElement* html = HTMLHtmlElement::create(*document); 17 HTMLHtmlElement* html = HTMLHtmlElement::create(*document);
19 document->appendChild(html); 18 document->appendChild(html);
20 document->documentElement()->setInnerHTML("<body><style>span::before { conte nt: 'X' }</style><span></span></body>", ASSERT_NO_EXCEPTION); 19 document->documentElement()->setInnerHTML("<body><style>span::before { conte nt: 'X' }</style><span></span></body>", ASSERT_NO_EXCEPTION);
21 20
22 CSSSelectorList selectorList = CSSParser::parseSelector(CSSParserContext(*do cument, nullptr), nullptr, "span::before"); 21 CSSSelectorList selectorList = CSSParser::parseSelector(CSSParserContext(*do cument, nullptr), nullptr, "span::before");
23 std::unique_ptr<SelectorQuery> query = SelectorQuery::adopt(std::move(select orList)); 22 OwnPtr<SelectorQuery> query = SelectorQuery::adopt(std::move(selectorList));
24 Element* elm = query->queryFirst(*document); 23 Element* elm = query->queryFirst(*document);
25 EXPECT_EQ(nullptr, elm); 24 EXPECT_EQ(nullptr, elm);
26 25
27 selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr) , nullptr, "span"); 26 selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr) , nullptr, "span");
28 query = SelectorQuery::adopt(std::move(selectorList)); 27 query = SelectorQuery::adopt(std::move(selectorList));
29 elm = query->queryFirst(*document); 28 elm = query->queryFirst(*document);
30 EXPECT_NE(nullptr, elm); 29 EXPECT_NE(nullptr, elm);
31 } 30 }
32 31
33 } // namespace blink 32 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/SelectorQuery.cpp ('k') | third_party/WebKit/Source/core/dom/StyleElementTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698