OLD | NEW |
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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/gfx/animation/animation_container_observer.h" | 9 #include "ui/gfx/animation/animation_container_observer.h" |
10 #include "ui/gfx/animation/linear_animation.h" | 10 #include "ui/gfx/animation/linear_animation.h" |
11 #include "ui/gfx/animation/test_animation_delegate.h" | 11 #include "ui/gfx/animation/test_animation_delegate.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class FakeAnimationContainerObserver : public AnimationContainerObserver { | 17 class FakeAnimationContainerObserver : public AnimationContainerObserver { |
18 public: | 18 public: |
19 FakeAnimationContainerObserver() | 19 FakeAnimationContainerObserver() |
20 : progressed_count_(0), | 20 : progressed_count_(0), |
21 empty_(false) { | 21 empty_(false) { |
22 } | 22 } |
23 | 23 |
24 int progressed_count() const { return progressed_count_; } | 24 int progressed_count() const { return progressed_count_; } |
25 bool empty() const { return empty_; } | 25 bool empty() const { return empty_; } |
26 | 26 |
27 private: | 27 private: |
28 virtual void AnimationContainerProgressed( | 28 virtual void AnimationContainerProgressed( |
29 AnimationContainer* container) OVERRIDE { | 29 AnimationContainer* container) override { |
30 progressed_count_++; | 30 progressed_count_++; |
31 } | 31 } |
32 | 32 |
33 // Invoked when no more animations are being managed by this container. | 33 // Invoked when no more animations are being managed by this container. |
34 virtual void AnimationContainerEmpty(AnimationContainer* container) OVERRIDE { | 34 virtual void AnimationContainerEmpty(AnimationContainer* container) override { |
35 empty_ = true; | 35 empty_ = true; |
36 } | 36 } |
37 | 37 |
38 int progressed_count_; | 38 int progressed_count_; |
39 bool empty_; | 39 bool empty_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(FakeAnimationContainerObserver); | 41 DISALLOW_COPY_AND_ASSIGN(FakeAnimationContainerObserver); |
42 }; | 42 }; |
43 | 43 |
44 class TestAnimation : public LinearAnimation { | 44 class TestAnimation : public LinearAnimation { |
45 public: | 45 public: |
46 explicit TestAnimation(AnimationDelegate* delegate) | 46 explicit TestAnimation(AnimationDelegate* delegate) |
47 : LinearAnimation(20, 20, delegate) { | 47 : LinearAnimation(20, 20, delegate) { |
48 } | 48 } |
49 | 49 |
50 virtual void AnimateToState(double state) OVERRIDE { | 50 virtual void AnimateToState(double state) override { |
51 } | 51 } |
52 | 52 |
53 private: | 53 private: |
54 DISALLOW_COPY_AND_ASSIGN(TestAnimation); | 54 DISALLOW_COPY_AND_ASSIGN(TestAnimation); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 class AnimationContainerTest: public testing::Test { | 59 class AnimationContainerTest: public testing::Test { |
60 private: | 60 private: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 EXPECT_TRUE(observer.empty()); | 130 EXPECT_TRUE(observer.empty()); |
131 | 131 |
132 // And the container should no longer be running. | 132 // And the container should no longer be running. |
133 EXPECT_FALSE(container->is_running()); | 133 EXPECT_FALSE(container->is_running()); |
134 | 134 |
135 container->set_observer(NULL); | 135 container->set_observer(NULL); |
136 } | 136 } |
137 | 137 |
138 } // namespace gfx | 138 } // namespace gfx |
OLD | NEW |