Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "cc/animation/animation_host.h" | |
| 6 | |
| 7 #include "cc/animation/animation_id_provider.h" | |
| 8 #include "cc/animation/animation_timeline.h" | |
| 9 #include "cc/test/animation_test_common.h" | |
| 10 #include "testing/gmock/include/gmock/gmock.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 namespace { | |
| 15 | |
| 16 TEST(AnimationHostTest, SyncTimelinesAddRemove) { | |
|
Ian Vollick
2015/05/05 03:52:06
Is layer/player registration and unregistration te
loyso (OOO)
2015/05/05 06:51:18
Yeah, that's in animation_player_unittest.cc
Ian Vollick
2015/05/07 13:58:42
k, great. Please add a comment to this effect here
loyso (OOO)
2015/05/08 01:04:34
Acknowledged.
loyso (OOO)
2015/06/22 07:48:51
Done.
| |
| 17 scoped_ptr<AnimationHost> host(AnimationHost::Create(false)); | |
| 18 scoped_ptr<AnimationHost> host_impl(AnimationHost::Create(true)); | |
| 19 | |
| 20 const int timeline_id = AnimationIdProvider::NextTimelineId(); | |
| 21 scoped_refptr<AnimationTimeline> timeline( | |
| 22 AnimationTimeline::Create(timeline_id)); | |
| 23 host->AddAnimationTimeline(timeline.get()); | |
| 24 EXPECT_TRUE(timeline->animation_host()); | |
| 25 | |
| 26 EXPECT_FALSE(host_impl->GetTimelineById(timeline_id)); | |
| 27 | |
| 28 host->PushPropertiesTo(host_impl.get()); | |
| 29 | |
| 30 scoped_refptr<AnimationTimeline> timeline_impl = | |
| 31 host_impl->GetTimelineById(timeline_id); | |
| 32 EXPECT_TRUE(timeline_impl); | |
| 33 EXPECT_EQ(timeline_impl->id(), timeline_id); | |
| 34 | |
| 35 host->PushPropertiesTo(host_impl.get()); | |
| 36 EXPECT_EQ(timeline_impl, host_impl->GetTimelineById(timeline_id)); | |
| 37 | |
| 38 host->RemoveAnimationTimeline(timeline.get()); | |
| 39 EXPECT_FALSE(timeline->animation_host()); | |
| 40 | |
| 41 host->PushPropertiesTo(host_impl.get()); | |
| 42 EXPECT_FALSE(host_impl->GetTimelineById(timeline_id)); | |
| 43 | |
| 44 EXPECT_FALSE(timeline_impl->animation_host()); | |
| 45 } | |
| 46 | |
| 47 TEST(AnimationHostTest, ImplOnlyTimeline) { | |
| 48 scoped_ptr<AnimationHost> host(AnimationHost::Create(false)); | |
| 49 scoped_ptr<AnimationHost> host_impl(AnimationHost::Create(true)); | |
| 50 | |
| 51 const int timeline_id1 = AnimationIdProvider::NextTimelineId(); | |
| 52 const int timeline_id2 = AnimationIdProvider::NextTimelineId(); | |
| 53 | |
| 54 scoped_refptr<AnimationTimeline> timeline( | |
| 55 AnimationTimeline::Create(timeline_id1)); | |
| 56 scoped_refptr<AnimationTimeline> timeline_impl( | |
| 57 AnimationTimeline::Create(timeline_id2)); | |
| 58 timeline_impl->set_is_impl_only(true); | |
| 59 | |
| 60 host->AddAnimationTimeline(timeline.get()); | |
| 61 host_impl->AddAnimationTimeline(timeline_impl.get()); | |
| 62 | |
| 63 host->PushPropertiesTo(host_impl.get()); | |
| 64 | |
| 65 EXPECT_TRUE(host->GetTimelineById(timeline_id1)); | |
| 66 EXPECT_TRUE(host_impl->GetTimelineById(timeline_id2)); | |
| 67 } | |
| 68 | |
| 69 } // namespace | |
| 70 } // namespace cc | |
| OLD | NEW |