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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "ui/gfx/animation/animation_delegate.h" | 6 #include "ui/gfx/animation/animation_delegate.h" |
7 #include "ui/gfx/animation/linear_animation.h" | 7 #include "ui/gfx/animation/linear_animation.h" |
8 #include "ui/gfx/animation/test_animation_delegate.h" | 8 #include "ui/gfx/animation/test_animation_delegate.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 }; | 66 }; |
67 | 67 |
68 /////////////////////////////////////////////////////////////////////////////// | 68 /////////////////////////////////////////////////////////////////////////////// |
69 // DeletingAnimationDelegate | 69 // DeletingAnimationDelegate |
70 | 70 |
71 // AnimationDelegate implementation that deletes the animation in ended. | 71 // AnimationDelegate implementation that deletes the animation in ended. |
72 class DeletingAnimationDelegate : public AnimationDelegate { | 72 class DeletingAnimationDelegate : public AnimationDelegate { |
73 public: | 73 public: |
74 void AnimationEnded(const Animation* animation) override { | 74 void AnimationEnded(const Animation* animation) override { |
75 delete animation; | 75 delete animation; |
76 base::MessageLoop::current()->Quit(); | 76 base::MessageLoop::current()->QuitWhenIdle(); |
77 } | 77 } |
78 }; | 78 }; |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 /////////////////////////////////////////////////////////////////////////////// | 82 /////////////////////////////////////////////////////////////////////////////// |
83 // LinearCase | 83 // LinearCase |
84 | 84 |
85 TEST_F(AnimationTest, RunCase) { | 85 TEST_F(AnimationTest, RunCase) { |
86 TestAnimationDelegate ad; | 86 TestAnimationDelegate ad; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 EXPECT_EQ(0.0, animation.GetCurrentValue()); | 149 EXPECT_EQ(0.0, animation.GetCurrentValue()); |
150 animation.Start(); | 150 animation.Start(); |
151 EXPECT_EQ(0.0, animation.GetCurrentValue()); | 151 EXPECT_EQ(0.0, animation.GetCurrentValue()); |
152 animation.End(); | 152 animation.End(); |
153 EXPECT_EQ(1.0, animation.GetCurrentValue()); | 153 EXPECT_EQ(1.0, animation.GetCurrentValue()); |
154 animation.Start(); | 154 animation.Start(); |
155 EXPECT_EQ(0.0, animation.GetCurrentValue()); | 155 EXPECT_EQ(0.0, animation.GetCurrentValue()); |
156 } | 156 } |
157 | 157 |
158 } // namespace gfx | 158 } // namespace gfx |
OLD | NEW |