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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp

Issue 1663963004: Blink Compositor Animation: Use PassOwnPtr in CompositorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@curves
Patch Set: Created 4 years, 10 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 private: 99 private:
100 OwnPtr<WebLayerTreeView> m_layerTreeView; 100 OwnPtr<WebLayerTreeView> m_layerTreeView;
101 MockGraphicsLayerClient m_client; 101 MockGraphicsLayerClient m_client;
102 }; 102 };
103 103
104 class AnimationPlayerForTesting : public CompositorAnimationPlayerClient { 104 class AnimationPlayerForTesting : public CompositorAnimationPlayerClient {
105 public: 105 public:
106 AnimationPlayerForTesting() 106 AnimationPlayerForTesting()
107 { 107 {
108 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimati onPlayer()); 108 m_compositorPlayer = CompositorFactory::current().createAnimationPlayer( );
109 } 109 }
110 110
111 CompositorAnimationPlayer* compositorPlayer() const override 111 CompositorAnimationPlayer* compositorPlayer() const override
112 { 112 {
113 return m_compositorPlayer.get(); 113 return m_compositorPlayer.get();
114 } 114 }
115 115
116 OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; 116 OwnPtr<CompositorAnimationPlayer> m_compositorPlayer;
117 }; 117 };
118 118
119 TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations) 119 TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations)
120 { 120 {
121 ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); 121 ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
122 122
123 OwnPtr<CompositorFloatAnimationCurve> curve = adoptPtr(CompositorFactory::cu rrent().createFloatAnimationCurve()); 123 OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFactory::current().c reateFloatAnimationCurve();
124 curve->add(CompositorFloatKeyframe(0.0, 0.0)); 124 curve->add(CompositorFloatKeyframe(0.0, 0.0));
125 OwnPtr<CompositorAnimation> floatAnimation(adoptPtr(CompositorFactory::curre nt().createAnimation(*curve, CompositorAnimation::TargetPropertyOpacity))); 125 OwnPtr<CompositorAnimation> floatAnimation(CompositorFactory::current().crea teAnimation(*curve, CompositorAnimation::TargetPropertyOpacity));
126 int animationId = floatAnimation->id(); 126 int animationId = floatAnimation->id();
127 127
128 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { 128 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
129 OwnPtr<CompositorAnimationTimeline> compositorTimeline = adoptPtr(Compos itorFactory::current().createAnimationTimeline()); 129 OwnPtr<CompositorAnimationTimeline> compositorTimeline = CompositorFacto ry::current().createAnimationTimeline();
130 AnimationPlayerForTesting player; 130 AnimationPlayerForTesting player;
131 131
132 layerTreeView()->attachCompositorAnimationTimeline(compositorTimeline->a nimationTimeline()); 132 layerTreeView()->attachCompositorAnimationTimeline(compositorTimeline->a nimationTimeline());
133 compositorTimeline->playerAttached(player); 133 compositorTimeline->playerAttached(player);
134 134
135 player.compositorPlayer()->attachLayer(m_platformLayer); 135 player.compositorPlayer()->attachLayer(m_platformLayer);
136 ASSERT_TRUE(player.compositorPlayer()->isLayerAttached()); 136 ASSERT_TRUE(player.compositorPlayer()->isLayerAttached());
137 137
138 player.compositorPlayer()->addAnimation(floatAnimation.leakPtr()); 138 player.compositorPlayer()->addAnimation(floatAnimation.leakPtr());
139 139
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 WebDoublePoint scrollPosition(7, 9); 232 WebDoublePoint scrollPosition(7, 9);
233 m_platformLayer->setScrollPositionDouble(scrollPosition); 233 m_platformLayer->setScrollPositionDouble(scrollPosition);
234 m_graphicsLayer->didScroll(); 234 m_graphicsLayer->didScroll();
235 235
236 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x() ); 236 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x() );
237 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y() ); 237 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y() );
238 } 238 }
239 239
240 } // namespace blink 240 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698