Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (112316 => 112317)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-27 21:34:21 UTC (rev 112316)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-27 21:34:55 UTC (rev 112317)
@@ -1,3 +1,23 @@
+2012-03-27 Dana Jansens <[email protected]>
+
+ [chromium] Make use of common animation unit test methods
+ https://bugs.webkit.org/show_bug.cgi?id=82357
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebKitTests::addAnimatedTransformToController):
+ (WebKitTests):
+ * tests/CCAnimationTestCommon.h:
+ (WebKitTests):
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+
2012-03-27 Sami Kyostila <[email protected]>
[chromium] Add TextureCopier for copying texture contents
Modified: trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp (112316 => 112317)
--- trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp 2012-03-27 21:34:21 UTC (rev 112316)
+++ trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp 2012-03-27 21:34:55 UTC (rev 112317)
@@ -148,6 +148,11 @@
addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimingFunction);
}
+void addAnimatedTransformToController(WebCore::CCLayerAnimationController& controller, double duration, int deltaX, int deltaY)
+{
+ addAnimatedTransform(controller, duration, deltaX, deltaY);
+}
+
void addOpacityTransitionToLayer(WebCore::LayerChromium& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
{
addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFunction);
Modified: trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.h (112316 => 112317)
--- trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.h 2012-03-27 21:34:21 UTC (rev 112316)
+++ trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.h 2012-03-27 21:34:55 UTC (rev 112317)
@@ -97,6 +97,7 @@
};
void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
+void addAnimatedTransformToController(WebCore::CCLayerAnimationController&, double duration, int deltaX, int deltaY);
void addOpacityTransitionToLayer(WebCore::LayerChromium&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
void addOpacityTransitionToLayer(WebCore::CCLayerImpl&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp (112316 => 112317)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2012-03-27 21:34:21 UTC (rev 112316)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2012-03-27 21:34:55 UTC (rev 112317)
@@ -26,6 +26,7 @@
#include "cc/CCLayerTreeHostCommon.h"
+#include "CCAnimationTestCommon.h"
#include "CCLayerTreeTestCommon.h"
#include "LayerChromium.h"
#include "TransformationMatrix.h"
@@ -36,6 +37,7 @@
#include <gtest/gtest.h>
using namespace WebCore;
+using namespace WebKitTests;
namespace {
@@ -651,38 +653,6 @@
EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id());
}
-static int addOpacityAnimationToLayer(LayerChromium* layer, float startValue, float endValue, double duration)
-{
- static int id = 0;
- WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
- values.insert(new FloatAnimationValue(0, startValue));
- values.insert(new FloatAnimationValue(duration, endValue));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
-
- IntSize boxSize;
- layer->layerAnimationController()->addAnimation(values, boxSize, animation.get(), id, 0, 0);
- return id++;
-}
-
-static int addTransformAnimationToLayer(LayerChromium* layer, double duration)
-{
- static int id = 0;
- WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
-
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(0, &operations1));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
-
- IntSize boxSize;
- layer->layerAnimationController()->addAnimation(values, boxSize, animation.get(), id, 0, 0);
- return id++;
-}
-
TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
{
RefPtr<LayerChromium> parent = LayerChromium::create();
@@ -705,11 +675,11 @@
childOfRS2->addChild(grandChildOfRS2);
// In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface.
- addOpacityAnimationToLayer(renderSurface1.get(), 1, 0, 10);
- addOpacityAnimationToLayer(renderSurface2.get(), 1, 0, 10);
+ addOpacityTransitionToController(*renderSurface1->layerAnimationController(), 10, 1, 0, false);
+ addOpacityTransitionToController(*renderSurface2->layerAnimationController(), 10, 1, 0, false);
// Also put an animation on a layer without descendants.
- addOpacityAnimationToLayer(grandChildOfRoot.get(), 1, 0, 10);
+ addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false);
TransformationMatrix layerTransform;
layerTransform.translate(1.0, 1.0);
@@ -717,10 +687,10 @@
sublayerTransform.scale3d(10.0, 1.0, 1.0);
// Put transform animations on child, renderSurface2, grandChildOfRoot, and grandChildOfRS2
- addTransformAnimationToLayer(childOfRoot.get(), 10);
- addTransformAnimationToLayer(grandChildOfRoot.get(), 10);
- addTransformAnimationToLayer(renderSurface2.get(), 10);
- addTransformAnimationToLayer(grandChildOfRS2.get(), 10);
+ addAnimatedTransformToController(*childOfRoot->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*grandChildOfRoot->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*renderSurface2->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*grandChildOfRS2->layerAnimationController(), 10, 30, 0);
setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
Modified: trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp (112316 => 112317)
--- trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp 2012-03-27 21:34:21 UTC (rev 112316)
+++ trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp 2012-03-27 21:34:55 UTC (rev 112317)
@@ -26,6 +26,7 @@
#include "cc/CCOcclusionTracker.h"
+#include "CCAnimationTestCommon.h"
#include "FilterOperations.h"
#include "LayerChromium.h"
#include "Region.h"
@@ -40,6 +41,7 @@
#include <gtest/gtest.h>
using namespace WebCore;
+using namespace WebKitTests;
#define EXPECT_EQ_RECT(a, b) \
EXPECT_EQ(a.x(), b.x()); \
@@ -1677,40 +1679,6 @@
MAIN_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransformBehindCamera);
-template<typename LayerType>
-static int addOpacityAnimationToLayer(LayerType* layer, float startValue, float endValue, double duration)
-{
- static int id = 0;
- WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
- values.insert(new FloatAnimationValue(0, startValue));
- values.insert(new FloatAnimationValue(duration, endValue));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
-
- IntSize boxSize;
- layer->layerAnimationController()->addAnimation(values, boxSize, animation.get(), id, 0, 0);
- return id++;
-}
-
-template<typename LayerType>
-static int addTransformAnimationToLayer(LayerType* layer, double duration)
-{
- static int id = 0;
- WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
-
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(0, &operations1));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
-
- IntSize boxSize;
- layer->layerAnimationController()->addAnimation(values, boxSize, animation.get(), id, 0, 0);
- return id++;
-}
-
template<class Types, bool opaqueLayers>
class CCOcclusionTrackerTestAnimationOpacity1OnMainThread : public CCOcclusionTrackerTest<Types, opaqueLayers> {
protected:
@@ -1722,8 +1690,8 @@
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
- addOpacityAnimationToLayer(layer, 0, 1, 10);
- addOpacityAnimationToLayer(surface, 0, 1, 10);
+ addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false);
+ addOpacityTransitionToController(*surface->layerAnimationController(), 10, 0, 1, false);
this->calcDrawEtc(parent);
EXPECT_TRUE(layer->drawOpacityIsAnimating());
@@ -1763,8 +1731,8 @@
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
- addOpacityAnimationToLayer(layer, 1, 0, 10);
- addOpacityAnimationToLayer(surface, 1, 0, 10);
+ addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false);
+ addOpacityTransitionToController(*surface->layerAnimationController(), 10, 1, 0, false);
this->calcDrawEtc(parent);
EXPECT_TRUE(layer->drawOpacityIsAnimating());
@@ -1805,9 +1773,9 @@
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true);
- addTransformAnimationToLayer(layer, 10);
- addTransformAnimationToLayer(surface, 10);
- addTransformAnimationToLayer(surfaceChild, 10);
+ addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*surface->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*surfaceChild->layerAnimationController(), 10, 30, 0);
this->calcDrawEtc(parent);
EXPECT_TRUE(layer->drawTransformIsAnimating());