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

Side by Side Diff: ui/gfx/animation/animation_container_unittest.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr 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 | « ui/events/x/events_x_unittest.cc ('k') | ui/gfx/animation/slide_animation.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/gfx/animation/animation_container.h" 5 #include "ui/gfx/animation/animation_container.h"
6 6
7 #include <memory>
8
7 #include "base/macros.h" 9 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/animation/animation_container_observer.h" 11 #include "ui/gfx/animation/animation_container_observer.h"
11 #include "ui/gfx/animation/linear_animation.h" 12 #include "ui/gfx/animation/linear_animation.h"
12 #include "ui/gfx/animation/test_animation_delegate.h" 13 #include "ui/gfx/animation/test_animation_delegate.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 16
16 namespace { 17 namespace {
17 18
18 class FakeAnimationContainerObserver : public AnimationContainerObserver { 19 class FakeAnimationContainerObserver : public AnimationContainerObserver {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 class AnimationContainerTest: public testing::Test { 59 class AnimationContainerTest: public testing::Test {
59 private: 60 private:
60 base::MessageLoopForUI message_loop_; 61 base::MessageLoopForUI message_loop_;
61 }; 62 };
62 63
63 // Makes sure the animation ups the ref count of the container and releases it 64 // Makes sure the animation ups the ref count of the container and releases it
64 // appropriately. 65 // appropriately.
65 TEST_F(AnimationContainerTest, Ownership) { 66 TEST_F(AnimationContainerTest, Ownership) {
66 TestAnimationDelegate delegate; 67 TestAnimationDelegate delegate;
67 scoped_refptr<AnimationContainer> container(new AnimationContainer()); 68 scoped_refptr<AnimationContainer> container(new AnimationContainer());
68 scoped_ptr<Animation> animation(new TestAnimation(&delegate)); 69 std::unique_ptr<Animation> animation(new TestAnimation(&delegate));
69 animation->SetContainer(container.get()); 70 animation->SetContainer(container.get());
70 // Setting the container should up the ref count. 71 // Setting the container should up the ref count.
71 EXPECT_FALSE(container->HasOneRef()); 72 EXPECT_FALSE(container->HasOneRef());
72 73
73 animation.reset(); 74 animation.reset();
74 75
75 // Releasing the animation should decrement the ref count. 76 // Releasing the animation should decrement the ref count.
76 EXPECT_TRUE(container->HasOneRef()); 77 EXPECT_TRUE(container->HasOneRef());
77 } 78 }
78 79
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 129
129 EXPECT_TRUE(observer.empty()); 130 EXPECT_TRUE(observer.empty());
130 131
131 // And the container should no longer be running. 132 // And the container should no longer be running.
132 EXPECT_FALSE(container->is_running()); 133 EXPECT_FALSE(container->is_running());
133 134
134 container->set_observer(NULL); 135 container->set_observer(NULL);
135 } 136 }
136 137
137 } // namespace gfx 138 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/events/x/events_x_unittest.cc ('k') | ui/gfx/animation/slide_animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698