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

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

Issue 1009233002: CC Animations: Port Impl-only-scrolling to use compositor animation timelines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui
Patch Set: Revert AnimationHost::thread_instance_ deletion back. Created 5 years, 5 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/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()); 18 scoped_ptr<AnimationHost> host(AnimationHost::Create(ThreadInstance::MAIN));
19 scoped_ptr<AnimationHost> host_impl(AnimationHost::Create()); 19 scoped_ptr<AnimationHost> host_impl(
20 AnimationHost::Create(ThreadInstance::IMPL));
20 21
21 const int timeline_id = AnimationIdProvider::NextTimelineId(); 22 const int timeline_id = AnimationIdProvider::NextTimelineId();
22 const int player_id = AnimationIdProvider::NextPlayerId(); 23 const int player_id = AnimationIdProvider::NextPlayerId();
23 24
24 scoped_refptr<AnimationTimeline> timeline_impl( 25 scoped_refptr<AnimationTimeline> timeline_impl(
25 AnimationTimeline::Create(timeline_id)); 26 AnimationTimeline::Create(timeline_id));
26 scoped_refptr<AnimationTimeline> timeline( 27 scoped_refptr<AnimationTimeline> timeline(
27 AnimationTimeline::Create(timeline_id)); 28 AnimationTimeline::Create(timeline_id));
28 29
29 host->AddAnimationTimeline(timeline.get()); 30 host->AddAnimationTimeline(timeline.get());
(...skipping 22 matching lines...) Expand all
52 timeline->DetachPlayer(player.get()); 53 timeline->DetachPlayer(player.get());
53 EXPECT_FALSE(player->animation_timeline()); 54 EXPECT_FALSE(player->animation_timeline());
54 55
55 timeline->PushPropertiesTo(timeline_impl.get()); 56 timeline->PushPropertiesTo(timeline_impl.get());
56 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id)); 57 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id));
57 58
58 EXPECT_FALSE(player_impl->animation_timeline()); 59 EXPECT_FALSE(player_impl->animation_timeline());
59 } 60 }
60 61
61 TEST(AnimationTimelineTest, ClearPlayers) { 62 TEST(AnimationTimelineTest, ClearPlayers) {
62 scoped_ptr<AnimationHost> host(AnimationHost::Create()); 63 scoped_ptr<AnimationHost> host(AnimationHost::Create(ThreadInstance::MAIN));
63 scoped_ptr<AnimationHost> host_impl(AnimationHost::Create()); 64 scoped_ptr<AnimationHost> host_impl(
65 AnimationHost::Create(ThreadInstance::IMPL));
64 66
65 const int timeline_id = AnimationIdProvider::NextTimelineId(); 67 const int timeline_id = AnimationIdProvider::NextTimelineId();
66 const int player_id1 = AnimationIdProvider::NextPlayerId(); 68 const int player_id1 = AnimationIdProvider::NextPlayerId();
67 const int player_id2 = AnimationIdProvider::NextPlayerId(); 69 const int player_id2 = AnimationIdProvider::NextPlayerId();
68 70
69 scoped_refptr<AnimationTimeline> timeline_impl( 71 scoped_refptr<AnimationTimeline> timeline_impl(
70 AnimationTimeline::Create(timeline_id)); 72 AnimationTimeline::Create(timeline_id));
71 scoped_refptr<AnimationTimeline> timeline( 73 scoped_refptr<AnimationTimeline> timeline(
72 AnimationTimeline::Create(timeline_id)); 74 AnimationTimeline::Create(timeline_id));
73 75
(...skipping 14 matching lines...) Expand all
88 EXPECT_FALSE(timeline->GetPlayerById(player_id1)); 90 EXPECT_FALSE(timeline->GetPlayerById(player_id1));
89 EXPECT_FALSE(timeline->GetPlayerById(player_id2)); 91 EXPECT_FALSE(timeline->GetPlayerById(player_id2));
90 92
91 timeline_impl->ClearPlayers(); 93 timeline_impl->ClearPlayers();
92 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id1)); 94 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id1));
93 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id2)); 95 EXPECT_FALSE(timeline_impl->GetPlayerById(player_id2));
94 } 96 }
95 97
96 } // namespace 98 } // namespace
97 } // namespace cc 99 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698