OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "core/html/HTMLLinkElement.h" | |
6 | |
7 #include "core/dom/Document.h" | |
8 #include "core/frame/FrameView.h" | |
9 #include "core/html/HTMLHeadElement.h" | |
10 #include "core/testing/DummyPageHolder.h" | |
11 | |
tkent
2016/12/15 01:20:03
Remove the blank line
lpy
2016/12/15 01:25:39
Done.
| |
12 #include "testing/gmock/include/gmock/gmock.h" | |
13 #include "testing/gtest/include/gtest/gtest.h" | |
14 | |
15 namespace blink { | |
16 | |
17 class HTMLLinkElementTest : public ::testing::Test { | |
18 protected: | |
19 void SetUp() override; | |
20 | |
21 void TearDown() override { ThreadState::current()->collectAllGarbage(); } | |
tkent
2016/12/15 01:20:03
We don't need collectAllGarbage() here. There are
lpy
2016/12/15 01:25:39
Done.
| |
22 | |
23 Document& document() const { return m_dummyPageHolder->document(); } | |
24 | |
25 void setHtmlInnerHTML(const char*); | |
26 | |
27 private: | |
28 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; | |
29 }; | |
30 | |
31 void HTMLLinkElementTest::SetUp() { | |
32 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | |
33 } | |
34 | |
35 void HTMLLinkElementTest::setHtmlInnerHTML(const char* htmlContent) { | |
36 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent)); | |
37 document().view()->updateAllLifecyclePhases(); | |
tkent
2016/12/15 01:20:03
updateAllLifecyclePhases() is unnecessary. Then,
lpy
2016/12/15 01:25:39
Done.
| |
38 } | |
39 | |
40 // This tests that we should ignore empty string value | |
41 // in href attribute value of the link element. | |
42 TEST_F(HTMLLinkElementTest, href) { | |
tkent
2016/12/15 01:20:03
The test name should be more specific. e.g. TEST_
lpy
2016/12/15 01:25:39
Done.
| |
43 setHtmlInnerHTML( | |
44 "<head>" | |
45 "<link rel=\"icon\" type=\"image/ico\" href=\"\" />" | |
46 "</head>"); | |
47 HTMLLinkElement* linkElement = | |
48 toElement<HTMLLinkElement>(document().head()->firstChild()); | |
49 EXPECT_EQ(KURL(), linkElement->href()); | |
50 } | |
51 | |
52 } // namespace blink | |
OLD | NEW |