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

Side by Side Diff: cc/animation/animation_player_unittest.cc

Issue 1539233002: CC Animations: Fix the case when main-thread player changes layer_id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/test/animation_timelines_test_common.h » ('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 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
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
OLDNEW
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/test/animation_timelines_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698