OLD | NEW |
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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 case 2: | 1298 case 2: |
1299 // Second frame: add an animation to the content layer. The root layer | 1299 // Second frame: add an animation to the content layer. The root layer |
1300 // animation has caused us to animate already during this frame. | 1300 // animation has caused us to animate already during this frame. |
1301 AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false); | 1301 AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false); |
1302 break; | 1302 break; |
1303 } | 1303 } |
1304 } | 1304 } |
1305 | 1305 |
1306 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | 1306 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, |
1307 bool result) OVERRIDE { | 1307 bool result) OVERRIDE { |
1308 // The third frame is when both animations have started. Check that both | 1308 // After both animations have started, verify that they have valid |
1309 // have a valid start time. | 1309 // start times. |
1310 if (++num_swap_buffers_ == 3) { | 1310 num_swap_buffers_++; |
| 1311 AnimationRegistrar::AnimationControllerMap copy = |
| 1312 host_impl->animation_registrar()->active_animation_controllers(); |
| 1313 if (copy.size() == 2u) { |
1311 EndTest(); | 1314 EndTest(); |
1312 AnimationRegistrar::AnimationControllerMap copy = | 1315 EXPECT_GE(num_swap_buffers_, 3); |
1313 host_impl->animation_registrar()->active_animation_controllers(); | |
1314 EXPECT_EQ(2u, copy.size()); | |
1315 for (AnimationRegistrar::AnimationControllerMap::iterator iter = | 1316 for (AnimationRegistrar::AnimationControllerMap::iterator iter = |
1316 copy.begin(); | 1317 copy.begin(); |
1317 iter != copy.end(); | 1318 iter != copy.end(); |
1318 ++iter) { | 1319 ++iter) { |
1319 int id = ((*iter).second->id()); | 1320 int id = ((*iter).second->id()); |
1320 if (id == host_impl->RootLayer()->id()) { | 1321 if (id == host_impl->RootLayer()->id()) { |
1321 Animation* anim = (*iter).second->GetAnimation(Animation::Transform); | 1322 Animation* anim = (*iter).second->GetAnimation(Animation::Transform); |
1322 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); | 1323 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
1323 } else if (id == host_impl->RootLayer()->children()[0]->id()) { | 1324 } else if (id == host_impl->RootLayer()->children()[0]->id()) { |
1324 Animation* anim = (*iter).second->GetAnimation(Animation::Opacity); | 1325 Animation* anim = (*iter).second->GetAnimation(Animation::Opacity); |
1325 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); | 1326 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
1326 } | 1327 } |
1327 } | 1328 } |
1328 } | 1329 } |
1329 } | 1330 } |
1330 | 1331 |
1331 virtual void AfterTest() OVERRIDE {} | 1332 virtual void AfterTest() OVERRIDE {} |
1332 | 1333 |
1333 private: | 1334 private: |
1334 scoped_refptr<Layer> content_; | 1335 scoped_refptr<Layer> content_; |
1335 int num_swap_buffers_; | 1336 int num_swap_buffers_; |
1336 }; | 1337 }; |
1337 | 1338 |
1338 SINGLE_AND_MULTI_THREAD_TEST_F( | 1339 SINGLE_AND_MULTI_THREAD_TEST_F( |
1339 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1340 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1340 | 1341 |
1341 } // namespace | 1342 } // namespace |
1342 } // namespace cc | 1343 } // namespace cc |
OLD | NEW |