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

Side by Side Diff: third_party/WebKit/Source/web/WebNodeTest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "public/web/WebNode.h" 5 #include "public/web/WebNode.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/testing/DummyPageHolder.h" 9 #include "core/testing/DummyPageHolder.h"
10 #include "public/web/WebElement.h" 10 #include "public/web/WebElement.h"
11 #include "public/web/WebElementCollection.h" 11 #include "public/web/WebElementCollection.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include <memory>
14 13
15 namespace blink { 14 namespace blink {
16 15
17 class WebNodeTest : public testing::Test { 16 class WebNodeTest : public testing::Test {
18 protected: 17 protected:
19 Document& document() 18 Document& document()
20 { 19 {
21 return m_pageHolder->document(); 20 return m_pageHolder->document();
22 } 21 }
23 22
24 void setInnerHTML(const String& html) 23 void setInnerHTML(const String& html)
25 { 24 {
26 document().documentElement()->setInnerHTML(html, ASSERT_NO_EXCEPTION); 25 document().documentElement()->setInnerHTML(html, ASSERT_NO_EXCEPTION);
27 } 26 }
28 27
29 WebNode root() 28 WebNode root()
30 { 29 {
31 return WebNode(document().documentElement()); 30 return WebNode(document().documentElement());
32 } 31 }
33 32
34 private: 33 private:
35 void SetUp() override; 34 void SetUp() override;
36 35
37 std::unique_ptr<DummyPageHolder> m_pageHolder; 36 OwnPtr<DummyPageHolder> m_pageHolder;
38 }; 37 };
39 38
40 void WebNodeTest::SetUp() 39 void WebNodeTest::SetUp()
41 { 40 {
42 m_pageHolder = DummyPageHolder::create(IntSize(800, 600)); 41 m_pageHolder = DummyPageHolder::create(IntSize(800, 600));
43 } 42 }
44 43
45 TEST_F(WebNodeTest, QuerySelectorMatches) 44 TEST_F(WebNodeTest, QuerySelectorMatches)
46 { 45 {
47 setInnerHTML("<div id=x><span class=a></span></div>"); 46 setInnerHTML("<div id=x><span class=a></span></div>");
(...skipping 22 matching lines...) Expand all
70 // WebNode::getElementsByHTMLTagName returns only HTML elements. 69 // WebNode::getElementsByHTMLTagName returns only HTML elements.
71 WebElementCollection collection = root().getElementsByHTMLTagName("label"); 70 WebElementCollection collection = root().getElementsByHTMLTagName("label");
72 EXPECT_EQ(1u, collection.length()); 71 EXPECT_EQ(1u, collection.length());
73 EXPECT_TRUE(collection.firstItem().hasHTMLTagName("label")); 72 EXPECT_TRUE(collection.firstItem().hasHTMLTagName("label"));
74 // The argument should be lower-case. 73 // The argument should be lower-case.
75 collection = root().getElementsByHTMLTagName("LABEL"); 74 collection = root().getElementsByHTMLTagName("LABEL");
76 EXPECT_EQ(0u, collection.length()); 75 EXPECT_EQ(0u, collection.length());
77 } 76 }
78 77
79 } // namespace blink 78 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebNode.cpp ('k') | third_party/WebKit/Source/web/WebPagePopupImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698