OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation/animation_player.h" | 5 #include "cc/animation/animation_player.h" |
6 | 6 |
7 #include "cc/animation/animation_delegate.h" | 7 #include "cc/animation/animation_delegate.h" |
8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 player_->PauseAnimation(animation_id, 1.); | 326 player_->PauseAnimation(animation_id, 1.); |
327 EXPECT_TRUE(client_.mutators_need_commit()); | 327 EXPECT_TRUE(client_.mutators_need_commit()); |
328 client_.set_mutators_need_commit(false); | 328 client_.set_mutators_need_commit(false); |
329 | 329 |
330 player_->RemoveAnimation(animation_id); | 330 player_->RemoveAnimation(animation_id); |
331 EXPECT_TRUE(client_.mutators_need_commit()); | 331 EXPECT_TRUE(client_.mutators_need_commit()); |
332 client_.set_mutators_need_commit(false); | 332 client_.set_mutators_need_commit(false); |
333 } | 333 } |
334 | 334 |
| 335 // If main-thread player switches to another layer within one frame then |
| 336 // impl-thread player must be switched as well. |
| 337 TEST_F(AnimationPlayerTest, SwitchToLayer) { |
| 338 host_->AddAnimationTimeline(timeline_); |
| 339 timeline_->AttachPlayer(player_); |
| 340 player_->AttachLayer(layer_id_); |
| 341 |
| 342 host_->PushPropertiesTo(host_impl_); |
| 343 |
| 344 GetImplTimelineAndPlayerByID(); |
| 345 |
| 346 EXPECT_EQ(player_, GetPlayerForLayerId(layer_id_)); |
| 347 EXPECT_TRUE(player_->element_animations()); |
| 348 EXPECT_EQ(player_->layer_id(), layer_id_); |
| 349 |
| 350 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(layer_id_)); |
| 351 EXPECT_TRUE(player_impl_->element_animations()); |
| 352 EXPECT_EQ(player_impl_->layer_id(), layer_id_); |
| 353 |
| 354 const int new_layer_id = NextTestLayerId(); |
| 355 player_->DetachLayer(); |
| 356 player_->AttachLayer(new_layer_id); |
| 357 |
| 358 EXPECT_EQ(player_, GetPlayerForLayerId(new_layer_id)); |
| 359 EXPECT_TRUE(player_->element_animations()); |
| 360 EXPECT_EQ(player_->layer_id(), new_layer_id); |
| 361 |
| 362 host_->PushPropertiesTo(host_impl_); |
| 363 |
| 364 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_layer_id)); |
| 365 EXPECT_TRUE(player_impl_->element_animations()); |
| 366 EXPECT_EQ(player_impl_->layer_id(), new_layer_id); |
| 367 } |
| 368 |
335 } // namespace | 369 } // namespace |
336 } // namespace cc | 370 } // namespace cc |
OLD | NEW |