| 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 std::unique_ptr<AnimationHost> host( |
| 19 scoped_ptr<AnimationHost> host_impl( | 19 AnimationHost::Create(ThreadInstance::MAIN)); |
| 20 std::unique_ptr<AnimationHost> host_impl( |
| 20 AnimationHost::Create(ThreadInstance::IMPL)); | 21 AnimationHost::Create(ThreadInstance::IMPL)); |
| 21 | 22 |
| 22 const int timeline_id = AnimationIdProvider::NextTimelineId(); | 23 const int timeline_id = AnimationIdProvider::NextTimelineId(); |
| 23 const int player_id = AnimationIdProvider::NextPlayerId(); | 24 const int player_id = AnimationIdProvider::NextPlayerId(); |
| 24 | 25 |
| 25 scoped_refptr<AnimationTimeline> timeline_impl( | 26 scoped_refptr<AnimationTimeline> timeline_impl( |
| 26 AnimationTimeline::Create(timeline_id)); | 27 AnimationTimeline::Create(timeline_id)); |
| 27 scoped_refptr<AnimationTimeline> timeline( | 28 scoped_refptr<AnimationTimeline> timeline( |
| 28 AnimationTimeline::Create(timeline_id)); | 29 AnimationTimeline::Create(timeline_id)); |
| 29 | 30 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 53 timeline->DetachPlayer(player.get()); | 54 timeline->DetachPlayer(player.get()); |
| 54 EXPECT_FALSE(player->animation_timeline()); | 55 EXPECT_FALSE(player->animation_timeline()); |
| 55 | 56 |
| 56 timeline->PushPropertiesTo(timeline_impl.get()); | 57 timeline->PushPropertiesTo(timeline_impl.get()); |
| 57 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id)); | 58 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id)); |
| 58 | 59 |
| 59 EXPECT_FALSE(player_impl->animation_timeline()); | 60 EXPECT_FALSE(player_impl->animation_timeline()); |
| 60 } | 61 } |
| 61 | 62 |
| 62 TEST(AnimationTimelineTest, ClearPlayers) { | 63 TEST(AnimationTimelineTest, ClearPlayers) { |
| 63 scoped_ptr<AnimationHost> host(AnimationHost::Create(ThreadInstance::MAIN)); | 64 std::unique_ptr<AnimationHost> host( |
| 64 scoped_ptr<AnimationHost> host_impl( | 65 AnimationHost::Create(ThreadInstance::MAIN)); |
| 66 std::unique_ptr<AnimationHost> host_impl( |
| 65 AnimationHost::Create(ThreadInstance::IMPL)); | 67 AnimationHost::Create(ThreadInstance::IMPL)); |
| 66 | 68 |
| 67 const int timeline_id = AnimationIdProvider::NextTimelineId(); | 69 const int timeline_id = AnimationIdProvider::NextTimelineId(); |
| 68 const int player_id1 = AnimationIdProvider::NextPlayerId(); | 70 const int player_id1 = AnimationIdProvider::NextPlayerId(); |
| 69 const int player_id2 = AnimationIdProvider::NextPlayerId(); | 71 const int player_id2 = AnimationIdProvider::NextPlayerId(); |
| 70 | 72 |
| 71 scoped_refptr<AnimationTimeline> timeline_impl( | 73 scoped_refptr<AnimationTimeline> timeline_impl( |
| 72 AnimationTimeline::Create(timeline_id)); | 74 AnimationTimeline::Create(timeline_id)); |
| 73 scoped_refptr<AnimationTimeline> timeline( | 75 scoped_refptr<AnimationTimeline> timeline( |
| 74 AnimationTimeline::Create(timeline_id)); | 76 AnimationTimeline::Create(timeline_id)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 90 EXPECT_FALSE(timeline->GetPlayerById(player_id1)); | 92 EXPECT_FALSE(timeline->GetPlayerById(player_id1)); |
| 91 EXPECT_FALSE(timeline->GetPlayerById(player_id2)); | 93 EXPECT_FALSE(timeline->GetPlayerById(player_id2)); |
| 92 | 94 |
| 93 timeline_impl->ClearPlayers(); | 95 timeline_impl->ClearPlayers(); |
| 94 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id1)); | 96 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id1)); |
| 95 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id2)); | 97 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id2)); |
| 96 } | 98 } |
| 97 | 99 |
| 98 } // namespace | 100 } // namespace |
| 99 } // namespace cc | 101 } // namespace cc |
| OLD | NEW |