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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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
« no previous file with comments | « cc/animation/animation_timeline.h ('k') | cc/animation/animation_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(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
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
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
OLDNEW
« no previous file with comments | « cc/animation/animation_timeline.h ('k') | cc/animation/animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698