Index: third_party/WebKit/Source/core/html/HTMLLinkElementTest.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLLinkElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLLinkElementTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..56948731e49ab3e142663a63708ca7ba9dfe5a85 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/html/HTMLLinkElementTest.cpp |
@@ -0,0 +1,42 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/html/HTMLLinkElement.h" |
+ |
+#include "core/dom/Document.h" |
+#include "core/frame/FrameView.h" |
+#include "core/html/HTMLHeadElement.h" |
+#include "core/testing/DummyPageHolder.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace blink { |
+ |
+class HTMLLinkElementTest : public ::testing::Test { |
+ protected: |
+ void SetUp() override; |
+ void TearDown() override {} |
tkent
2016/12/15 01:29:11
Remove this line. You don't need to override it.
lpy
2016/12/15 01:30:36
Done.
|
+ Document& document() const { return m_dummyPageHolder->document(); } |
+ |
+ private: |
+ std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
+}; |
+ |
+void HTMLLinkElementTest::SetUp() { |
+ m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
+} |
+ |
+// This tests that we should ignore empty string value |
+// in href attribute value of the link element. |
+TEST_F(HTMLLinkElementTest, EmptyHrefAttribute) { |
+ document().documentElement()->setInnerHTML( |
+ "<head>" |
+ "<link rel=\"icon\" type=\"image/ico\" href=\"\" />" |
+ "</head>"); |
+ HTMLLinkElement* linkElement = |
+ toElement<HTMLLinkElement>(document().head()->firstChild()); |
+ EXPECT_EQ(KURL(), linkElement->href()); |
+} |
+ |
+} // namespace blink |