From ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 24 Feb 2012 16:36:50 +0100 Subject: Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790) --- .../WebKit/chromium/tests/TreeSynchronizerTest.cpp | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp') diff --git a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp index 1557a7d93..4724b4a43 100644 --- a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp +++ b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp @@ -26,13 +26,16 @@ #include "TreeSynchronizer.h" +#include "CCAnimationTestCommon.h" #include "LayerChromium.h" +#include "cc/CCLayerAnimationController.h" #include "cc/CCLayerImpl.h" #include "cc/CCProxy.h" #include "cc/CCSingleThreadProxy.h" #include using namespace WebCore; +using namespace WebKitTests; namespace { @@ -91,6 +94,30 @@ private: Vector* m_ccLayerDestructionList; }; +class FakeLayerAnimationController : public CCLayerAnimationController { +public: + static PassOwnPtr create() + { + return adoptPtr(new FakeLayerAnimationController); + } + + bool synchronizedAnimations() const { return m_synchronizedAnimations; } + +private: + FakeLayerAnimationController() + : m_synchronizedAnimations(false) + { + } + + virtual void synchronizeAnimations(CCLayerAnimationControllerImpl* controllerImpl) + { + CCLayerAnimationController::synchronizeAnimations(controllerImpl); + m_synchronizedAnimations = true; + } + + bool m_synchronizedAnimations; +}; + void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer) { ASSERT_TRUE(layer); @@ -307,5 +334,19 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); } +TEST(TreeSynchronizerTest, synchronizeAnimations) +{ + DebugScopedSetImplThread impl; + RefPtr layerTreeRoot = LayerChromium::create(); + + layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create()); + + EXPECT_FALSE(static_cast(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); + + RefPtr ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get()); + + EXPECT_TRUE(static_cast(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); +} } // namespace -- cgit v1.2.1