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

Side by Side Diff: cc/animation/animation_host_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_host_perftest.cc ('k') | cc/animation/animation_player.h » ('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_host.h" 5 #include "cc/animation/animation_host.h"
6 6
7 #include "cc/animation/animation_id_provider.h" 7 #include "cc/animation/animation_id_provider.h"
8 #include "cc/animation/animation_timeline.h" 8 #include "cc/animation/animation_timeline.h"
9 #include "cc/test/animation_test_common.h" 9 #include "cc/test/animation_test_common.h"
10 #include "cc/test/animation_timelines_test_common.h" 10 #include "cc/test/animation_timelines_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 class AnimationHostTest : public AnimationTimelinesTest { 17 class AnimationHostTest : public AnimationTimelinesTest {
18 public: 18 public:
19 AnimationHostTest() {} 19 AnimationHostTest() {}
20 ~AnimationHostTest() override {} 20 ~AnimationHostTest() override {}
21 }; 21 };
22 22
23 // See AnimationPlayer tests on layer registration/unregistration in 23 // See AnimationPlayer tests on layer registration/unregistration in
24 // animation_player_unittest.cc. 24 // animation_player_unittest.cc.
25 25
26 TEST_F(AnimationHostTest, SyncTimelinesAddRemove) { 26 TEST_F(AnimationHostTest, SyncTimelinesAddRemove) {
27 scoped_ptr<AnimationHost> host(AnimationHost::Create(ThreadInstance::MAIN)); 27 std::unique_ptr<AnimationHost> host(
28 scoped_ptr<AnimationHost> host_impl( 28 AnimationHost::Create(ThreadInstance::MAIN));
29 std::unique_ptr<AnimationHost> host_impl(
29 AnimationHost::Create(ThreadInstance::IMPL)); 30 AnimationHost::Create(ThreadInstance::IMPL));
30 31
31 const int timeline_id = AnimationIdProvider::NextTimelineId(); 32 const int timeline_id = AnimationIdProvider::NextTimelineId();
32 scoped_refptr<AnimationTimeline> timeline( 33 scoped_refptr<AnimationTimeline> timeline(
33 AnimationTimeline::Create(timeline_id)); 34 AnimationTimeline::Create(timeline_id));
34 host->AddAnimationTimeline(timeline.get()); 35 host->AddAnimationTimeline(timeline.get());
35 EXPECT_TRUE(timeline->animation_host()); 36 EXPECT_TRUE(timeline->animation_host());
36 37
37 EXPECT_FALSE(host_impl->GetTimelineById(timeline_id)); 38 EXPECT_FALSE(host_impl->GetTimelineById(timeline_id));
38 39
(...skipping 10 matching lines...) Expand all
49 host->RemoveAnimationTimeline(timeline.get()); 50 host->RemoveAnimationTimeline(timeline.get());
50 EXPECT_FALSE(timeline->animation_host()); 51 EXPECT_FALSE(timeline->animation_host());
51 52
52 host->PushPropertiesTo(host_impl.get()); 53 host->PushPropertiesTo(host_impl.get());
53 EXPECT_FALSE(host_impl->GetTimelineById(timeline_id)); 54 EXPECT_FALSE(host_impl->GetTimelineById(timeline_id));
54 55
55 EXPECT_FALSE(timeline_impl->animation_host()); 56 EXPECT_FALSE(timeline_impl->animation_host());
56 } 57 }
57 58
58 TEST_F(AnimationHostTest, ImplOnlyTimeline) { 59 TEST_F(AnimationHostTest, ImplOnlyTimeline) {
59 scoped_ptr<AnimationHost> host(AnimationHost::Create(ThreadInstance::MAIN)); 60 std::unique_ptr<AnimationHost> host(
60 scoped_ptr<AnimationHost> host_impl( 61 AnimationHost::Create(ThreadInstance::MAIN));
62 std::unique_ptr<AnimationHost> host_impl(
61 AnimationHost::Create(ThreadInstance::IMPL)); 63 AnimationHost::Create(ThreadInstance::IMPL));
62 64
63 const int timeline_id1 = AnimationIdProvider::NextTimelineId(); 65 const int timeline_id1 = AnimationIdProvider::NextTimelineId();
64 const int timeline_id2 = AnimationIdProvider::NextTimelineId(); 66 const int timeline_id2 = AnimationIdProvider::NextTimelineId();
65 67
66 scoped_refptr<AnimationTimeline> timeline( 68 scoped_refptr<AnimationTimeline> timeline(
67 AnimationTimeline::Create(timeline_id1)); 69 AnimationTimeline::Create(timeline_id1));
68 scoped_refptr<AnimationTimeline> timeline_impl( 70 scoped_refptr<AnimationTimeline> timeline_impl(
69 AnimationTimeline::Create(timeline_id2)); 71 AnimationTimeline::Create(timeline_id2));
70 timeline_impl->set_is_impl_only(true); 72 timeline_impl->set_is_impl_only(true);
(...skipping 28 matching lines...) Expand all
99 // Detach all players from layers and timelines. 101 // Detach all players from layers and timelines.
100 host_impl_->ClearTimelines(); 102 host_impl_->ClearTimelines();
101 103
102 time += base::TimeDelta::FromSecondsD(0.1); 104 time += base::TimeDelta::FromSecondsD(0.1);
103 EXPECT_FALSE(host_impl_->ImplOnlyScrollAnimationUpdateTarget( 105 EXPECT_FALSE(host_impl_->ImplOnlyScrollAnimationUpdateTarget(
104 layer_id_, scroll_delta, max_scroll_offset, time)); 106 layer_id_, scroll_delta, max_scroll_offset, time));
105 } 107 }
106 108
107 } // namespace 109 } // namespace
108 } // namespace cc 110 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_host_perftest.cc ('k') | cc/animation/animation_player.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698