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

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

Issue 1550243002: Blink CompositorAnimations: Add more tests for integration with CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@assert-if
Patch Set: List new header files in gyp. Created 4 years, 11 months 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 24 matching lines...) Expand all
35 #include "core/animation/AnimationTimeline.h" 35 #include "core/animation/AnimationTimeline.h"
36 #include "core/animation/CompositorAnimationsImpl.h" 36 #include "core/animation/CompositorAnimationsImpl.h"
37 #include "core/animation/CompositorAnimationsTestHelper.h" 37 #include "core/animation/CompositorAnimationsTestHelper.h"
38 #include "core/animation/ElementAnimations.h" 38 #include "core/animation/ElementAnimations.h"
39 #include "core/animation/KeyframeEffect.h" 39 #include "core/animation/KeyframeEffect.h"
40 #include "core/animation/animatable/AnimatableDouble.h" 40 #include "core/animation/animatable/AnimatableDouble.h"
41 #include "core/animation/animatable/AnimatableFilterOperations.h" 41 #include "core/animation/animatable/AnimatableFilterOperations.h"
42 #include "core/animation/animatable/AnimatableTransform.h" 42 #include "core/animation/animatable/AnimatableTransform.h"
43 #include "core/animation/animatable/AnimatableValueTestHelper.h" 43 #include "core/animation/animatable/AnimatableValueTestHelper.h"
44 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
45 #include "core/layout/LayoutBox.h"
45 #include "core/layout/LayoutObject.h" 46 #include "core/layout/LayoutObject.h"
47 #include "core/loader/EmptyClients.h"
48 #include "core/paint/PaintLayer.h"
46 #include "core/testing/DummyPageHolder.h" 49 #include "core/testing/DummyPageHolder.h"
47 #include "platform/geometry/FloatBox.h" 50 #include "platform/geometry/FloatBox.h"
48 #include "platform/geometry/IntSize.h" 51 #include "platform/geometry/IntSize.h"
49 #include "platform/graphics/filters/FilterOperations.h" 52 #include "platform/graphics/filters/FilterOperations.h"
53 #include "platform/graphics/paint/PaintArtifact.h"
54 #include "platform/graphics/test/FakeGraphicsLayerFactory.h"
50 #include "platform/transforms/TransformOperations.h" 55 #include "platform/transforms/TransformOperations.h"
51 #include "platform/transforms/TranslateTransformOperation.h" 56 #include "platform/transforms/TranslateTransformOperation.h"
52 #include "public/platform/WebCompositorAnimation.h" 57 #include "public/platform/WebCompositorAnimation.h"
53 #include "testing/gmock/include/gmock/gmock.h" 58 #include "testing/gmock/include/gmock/gmock.h"
54 #include "testing/gtest/include/gtest/gtest.h" 59 #include "testing/gtest/include/gtest/gtest.h"
55 #include "wtf/HashFunctions.h" 60 #include "wtf/HashFunctions.h"
56 #include "wtf/OwnPtr.h" 61 #include "wtf/OwnPtr.h"
57 #include "wtf/PassOwnPtr.h" 62 #include "wtf/PassOwnPtr.h"
58 #include "wtf/PassRefPtr.h" 63 #include "wtf/PassRefPtr.h"
59 #include "wtf/RefPtr.h" 64 #include "wtf/RefPtr.h"
60 65
61 namespace blink { 66 namespace blink {
62 67
63 using ::testing::ExpectationSet; 68 using ::testing::ExpectationSet;
64 using ::testing::Ref; 69 using ::testing::Ref;
65 using ::testing::Return; 70 using ::testing::Return;
66 using ::testing::_; 71 using ::testing::_;
67 72
73 class MockChromeClient : public EmptyChromeClient {
74 public:
75 MockChromeClient() {}
76 GraphicsLayerFactory* graphicsLayerFactory() const override
77 {
78 return FakeGraphicsLayerFactory::instance();
79 }
80 };
81
82
83 class LayoutObjectProxy : public LayoutBox {
84 public:
85 static LayoutObjectProxy* create(ContainerNode* node)
86 {
87 return new LayoutObjectProxy(node);
88 }
89
90 static void dispose(LayoutObjectProxy* proxy)
91 {
92 proxy->destroy();
93 }
94
95 const char* name() const override { return nullptr; }
96
97 void createCompositedLayer(WebCompositorSupportMock& compositorSupport)
98 {
99 RefPtr<ComputedStyle> computedStyle = ComputedStyle::create();
100 styleWillChange(StyleDifference(), *computedStyle.get());
101 setStyle(computedStyle);
102 styleDidChange(StyleDifference(), nullptr);
103
104 m_contentLayer = new WebContentLayerMock();
105 EXPECT_CALL(compositorSupport, createContentLayer(_)).WillOnce(Return(m_ contentLayer));
106
107 DisableCompositingQueryAsserts disabler;
108 layer()->ensureCompositedLayerMapping();
109 }
110
111 WebContentLayerMock* contentLayer() const
112 {
113 return m_contentLayer;
114 }
115
116 private:
117 explicit LayoutObjectProxy(ContainerNode* node)
118 : LayoutBox(node)
119 {
120 }
121
122 PaintLayerType layerTypeRequired() const override
123 {
124 return NormalPaintLayer;
125 }
126
127 WebContentLayerMock* m_contentLayer;
128 };
129
130
68 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase { 131 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase {
69 protected: 132 protected:
70 RefPtr<TimingFunction> m_linearTimingFunction; 133 RefPtr<TimingFunction> m_linearTimingFunction;
71 RefPtr<TimingFunction> m_cubicEaseTimingFunction; 134 RefPtr<TimingFunction> m_cubicEaseTimingFunction;
72 RefPtr<TimingFunction> m_cubicCustomTimingFunction; 135 RefPtr<TimingFunction> m_cubicCustomTimingFunction;
73 RefPtr<TimingFunction> m_stepTimingFunction; 136 RefPtr<TimingFunction> m_stepTimingFunction;
74 137
75 Timing m_timing; 138 Timing m_timing;
76 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; 139 CompositorAnimationsImpl::CompositorTiming m_compositorTiming;
77 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; 140 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2;
78 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; 141 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2;
79 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; 142 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5;
80 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; 143 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5;
81 144
82 RefPtrWillBePersistent<Document> m_document; 145 RefPtrWillBePersistent<Document> m_document;
83 RefPtrWillBePersistent<Element> m_element; 146 RefPtrWillBePersistent<Element> m_element;
84 Persistent<AnimationTimeline> m_timeline; 147 Persistent<AnimationTimeline> m_timeline;
148 OwnPtrWillBePersistent<MockChromeClient> m_chromeClient;
85 OwnPtr<DummyPageHolder> m_pageHolder; 149 OwnPtr<DummyPageHolder> m_pageHolder;
86 WebCompositorSupportMock m_mockCompositor; 150 WebCompositorSupportMock m_mockCompositor;
87 151
88 virtual void SetUp() 152 virtual void SetUp()
89 { 153 {
154 m_chromeClient = adoptPtrWillBeNoop(new MockChromeClient);
155
90 AnimationCompositorAnimationsTestBase::SetUp(); 156 AnimationCompositorAnimationsTestBase::SetUp();
91 setCompositorForTesting(m_mockCompositor); 157 setCompositorForTesting(m_mockCompositor);
92 158
93 m_linearTimingFunction = LinearTimingFunction::shared(); 159 m_linearTimingFunction = LinearTimingFunction::shared();
94 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease); 160 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease);
95 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4); 161 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4);
96 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End); 162 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End);
97 163
98 m_timing = createCompositableTiming(); 164 m_timing = createCompositableTiming();
99 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); 165 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming();
100 // Make sure the CompositableTiming is really compositable, otherwise 166 // Make sure the CompositableTiming is really compositable, otherwise
101 // most other tests will fail. 167 // most other tests will fail.
102 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); 168 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming));
103 169
104 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); 170 m_keyframeVector2 = createCompositableFloatKeyframeVector(2);
105 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2); 171 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2);
106 172
107 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); 173 m_keyframeVector5 = createCompositableFloatKeyframeVector(5);
108 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5); 174 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5);
109 175
110 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { 176 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
111 EXPECT_CALL(m_mockCompositor, createAnimationTimeline()) 177 EXPECT_CALL(m_mockCompositor, createAnimationTimeline())
112 .WillOnce(Return(new WebCompositorAnimationTimelineMock())); 178 .WillOnce(Return(new WebCompositorAnimationTimelineMock()));
113 } 179 }
114 m_pageHolder = DummyPageHolder::create(); 180
181 Page::PageClients clients;
182 fillWithEmptyClients(clients);
183 clients.chromeClient = m_chromeClient.get();
184 m_pageHolder = DummyPageHolder::create(IntSize(), &clients);
185
115 m_document = &m_pageHolder->document(); 186 m_document = &m_pageHolder->document();
116 m_document->animationClock().resetTimeForTesting(); 187 m_document->animationClock().resetTimeForTesting();
117 188
118 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { 189 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
119 EXPECT_CALL(m_mockCompositor, createAnimationTimeline()) 190 EXPECT_CALL(m_mockCompositor, createAnimationTimeline())
120 .WillOnce(Return(new WebCompositorAnimationTimelineMock())); 191 .WillOnce(Return(new WebCompositorAnimationTimelineMock()));
121 } 192 }
122 m_timeline = AnimationTimeline::create(m_document.get()); 193 m_timeline = AnimationTimeline::create(m_document.get());
123 m_timeline->resetForTesting(); 194 m_timeline->resetForTesting();
124 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION); 195 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 328 }
258 return nullptr; 329 return nullptr;
259 } 330 }
260 331
261 void simulateFrame(double time) 332 void simulateFrame(double time)
262 { 333 {
263 m_document->animationClock().updateTime(time); 334 m_document->animationClock().updateTime(time);
264 m_document->compositorPendingAnimations().update(false); 335 m_document->compositorPendingAnimations().update(false);
265 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); 336 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame);
266 } 337 }
267 };
268 338
269 class LayoutObjectProxy : public LayoutObject { 339 PassOwnPtr<WebCompositorAnimationMock> preCommit(LayoutObjectProxy* layoutOb ject, Animation* animation)
270 public:
271 static LayoutObjectProxy* create(Node* node)
272 { 340 {
273 return new LayoutObjectProxy(node); 341 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMoc k;
274 } 342 ExpectationSet usesMockCurve;
343 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
344 .WillOnce(Return(mockCurvePtr));
275 345
276 static void dispose(LayoutObjectProxy* proxy) 346 OwnPtr<WebCompositorAnimationMock> mockAnimationPtr = adoptPtr(new WebCo mpositorAnimationMock(WebCompositorAnimation::TargetPropertyOpacity));
277 { 347 EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurvePtr), WebCom positorAnimation::TargetPropertyOpacity, _, _))
278 proxy->destroy(); 348 .WillOnce(Return(mockAnimationPtr.get()));
279 }
280 349
281 const char* name() const override { return nullptr; } 350 const int animationId = 1;
282 void layout() override { } 351 EXPECT_CALL(*mockAnimationPtr.get(), id()).WillRepeatedly(Return(animati onId));
283 352
284 private: 353 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
285 explicit LayoutObjectProxy(Node* node) 354 EXPECT_TRUE(m_timeline->compositorTimeline());
286 : LayoutObject(node) 355 EXPECT_CALL(m_mockCompositor, createAnimationPlayer())
287 { 356 .WillOnce(Return(new WebCompositorAnimationPlayerMock()));
357 } else {
358 EXPECT_CALL(layoutObject->contentLayer()->layerMock(), addAnimation( _)).WillRepeatedly(Return(true));
359 }
360
361 const int compositorGroup = 1;
362 DisableCompositingQueryAsserts disabler;
363 EXPECT_TRUE(animation->preCommit(compositorGroup, true));
364
365 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
366 EXPECT_TRUE(animation->compositorPlayer());
367
368 EXPECT_TRUE(animation->hasActiveAnimationsOnCompositor());
369 return mockAnimationPtr.release();
288 } 370 }
289 }; 371 };
290 372
291 // ----------------------------------------------------------------------- 373 // -----------------------------------------------------------------------
292 // ----------------------------------------------------------------------- 374 // -----------------------------------------------------------------------
293 375
294 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameMultipleCSSProperties) 376 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameMultipleCSSProperties)
295 { 377 {
296 RefPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDefaultKeyframe (CSSPropertyOpacity, EffectModel::CompositeReplace); 378 RefPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDefaultKeyframe (CSSPropertyOpacity, EffectModel::CompositeReplace);
297 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans form::create(TransformOperations(), 1).get()); 379 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans form::create(TransformOperations(), 1).get());
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 .Times(1) 1250 .Times(1)
1169 .After(usesMockCurve); 1251 .After(usesMockCurve);
1170 1252
1171 // Go! 1253 // Go!
1172 Vector<OwnPtr<WebCompositorAnimation>> result; 1254 Vector<OwnPtr<WebCompositorAnimation>> result;
1173 getAnimationOnCompositor(m_timing, *effect, result); 1255 getAnimationOnCompositor(m_timing, *effect, result);
1174 EXPECT_EQ(1U, result.size()); 1256 EXPECT_EQ(1U, result.size());
1175 result[0].clear(); 1257 result[0].clear();
1176 } 1258 }
1177 1259
1260 TEST_F(AnimationCompositorAnimationsTest, CancelCompositorAnimationIfAnimationDi sposed)
1261 {
1262 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION);
1263
1264 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get());
1265 element->setLayoutObject(layoutObject);
1266 layoutObject->createCompositedLayer(m_mockCompositor);
1267
1268 AnimatableValueKeyframeVector keyFrames;
1269 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get());
1270 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get());
1271 EffectModel* animationEffect = AnimatableValueKeyframeEffectModel::create(ke yFrames);
1272
1273 Timing timing;
1274 timing.iterationDuration = 1.f;
1275
1276 KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), anima tionEffect, timing);
1277 Animation* animation = m_timeline->play(keyframeEffect);
1278 EXPECT_TRUE(animation->isCandidateForAnimationOnCompositor());
1279
1280 OwnPtr<WebCompositorAnimationMock> compositorAnimation = preCommit(layoutObj ect, animation);
1281
1282 animation->dispose();
1283 animation->cancelAnimationOnCompositor();
1284
1285 EXPECT_FALSE(animation->hasActiveAnimationsOnCompositor());
1286
1287 simulateFrame(0);
1288 EXPECT_EQ(1U, element->elementAnimations()->animations().size());
1289 simulateFrame(1.);
1290
1291 element->setLayoutObject(nullptr);
1292 LayoutObjectProxy::dispose(layoutObject);
1293
1294 Heap::collectAllGarbage();
1295 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty());
1296 }
1297
1178 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) 1298 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations )
1179 { 1299 {
1180 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); 1300 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION);
1181 1301
1182 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); 1302 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get());
1183 element->setLayoutObject(layoutObject); 1303 element->setLayoutObject(layoutObject);
1304 layoutObject->createCompositedLayer(m_mockCompositor);
1184 1305
1185 AnimatableValueKeyframeVector keyFrames; 1306 AnimatableValueKeyframeVector keyFrames;
1186 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get()); 1307 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get());
1187 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get()); 1308 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get());
1188 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k eyFrames); 1309 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k eyFrames);
1189 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k eyFrames); 1310 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k eyFrames);
1190 1311
1191 Timing timing; 1312 Timing timing;
1192 timing.iterationDuration = 1.f; 1313 timing.iterationDuration = 1.f;
1193 1314
1194 // The first animation for opacity is ok to run on compositor. 1315 // The first animation for opacity is ok to run on compositor.
1195 KeyframeEffect* keyframeEffect1 = KeyframeEffect::create(element.get(), anim ationEffect1, timing); 1316 KeyframeEffect* keyframeEffect1 = KeyframeEffect::create(element.get(), anim ationEffect1, timing);
1196 Animation* animation1 = m_timeline->play(keyframeEffect1); 1317 Animation* animation1 = m_timeline->play(keyframeEffect1);
1197 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo sitor(timing, *element.get(), animation1, *animationEffect1, 1)); 1318 EXPECT_TRUE(animation1->isCandidateForAnimationOnCompositor());
1198 1319
1199 // simulate KeyframeEffect::maybeStartAnimationOnCompositor 1320 OwnPtr<WebCompositorAnimationMock> compositorAnimation = preCommit(layoutObj ect, animation1);
1200 Vector<int> compositorAnimationIds;
1201 compositorAnimationIds.append(1);
1202 keyframeEffect1->setCompositorAnimationIdsForTesting(compositorAnimationIds) ;
1203 EXPECT_TRUE(animation1->hasActiveAnimationsOnCompositor());
1204 1321
1205 // The second animation for opacity is not ok to run on compositor. 1322 // The second animation for opacity is not ok to run on compositor.
1206 KeyframeEffect* keyframeEffect2 = KeyframeEffect::create(element.get(), anim ationEffect2, timing); 1323 KeyframeEffect* keyframeEffect2 = KeyframeEffect::create(element.get(), anim ationEffect2, timing);
1207 Animation* animation2 = m_timeline->play(keyframeEffect2); 1324 Animation* animation2 = m_timeline->play(keyframeEffect2);
1208 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp ositor(timing, *element.get(), animation2, *animationEffect2, 1)); 1325 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp ositor(timing, *element.get(), animation2, *animationEffect2, 1));
1326 EXPECT_FALSE(animation2->isCandidateForAnimationOnCompositor());
1209 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); 1327 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor());
1210 1328
1211 // A fallback to blink implementation needed, so cancel all compositor-side opacity animations for this element. 1329 // A fallback to blink implementation needed, so cancel all compositor-side opacity animations for this element.
1212 animation2->cancelIncompatibleAnimationsOnCompositor(); 1330 animation2->cancelIncompatibleAnimationsOnCompositor();
1213 1331
1214 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor()); 1332 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor());
1215 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); 1333 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor());
1216 1334
1217 simulateFrame(0); 1335 simulateFrame(0);
1218 EXPECT_EQ(2U, element->elementAnimations()->animations().size()); 1336 EXPECT_EQ(2U, element->elementAnimations()->animations().size());
1219 simulateFrame(1.); 1337 simulateFrame(1.);
1220 1338
1221 element->setLayoutObject(nullptr); 1339 element->setLayoutObject(nullptr);
1222 LayoutObjectProxy::dispose(layoutObject); 1340 LayoutObjectProxy::dispose(layoutObject);
1223 1341
1224 Heap::collectAllGarbage(); 1342 Heap::collectAllGarbage();
1225 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); 1343 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty());
1226 } 1344 }
1227 1345
1228 } // namespace blink 1346 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698