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

Side by Side Diff: third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp

Issue 1410313004: Web Animations: Use a single animation clock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 #include "core/animation/CompositorAnimationsImpl.h" 37 #include "core/animation/CompositorAnimationsImpl.h"
38 #include "core/animation/CompositorAnimationsTestHelper.h" 38 #include "core/animation/CompositorAnimationsTestHelper.h"
39 #include "core/animation/ElementAnimations.h" 39 #include "core/animation/ElementAnimations.h"
40 #include "core/animation/KeyframeEffect.h" 40 #include "core/animation/KeyframeEffect.h"
41 #include "core/animation/animatable/AnimatableDouble.h" 41 #include "core/animation/animatable/AnimatableDouble.h"
42 #include "core/animation/animatable/AnimatableFilterOperations.h" 42 #include "core/animation/animatable/AnimatableFilterOperations.h"
43 #include "core/animation/animatable/AnimatableTransform.h" 43 #include "core/animation/animatable/AnimatableTransform.h"
44 #include "core/animation/animatable/AnimatableValueTestHelper.h" 44 #include "core/animation/animatable/AnimatableValueTestHelper.h"
45 #include "core/dom/Document.h" 45 #include "core/dom/Document.h"
46 #include "core/layout/LayoutObject.h" 46 #include "core/layout/LayoutObject.h"
47 #include "core/testing/DummyPageHolder.h"
47 #include "platform/geometry/FloatBox.h" 48 #include "platform/geometry/FloatBox.h"
48 #include "platform/geometry/IntSize.h" 49 #include "platform/geometry/IntSize.h"
49 #include "platform/graphics/filters/FilterOperations.h" 50 #include "platform/graphics/filters/FilterOperations.h"
50 #include "platform/transforms/TransformOperations.h" 51 #include "platform/transforms/TransformOperations.h"
51 #include "platform/transforms/TranslateTransformOperation.h" 52 #include "platform/transforms/TranslateTransformOperation.h"
52 #include "public/platform/WebCompositorAnimation.h" 53 #include "public/platform/WebCompositorAnimation.h"
53 #include "wtf/HashFunctions.h" 54 #include "wtf/HashFunctions.h"
54 #include "wtf/OwnPtr.h" 55 #include "wtf/OwnPtr.h"
55 #include "wtf/PassOwnPtr.h" 56 #include "wtf/PassOwnPtr.h"
56 #include "wtf/PassRefPtr.h" 57 #include "wtf/PassRefPtr.h"
(...skipping 19 matching lines...) Expand all
76 Timing m_timing; 77 Timing m_timing;
77 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; 78 CompositorAnimationsImpl::CompositorTiming m_compositorTiming;
78 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; 79 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2;
79 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; 80 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2;
80 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; 81 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5;
81 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; 82 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5;
82 83
83 RefPtrWillBePersistent<Document> m_document; 84 RefPtrWillBePersistent<Document> m_document;
84 RefPtrWillBePersistent<Element> m_element; 85 RefPtrWillBePersistent<Element> m_element;
85 Persistent<AnimationTimeline> m_timeline; 86 Persistent<AnimationTimeline> m_timeline;
87 OwnPtr<DummyPageHolder> m_pageHolder;
86 88
87 virtual void SetUp() 89 virtual void SetUp()
88 { 90 {
89 AnimationCompositorAnimationsTestBase::SetUp(); 91 AnimationCompositorAnimationsTestBase::SetUp();
90 92
91 m_linearTimingFunction = LinearTimingFunction::shared(); 93 m_linearTimingFunction = LinearTimingFunction::shared();
92 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease); 94 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease);
93 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4); 95 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4);
94 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End); 96 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End);
95 97
96 m_timing = createCompositableTiming(); 98 m_timing = createCompositableTiming();
97 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); 99 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming();
98 // Make sure the CompositableTiming is really compositable, otherwise 100 // Make sure the CompositableTiming is really compositable, otherwise
99 // most other tests will fail. 101 // most other tests will fail.
100 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); 102 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming));
101 103
102 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); 104 m_keyframeVector2 = createCompositableFloatKeyframeVector(2);
103 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2); 105 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2);
104 106
105 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); 107 m_keyframeVector5 = createCompositableFloatKeyframeVector(5);
106 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5); 108 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5);
107 109
108 m_document = Document::create(); 110 m_pageHolder = DummyPageHolder::create();
111 m_document = &m_pageHolder->document();
109 m_document->animationClock().resetTimeForTesting(); 112 m_document->animationClock().resetTimeForTesting();
110 m_timeline = AnimationTimeline::create(m_document.get()); 113 m_timeline = AnimationTimeline::create(m_document.get());
114 m_timeline->resetForTesting();
111 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION); 115 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION);
112 } 116 }
113 117
114 public: 118 public:
115 119
116 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C ompositorTiming& out) 120 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C ompositorTiming& out)
117 { 121 {
118 return CompositorAnimationsImpl::convertTimingForCompositor(t, 0, out, 1 ); 122 return CompositorAnimationsImpl::convertTimingForCompositor(t, 0, out, 1 );
119 } 123 }
120 bool isCandidateForAnimationOnCompositor(const Timing& timing, const EffectM odel& effect) 124 bool isCandidateForAnimationOnCompositor(const Timing& timing, const EffectM odel& effect)
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 simulateFrame(1.); 1246 simulateFrame(1.);
1243 1247
1244 element->setLayoutObject(nullptr); 1248 element->setLayoutObject(nullptr);
1245 LayoutObjectProxy::dispose(layoutObject); 1249 LayoutObjectProxy::dispose(layoutObject);
1246 1250
1247 Heap::collectAllGarbage(); 1251 Heap::collectAllGarbage();
1248 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); 1252 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty());
1249 } 1253 }
1250 1254
1251 } // namespace blink 1255 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698