Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: Source/web/PluginPlaceholderImplTest.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698