| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/animation/bounds_animator.h" | 5 #include "ui/views/animation/bounds_animator.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/base/animation/slide_animation.h" | 8 #include "ui/gfx/animation/slide_animation.h" |
| 9 #include "ui/base/animation/test_animation_delegate.h" | 9 #include "ui/gfx/animation/test_animation_delegate.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 | 11 |
| 12 using ui::Animation; | 12 using gfx::Animation; |
| 13 using ui::SlideAnimation; | 13 using gfx::SlideAnimation; |
| 14 using ui::TestAnimationDelegate; | 14 using gfx::TestAnimationDelegate; |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class TestBoundsAnimator : public BoundsAnimator { | 19 class TestBoundsAnimator : public BoundsAnimator { |
| 20 public: | 20 public: |
| 21 explicit TestBoundsAnimator(View* view) : BoundsAnimator(view) { | 21 explicit TestBoundsAnimator(View* view) : BoundsAnimator(view) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 protected: | 24 protected: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 deleted_ = false; | 45 deleted_ = false; |
| 46 return value; | 46 return value; |
| 47 } | 47 } |
| 48 | 48 |
| 49 static bool GetAndClearCanceled() { | 49 static bool GetAndClearCanceled() { |
| 50 bool value = canceled_; | 50 bool value = canceled_; |
| 51 canceled_ = false; | 51 canceled_ = false; |
| 52 return value; | 52 return value; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Overridden from ui::AnimationDelegate: | 55 // Overridden from gfx::AnimationDelegate: |
| 56 virtual void AnimationCanceled(const Animation* animation) OVERRIDE { | 56 virtual void AnimationCanceled(const Animation* animation) OVERRIDE { |
| 57 canceled_ = true; | 57 canceled_ = true; |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 static bool deleted_; | 61 static bool deleted_; |
| 62 static bool canceled_; | 62 static bool canceled_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(OwnedDelegate); | 64 DISALLOW_COPY_AND_ASSIGN(OwnedDelegate); |
| 65 }; | 65 }; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 // Shouldn't be animating now. | 173 // Shouldn't be animating now. |
| 174 EXPECT_FALSE(animator()->IsAnimating()); | 174 EXPECT_FALSE(animator()->IsAnimating()); |
| 175 | 175 |
| 176 // Stopping should both cancel the delegate and delete it. | 176 // Stopping should both cancel the delegate and delete it. |
| 177 EXPECT_TRUE(OwnedDelegate::GetAndClearDeleted()); | 177 EXPECT_TRUE(OwnedDelegate::GetAndClearDeleted()); |
| 178 EXPECT_TRUE(OwnedDelegate::GetAndClearCanceled()); | 178 EXPECT_TRUE(OwnedDelegate::GetAndClearCanceled()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace views | 181 } // namespace views |
| OLD | NEW |