| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "public/web/WebNode.h" | 6 #include "public/web/WebNode.h" |
| 7 | 7 |
| 8 #include "core/testing/DummyPageHolder.h" | 8 #include "core/testing/DummyPageHolder.h" |
| 9 #include "public/web/WebElement.h" | 9 #include "public/web/WebElement.h" |
| 10 #include "public/web/WebElementCollection.h" | 10 #include "public/web/WebElementCollection.h" |
| 11 #include <gtest/gtest.h> | 11 #include <gtest/gtest.h> |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 using WebCore::Document; | 15 using blink::Document; |
| 16 using WebCore::DummyPageHolder; | 16 using blink::DummyPageHolder; |
| 17 using WebCore::IntSize; | 17 using blink::IntSize; |
| 18 | 18 |
| 19 class WebNodeTest : public testing::Test { | 19 class WebNodeTest : public testing::Test { |
| 20 protected: | 20 protected: |
| 21 Document& document() { return m_pageHolder->document(); } | 21 Document& document() { return m_pageHolder->document(); } |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 virtual void SetUp() OVERRIDE; | 24 virtual void SetUp() OVERRIDE; |
| 25 | 25 |
| 26 OwnPtr<DummyPageHolder> m_pageHolder; | 26 OwnPtr<DummyPageHolder> m_pageHolder; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 void WebNodeTest::SetUp() | 29 void WebNodeTest::SetUp() |
| 30 { | 30 { |
| 31 m_pageHolder = WebCore::DummyPageHolder::create(IntSize(800, 600)); | 31 m_pageHolder = blink::DummyPageHolder::create(IntSize(800, 600)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 TEST_F(WebNodeTest, GetElementsByHTMLTagName) | 34 TEST_F(WebNodeTest, GetElementsByHTMLTagName) |
| 35 { | 35 { |
| 36 document().documentElement()->setInnerHTML("<body><LABEL></LABEL><svg xmlns=
'http://www.w3.org/2000/svg'><label></label></svg></body>", ASSERT_NO_EXCEPTION)
; | 36 document().documentElement()->setInnerHTML("<body><LABEL></LABEL><svg xmlns=
'http://www.w3.org/2000/svg'><label></label></svg></body>", ASSERT_NO_EXCEPTION)
; |
| 37 WebNode node(document().documentElement()); | 37 WebNode node(document().documentElement()); |
| 38 // WebNode::getElementsByHTMLTagName returns only HTML elements. | 38 // WebNode::getElementsByHTMLTagName returns only HTML elements. |
| 39 WebElementCollection collection = node.getElementsByHTMLTagName("label"); | 39 WebElementCollection collection = node.getElementsByHTMLTagName("label"); |
| 40 EXPECT_EQ(1u, collection.length()); | 40 EXPECT_EQ(1u, collection.length()); |
| 41 EXPECT_TRUE(collection.firstItem().hasHTMLTagName("label")); | 41 EXPECT_TRUE(collection.firstItem().hasHTMLTagName("label")); |
| 42 // The argument should be lower-case. | 42 // The argument should be lower-case. |
| 43 collection = node.getElementsByHTMLTagName("LABEL"); | 43 collection = node.getElementsByHTMLTagName("LABEL"); |
| 44 EXPECT_EQ(0u, collection.length()); | 44 EXPECT_EQ(0u, collection.length()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } | 47 } |
| OLD | NEW |