| 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_timeline.h" | 5 #include "cc/animation/animation_timeline.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_host.h" | 7 #include "cc/animation/animation_host.h" |
| 8 #include "cc/animation/animation_id_provider.h" | 8 #include "cc/animation/animation_id_provider.h" |
| 9 #include "cc/animation/animation_player.h" | 9 #include "cc/animation/animation_player.h" |
| 10 #include "cc/test/animation_test_common.h" | 10 #include "cc/test/animation_test_common.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 TEST(AnimationTimelineTest, SyncPlayersAttachDetach) { | 17 TEST(AnimationTimelineTest, SyncPlayersAttachDetach) { |
| 18 scoped_ptr<AnimationHost> host(AnimationHost::Create(ThreadInstance::MAIN)); | 18 scoped_ptr<AnimationHost> host(AnimationHost::Create()); |
| 19 scoped_ptr<AnimationHost> host_impl( | 19 scoped_ptr<AnimationHost> host_impl(AnimationHost::Create()); |
| 20 AnimationHost::Create(ThreadInstance::IMPL)); | |
| 21 | 20 |
| 22 const int timeline_id = AnimationIdProvider::NextTimelineId(); | 21 const int timeline_id = AnimationIdProvider::NextTimelineId(); |
| 23 const int player_id = AnimationIdProvider::NextPlayerId(); | 22 const int player_id = AnimationIdProvider::NextPlayerId(); |
| 24 | 23 |
| 25 scoped_refptr<AnimationTimeline> timeline_impl( | 24 scoped_refptr<AnimationTimeline> timeline_impl( |
| 26 AnimationTimeline::Create(timeline_id)); | 25 AnimationTimeline::Create(timeline_id)); |
| 27 scoped_refptr<AnimationTimeline> timeline( | 26 scoped_refptr<AnimationTimeline> timeline( |
| 28 AnimationTimeline::Create(timeline_id)); | 27 AnimationTimeline::Create(timeline_id)); |
| 29 | 28 |
| 30 host->AddAnimationTimeline(timeline.get()); | 29 host->AddAnimationTimeline(timeline.get()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 53 timeline->DetachPlayer(player.get()); | 52 timeline->DetachPlayer(player.get()); |
| 54 EXPECT_FALSE(player->animation_timeline()); | 53 EXPECT_FALSE(player->animation_timeline()); |
| 55 | 54 |
| 56 timeline->PushPropertiesTo(timeline_impl.get()); | 55 timeline->PushPropertiesTo(timeline_impl.get()); |
| 57 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id)); | 56 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id)); |
| 58 | 57 |
| 59 EXPECT_FALSE(player_impl->animation_timeline()); | 58 EXPECT_FALSE(player_impl->animation_timeline()); |
| 60 } | 59 } |
| 61 | 60 |
| 62 TEST(AnimationTimelineTest, ClearPlayers) { | 61 TEST(AnimationTimelineTest, ClearPlayers) { |
| 63 scoped_ptr<AnimationHost> host(AnimationHost::Create(ThreadInstance::MAIN)); | 62 scoped_ptr<AnimationHost> host(AnimationHost::Create()); |
| 64 scoped_ptr<AnimationHost> host_impl( | 63 scoped_ptr<AnimationHost> host_impl(AnimationHost::Create()); |
| 65 AnimationHost::Create(ThreadInstance::IMPL)); | |
| 66 | 64 |
| 67 const int timeline_id = AnimationIdProvider::NextTimelineId(); | 65 const int timeline_id = AnimationIdProvider::NextTimelineId(); |
| 68 const int player_id1 = AnimationIdProvider::NextPlayerId(); | 66 const int player_id1 = AnimationIdProvider::NextPlayerId(); |
| 69 const int player_id2 = AnimationIdProvider::NextPlayerId(); | 67 const int player_id2 = AnimationIdProvider::NextPlayerId(); |
| 70 | 68 |
| 71 scoped_refptr<AnimationTimeline> timeline_impl( | 69 scoped_refptr<AnimationTimeline> timeline_impl( |
| 72 AnimationTimeline::Create(timeline_id)); | 70 AnimationTimeline::Create(timeline_id)); |
| 73 scoped_refptr<AnimationTimeline> timeline( | 71 scoped_refptr<AnimationTimeline> timeline( |
| 74 AnimationTimeline::Create(timeline_id)); | 72 AnimationTimeline::Create(timeline_id)); |
| 75 | 73 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 90 EXPECT_FALSE(timeline->GetPlayerById(player_id1)); | 88 EXPECT_FALSE(timeline->GetPlayerById(player_id1)); |
| 91 EXPECT_FALSE(timeline->GetPlayerById(player_id2)); | 89 EXPECT_FALSE(timeline->GetPlayerById(player_id2)); |
| 92 | 90 |
| 93 timeline_impl->ClearPlayers(); | 91 timeline_impl->ClearPlayers(); |
| 94 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id1)); | 92 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id1)); |
| 95 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id2)); | 93 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id2)); |
| 96 } | 94 } |
| 97 | 95 |
| 98 } // namespace | 96 } // namespace |
| 99 } // namespace cc | 97 } // namespace cc |
| OLD | NEW |