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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "base/test/scoped_task_environment.h" |
6 #include "build/build_config.h" | 7 #include "build/build_config.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/gfx/animation/animation_delegate.h" | 9 #include "ui/gfx/animation/animation_delegate.h" |
9 #include "ui/gfx/animation/linear_animation.h" | 10 #include "ui/gfx/animation/linear_animation.h" |
10 #include "ui/gfx/animation/test_animation_delegate.h" | 11 #include "ui/gfx/animation/test_animation_delegate.h" |
11 | 12 |
12 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 14 #include "base/test/scoped_task_environment.h" |
13 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
14 #endif | 16 #endif |
15 | 17 |
16 namespace gfx { | 18 namespace gfx { |
17 | 19 |
18 class AnimationTest: public testing::Test { | 20 class AnimationTest: public testing::Test { |
| 21 protected: |
| 22 AnimationTest() |
| 23 : scoped_task_environment_( |
| 24 base::test::ScopedTaskEnvironment::MainThreadType::UI) {} |
| 25 |
19 private: | 26 private: |
20 base::MessageLoopForUI message_loop_; | 27 base::test::ScopedTaskEnvironment scoped_task_environment_; |
21 }; | 28 }; |
22 | 29 |
23 namespace { | 30 namespace { |
24 | 31 |
25 /////////////////////////////////////////////////////////////////////////////// | 32 /////////////////////////////////////////////////////////////////////////////// |
26 // RunAnimation | 33 // RunAnimation |
27 | 34 |
28 class RunAnimation : public LinearAnimation { | 35 class RunAnimation : public LinearAnimation { |
29 public: | 36 public: |
30 RunAnimation(int frame_rate, AnimationDelegate* delegate) | 37 RunAnimation(int frame_rate, AnimationDelegate* delegate) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 EXPECT_EQ(0.0, animation.GetCurrentValue()); | 157 EXPECT_EQ(0.0, animation.GetCurrentValue()); |
151 animation.Start(); | 158 animation.Start(); |
152 EXPECT_EQ(0.0, animation.GetCurrentValue()); | 159 EXPECT_EQ(0.0, animation.GetCurrentValue()); |
153 animation.End(); | 160 animation.End(); |
154 EXPECT_EQ(1.0, animation.GetCurrentValue()); | 161 EXPECT_EQ(1.0, animation.GetCurrentValue()); |
155 animation.Start(); | 162 animation.Start(); |
156 EXPECT_EQ(0.0, animation.GetCurrentValue()); | 163 EXPECT_EQ(0.0, animation.GetCurrentValue()); |
157 } | 164 } |
158 | 165 |
159 } // namespace gfx | 166 } // namespace gfx |
OLD | NEW |