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 "web/PluginPlaceholderImpl.h" | 6 #include "web/PluginPlaceholderImpl.h" |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/CSSValueKeywords.h" | 9 #include "core/CSSValueKeywords.h" |
10 #include "core/HTMLNames.h" | 10 #include "core/HTMLNames.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 EXPECT_CALL(webPluginPlaceholder(), message()).WillOnce(Return(message)); | 92 EXPECT_CALL(webPluginPlaceholder(), message()).WillOnce(Return(message)); |
93 pluginPlaceholder().loadIntoContainer(documentFragment()); | 93 pluginPlaceholder().loadIntoContainer(documentFragment()); |
94 EXPECT_TRUE(documentFragment().textContent().contains(message)); | 94 EXPECT_TRUE(documentFragment().textContent().contains(message)); |
95 EXPECT_FALSE(documentFragment().getElementById("sentinel")); | 95 EXPECT_FALSE(documentFragment().getElementById("sentinel")); |
96 } | 96 } |
97 | 97 |
98 bool isHiddenWithInlineStyle(Element* element) | 98 bool isHiddenWithInlineStyle(Element* element) |
99 { | 99 { |
100 if (!element->inlineStyle()) | 100 if (!element->inlineStyle()) |
101 return false; | 101 return false; |
102 RefPtrWillBeRawPtr<CSSValue> value = element->inlineStyle()->getPropertyCSSV
alue(CSSPropertyDisplay); | 102 NullableCSSValue value = element->inlineStyle()->getPropertyCSSValue(CSSProp
ertyDisplay); |
103 return value && value->isPrimitiveValue() && toCSSPrimitiveValue(value.get()
)->getValueID() == CSSValueNone; | 103 return value && value->isPrimitiveValue() && toCSSPrimitiveValue(value)->get
ValueID() == CSSValueNone; |
104 } | 104 } |
105 | 105 |
106 TEST_F(PluginPlaceholderImplTest, Closeable) | 106 TEST_F(PluginPlaceholderImplTest, Closeable) |
107 { | 107 { |
108 // The closing functionality of PluginPlaceholderElement is tested in | 108 // The closing functionality of PluginPlaceholderElement is tested in |
109 // LayoutTests/fast/plugins. This test only needs to ensure that the | 109 // LayoutTests/fast/plugins. This test only needs to ensure that the |
110 // boolean in WebPluginPlaceholder is respected. | 110 // boolean in WebPluginPlaceholder is respected. |
111 EXPECT_CALL(webPluginPlaceholder(), isCloseable()).WillOnce(Return(true)); | 111 EXPECT_CALL(webPluginPlaceholder(), isCloseable()).WillOnce(Return(true)); |
112 pluginPlaceholder().loadIntoContainer(documentFragment()); | 112 pluginPlaceholder().loadIntoContainer(documentFragment()); |
113 RefPtrWillBeRawPtr<Element> closeButton = documentFragment().getElementById(
"plugin-placeholder-close-button"); | 113 RefPtrWillBeRawPtr<Element> closeButton = documentFragment().getElementById(
"plugin-placeholder-close-button"); |
114 ASSERT_NE(nullptr, closeButton); | 114 ASSERT_NE(nullptr, closeButton); |
115 EXPECT_FALSE(isHiddenWithInlineStyle(closeButton.get())); | 115 EXPECT_FALSE(isHiddenWithInlineStyle(closeButton.get())); |
116 } | 116 } |
117 | 117 |
118 TEST_F(PluginPlaceholderImplTest, NotCloseable) | 118 TEST_F(PluginPlaceholderImplTest, NotCloseable) |
119 { | 119 { |
120 EXPECT_CALL(webPluginPlaceholder(), isCloseable()).WillOnce(Return(false)); | 120 EXPECT_CALL(webPluginPlaceholder(), isCloseable()).WillOnce(Return(false)); |
121 pluginPlaceholder().loadIntoContainer(documentFragment()); | 121 pluginPlaceholder().loadIntoContainer(documentFragment()); |
122 RefPtrWillBeRawPtr<Element> closeButton = documentFragment().getElementById(
"plugin-placeholder-close-button"); | 122 RefPtrWillBeRawPtr<Element> closeButton = documentFragment().getElementById(
"plugin-placeholder-close-button"); |
123 EXPECT_NE(nullptr, closeButton); | 123 EXPECT_NE(nullptr, closeButton); |
124 EXPECT_TRUE(isHiddenWithInlineStyle(closeButton.get())); | 124 EXPECT_TRUE(isHiddenWithInlineStyle(closeButton.get())); |
125 } | 125 } |
126 | 126 |
127 } // namespace | 127 } // namespace |
128 } // namespace blink | 128 } // namespace blink |
OLD | NEW |