Index: third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp |
diff --git a/third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp b/third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8bc5bfa6b6a3637bdb56b325388babf75cd94aff |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp |
@@ -0,0 +1,30 @@ |
+// 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/dom/ElementRareData.h" |
+ |
+#include "core/layout/LayoutInline.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace blink { |
+ |
+TEST(ElementRareDataTest, ComputedStyleStorage) |
+{ |
+ // Without LayoutObject |
+ ElementRareData* rareData = ElementRareData::create(nullptr); |
+ RefPtr<ComputedStyle> style = ComputedStyle::create(); |
+ rareData->setComputedStyle(style); |
+ EXPECT_EQ(style.get(), rareData->computedStyle()); |
+ |
+ // With LayoutObject |
+ LayoutObject* layoutObject = new LayoutInline(nullptr); |
+ rareData = ElementRareData::create(layoutObject); |
+ rareData->setComputedStyle(style); |
+ EXPECT_EQ(style.get(), rareData->computedStyle()); |
+ |
+ rareData->setLayoutObject(nullptr); |
+ delete layoutObject; |
+} |
+ |
+} // namespace blink |