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

Side by Side Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 347483002: Removing the animate step from DoSwapInternal as it happens in the ScheduleAnimate method now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto master. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/trees/thread_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/animation/animation_curve.h" 7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/layer_animation_controller.h" 8 #include "cc/animation/layer_animation_controller.h"
9 #include "cc/animation/scroll_offset_animation_curve.h" 9 #include "cc/animation/scroll_offset_animation_curve.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 int frame_count_with_pending_tree_; 1279 int frame_count_with_pending_tree_;
1280 }; 1280 };
1281 1281
1282 SINGLE_AND_MULTI_THREAD_TEST_F( 1282 SINGLE_AND_MULTI_THREAD_TEST_F(
1283 LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers); 1283 LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers);
1284 1284
1285 class LayerTreeHostAnimationTestAddAnimationAfterAnimating 1285 class LayerTreeHostAnimationTestAddAnimationAfterAnimating
1286 : public LayerTreeHostAnimationTest { 1286 : public LayerTreeHostAnimationTest {
1287 public: 1287 public:
1288 LayerTreeHostAnimationTestAddAnimationAfterAnimating() 1288 LayerTreeHostAnimationTestAddAnimationAfterAnimating()
1289 : num_swap_buffers_(0) {} 1289 : num_swap_buffers_(0), num_animate_calls_(0) {}
1290 1290
1291 virtual void SetupTree() OVERRIDE { 1291 virtual void SetupTree() OVERRIDE {
1292 LayerTreeHostAnimationTest::SetupTree(); 1292 LayerTreeHostAnimationTest::SetupTree();
1293 content_ = Layer::Create(); 1293 content_ = Layer::Create();
1294 content_->SetBounds(gfx::Size(4, 4)); 1294 content_->SetBounds(gfx::Size(4, 4));
1295 layer_tree_host()->root_layer()->AddChild(content_); 1295 layer_tree_host()->root_layer()->AddChild(content_);
1296 } 1296 }
1297 1297
1298 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } 1298 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
1299 1299
1300 virtual void DidCommit() OVERRIDE { 1300 virtual void DidCommit() OVERRIDE {
1301 switch (layer_tree_host()->source_frame_number()) { 1301 switch (layer_tree_host()->source_frame_number()) {
1302 case 1: 1302 case 1:
1303 // First frame: add an animation to the root layer. 1303 // First frame: add an animation to the root layer.
1304 AddAnimatedTransformToLayer(layer_tree_host()->root_layer(), 0.1, 5, 5); 1304 AddAnimatedTransformToLayer(layer_tree_host()->root_layer(), 0.1, 5, 5);
1305 break; 1305 break;
1306 case 2: 1306 case 2:
1307 // Second frame: add an animation to the content layer. The root layer 1307 // Second frame: add an animation to the content layer. The root layer
1308 // animation has caused us to animate already during this frame. 1308 // animation has caused us to animate already during this frame.
1309 AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false); 1309 AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false);
1310 break; 1310 break;
1311 } 1311 }
1312 } 1312 }
1313 1313
1314 virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE {
1315 EXPECT_LT(num_animate_calls_, num_swap_buffers_);
1316 num_animate_calls_++;
1317 LayerTreeHostAnimationTest::Animate(monotonic_time);
1318 }
1319
1314 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, 1320 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
1315 bool result) OVERRIDE { 1321 bool result) OVERRIDE {
1316 // After both animations have started, verify that they have valid 1322 // After both animations have started, verify that they have valid
1317 // start times. 1323 // start times.
1318 num_swap_buffers_++; 1324 num_swap_buffers_++;
1319 AnimationRegistrar::AnimationControllerMap copy = 1325 AnimationRegistrar::AnimationControllerMap copy =
1320 host_impl->animation_registrar()->active_animation_controllers(); 1326 host_impl->animation_registrar()->active_animation_controllers();
1321 if (copy.size() == 2u) { 1327 if (copy.size() == 2u) {
1322 EndTest(); 1328 EndTest();
1323 EXPECT_GE(num_swap_buffers_, 3); 1329 EXPECT_GE(num_swap_buffers_, 3);
(...skipping 11 matching lines...) Expand all
1335 } 1341 }
1336 } 1342 }
1337 } 1343 }
1338 } 1344 }
1339 1345
1340 virtual void AfterTest() OVERRIDE {} 1346 virtual void AfterTest() OVERRIDE {}
1341 1347
1342 private: 1348 private:
1343 scoped_refptr<Layer> content_; 1349 scoped_refptr<Layer> content_;
1344 int num_swap_buffers_; 1350 int num_swap_buffers_;
1351 int num_animate_calls_;
1345 }; 1352 };
1346 1353
1347 SINGLE_AND_MULTI_THREAD_TEST_F( 1354 SINGLE_AND_MULTI_THREAD_TEST_F(
1348 LayerTreeHostAnimationTestAddAnimationAfterAnimating); 1355 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1349 1356
1350 } // namespace 1357 } // namespace
1351 } // namespace cc 1358 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698