summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp')
-rw-r--r--Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp41
1 files changed, 41 insertions, 0 deletions
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 <gtest/gtest.h>
using namespace WebCore;
+using namespace WebKitTests;
namespace {
@@ -91,6 +94,30 @@ private:
Vector<int>* m_ccLayerDestructionList;
};
+class FakeLayerAnimationController : public CCLayerAnimationController {
+public:
+ static PassOwnPtr<FakeLayerAnimationController> 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<LayerChromium> layerTreeRoot = LayerChromium::create();
+
+ layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create());
+
+ EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations());
+
+ RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0);
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get());
+
+ EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations());
+}
} // namespace