Chromium Code Reviews| Index: third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp |
| diff --git a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp |
| index d622662f420cbf780f2c2a4c67776b3f282c592a..51ae4de4c8000861badcdd669271ba0041e02de4 100644 |
| --- a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp |
| @@ -8,6 +8,7 @@ |
| #include "core/layout/compositing/PaintLayerCompositor.h" |
| #include "core/page/Page.h" |
| #include "platform/graphics/CompositorMutableProperties.h" |
| +#include "platform/graphics/CompositorMutation.h" |
| #include "platform/graphics/GraphicsLayer.h" |
| #include "platform/testing/URLTestHelpers.h" |
| #include "public/platform/Platform.h" |
| @@ -133,7 +134,7 @@ TEST_F(CompositorWorkerTest, plumbingElementIdAndMutableProperties) |
| WebLayer* tallLayer = webLayerFromElement(tallElement); |
| EXPECT_TRUE(!tallLayer); |
| - Element* proxiedElement = document->getElementById("proxied"); |
| + Element* proxiedElement = document->getElementById("proxied-transform"); |
| WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); |
| EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kTransform); |
| EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutableProperty::kOpacity)); |
| @@ -210,4 +211,56 @@ TEST_F(CompositorWorkerTest, disconnectedProxies) |
| EXPECT_EQ(0UL, rootScrollLayer->elementId()); |
| } |
| +TEST_F(CompositorWorkerTest, applyingMutations) |
| +{ |
| + registerMockedHttpURLLoad("compositor-proxy-basic.html"); |
| + navigateTo(m_baseURL + "compositor-proxy-basic.html"); |
| + |
| + forceFullCompositingUpdate(); |
| + |
| + Document* document = frame()->document(); |
| + |
| + { |
| + Element* proxiedElement = document->getElementById("proxied-transform"); |
| + WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); |
| + EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kTransform); |
| + EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutableProperty::kOpacity)); |
| + uint64_t elementId = proxiedLayer->elementId(); |
| + EXPECT_NE(0UL, elementId); |
| + |
| + TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44); |
| + OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation); |
| + mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatrix)); |
| + |
| + CompositorMutations mutations; |
| + mutations.map.add(elementId, mutation.release()); |
| + |
| + webViewImpl()->applyMutations(mutations); |
| + forceFullCompositingUpdate(); |
| + |
| + const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue(CSSPropertyTransform); |
| + EXPECT_EQ(String("matrix3d(11px, 12px, 13px, 14px, 21px, 22px, 23px, 24px, 31px, 32px, 33px, 34px, 41px, 42px, 43px, 44px)"), cssValue); |
|
jbroman
2016/01/23 23:55:09
It shouldn't be necessary to wrap in a WTF::String
majidvp
2016/01/25 20:40:11
Done.
|
| + } |
| + { |
| + Element* proxiedElement = document->getElementById("proxied-opacity"); |
| + WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); |
| + EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableProperty::kOpacity); |
| + EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop | CompositorMutableProperty::kTransform)); |
| + uint64_t elementId = proxiedLayer->elementId(); |
| + EXPECT_NE(0UL, elementId); |
| + |
| + OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation); |
| + mutation->setOpacity(0.5); |
| + |
| + CompositorMutations mutations; |
| + mutations.map.add(elementId, mutation.release()); |
| + |
| + webViewImpl()->applyMutations(mutations); |
| + forceFullCompositingUpdate(); |
| + |
| + const String& cssValue = proxiedElement->inlineStyle()->getPropertyValue(CSSPropertyOpacity); |
| + EXPECT_EQ(String("0.5"), cssValue); |
| + } |
| +} |
| + |
| } // namespace blink |