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

Side by Side Diff: cc/test/animation_timelines_test_common.cc

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 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 // 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/test/animation_timelines_test_common.h" 5 #include "cc/test/animation_timelines_test_common.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/animation/animation_events.h" 8 #include "cc/animation/animation_events.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/animation_player.h" 10 #include "cc/animation/animation_player.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 takeover_ = true; 288 takeover_ = true;
289 } 289 }
290 290
291 AnimationTimelinesTest::AnimationTimelinesTest() 291 AnimationTimelinesTest::AnimationTimelinesTest()
292 : client_(ThreadInstance::MAIN), 292 : client_(ThreadInstance::MAIN),
293 client_impl_(ThreadInstance::IMPL), 293 client_impl_(ThreadInstance::IMPL),
294 host_(nullptr), 294 host_(nullptr),
295 host_impl_(nullptr), 295 host_impl_(nullptr),
296 timeline_id_(AnimationIdProvider::NextTimelineId()), 296 timeline_id_(AnimationIdProvider::NextTimelineId()),
297 player_id_(AnimationIdProvider::NextPlayerId()), 297 player_id_(AnimationIdProvider::NextPlayerId()),
298 next_test_layer_id_(0) { 298 next_test_element_id_(0) {
299 host_ = client_.host(); 299 host_ = client_.host();
300 host_impl_ = client_impl_.host(); 300 host_impl_ = client_impl_.host();
301 301
302 element_id_ = NextTestLayerId(); 302 element_id_ = NextTestElementId();
303 } 303 }
304 304
305 AnimationTimelinesTest::~AnimationTimelinesTest() { 305 AnimationTimelinesTest::~AnimationTimelinesTest() {
306 } 306 }
307 307
308 void AnimationTimelinesTest::SetUp() { 308 void AnimationTimelinesTest::SetUp() {
309 timeline_ = AnimationTimeline::Create(timeline_id_); 309 timeline_ = AnimationTimeline::Create(timeline_id_);
310 player_ = AnimationPlayer::Create(player_id_); 310 player_ = AnimationPlayer::Create(player_id_);
311 } 311 }
312 312
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 host_impl_->AnimateLayers(time); 382 host_impl_->AnimateLayers(time);
383 host_impl_->UpdateAnimationState(true, events.get()); 383 host_impl_->UpdateAnimationState(true, events.get());
384 EXPECT_EQ(expect_events, events->events_.size()); 384 EXPECT_EQ(expect_events, events->events_.size());
385 385
386 host_->AnimateLayers(time); 386 host_->AnimateLayers(time);
387 host_->UpdateAnimationState(true, nullptr); 387 host_->UpdateAnimationState(true, nullptr);
388 host_->SetAnimationEvents(std::move(events)); 388 host_->SetAnimationEvents(std::move(events));
389 } 389 }
390 390
391 AnimationPlayer* AnimationTimelinesTest::GetPlayerForLayerId( 391 AnimationPlayer* AnimationTimelinesTest::GetPlayerForElementId(
392 ElementId element_id) { 392 ElementId element_id) {
393 const scoped_refptr<ElementAnimations> element_animations = 393 const scoped_refptr<ElementAnimations> element_animations =
394 host_->GetElementAnimationsForElementId(element_id); 394 host_->GetElementAnimationsForElementId(element_id);
395 return element_animations ? element_animations->players_list().head()->value() 395 return element_animations ? element_animations->players_list().head()->value()
396 : nullptr; 396 : nullptr;
397 } 397 }
398 398
399 AnimationPlayer* AnimationTimelinesTest::GetImplPlayerForLayerId( 399 AnimationPlayer* AnimationTimelinesTest::GetImplPlayerForElementId(
400 ElementId element_id) { 400 ElementId element_id) {
401 const scoped_refptr<ElementAnimations> element_animations = 401 const scoped_refptr<ElementAnimations> element_animations =
402 host_impl_->GetElementAnimationsForElementId(element_id); 402 host_impl_->GetElementAnimationsForElementId(element_id);
403 return element_animations ? element_animations->players_list().head()->value() 403 return element_animations ? element_animations->players_list().head()->value()
404 : nullptr; 404 : nullptr;
405 } 405 }
406 406
407 int AnimationTimelinesTest::NextTestLayerId() { 407 ElementId AnimationTimelinesTest::NextTestElementId() {
408 next_test_layer_id_++; 408 next_test_element_id_++;
409 return next_test_layer_id_; 409 return next_test_element_id_;
410 } 410 }
411 411
412 } // namespace cc 412 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698