diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 14:47:20 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 14:47:20 +0000 |
commit | 8d246c48c2127e02f1ab7e926a394f307a9fe896 (patch) | |
tree | 43ccb6b10d5736c8a5311f2b76dbef4520746d83 /ui/views/animation | |
parent | a878f5a08762475d18cfdb916043d1d0a357fc90 (diff) | |
download | chromium_src-8d246c48c2127e02f1ab7e926a394f307a9fe896.zip chromium_src-8d246c48c2127e02f1ab7e926a394f307a9fe896.tar.gz chromium_src-8d246c48c2127e02f1ab7e926a394f307a9fe896.tar.bz2 |
views: Put bounds_animation_unittest.cc into views namespace.
TEST=views_unittests
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10790115
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/animation')
-rw-r--r-- | ui/views/animation/bounds_animator_unittest.cc | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/ui/views/animation/bounds_animator_unittest.cc b/ui/views/animation/bounds_animator_unittest.cc index bf1f08c..93b13b5 100644 --- a/ui/views/animation/bounds_animator_unittest.cc +++ b/ui/views/animation/bounds_animator_unittest.cc @@ -1,23 +1,24 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "ui/views/animation/bounds_animator.h" + #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/animation/test_animation_delegate.h" -#include "ui/views/animation/bounds_animator.h" #include "ui/views/view.h" -using views::BoundsAnimator; using ui::Animation; using ui::SlideAnimation; using ui::TestAnimationDelegate; +namespace views { namespace { class TestBoundsAnimator : public BoundsAnimator { public: - explicit TestBoundsAnimator(views::View* view) : BoundsAnimator(view) { + explicit TestBoundsAnimator(View* view) : BoundsAnimator(view) { } protected: @@ -33,29 +34,26 @@ class TestBoundsAnimator : public BoundsAnimator { class OwnedDelegate : public BoundsAnimator::OwnedAnimationDelegate { public: - OwnedDelegate() { - deleted_ = false; - canceled_ = false; - } + OwnedDelegate() {} - ~OwnedDelegate() { + virtual ~OwnedDelegate() { deleted_ = true; } - static bool get_and_clear_deleted() { + static bool GetAndClearDeleted() { bool value = deleted_; deleted_ = false; return value; } - static bool get_and_clear_canceled() { + static bool GetAndClearCanceled() { bool value = canceled_; canceled_ = false; return value; } - // AnimationDelegate: - virtual void AnimationCanceled(const Animation* animation) { + // Overridden from ui::AnimationDelegate: + virtual void AnimationCanceled(const Animation* animation) OVERRIDE { canceled_ = true; } @@ -68,14 +66,13 @@ class OwnedDelegate : public BoundsAnimator::OwnedAnimationDelegate { // static bool OwnedDelegate::deleted_ = false; - -// static bool OwnedDelegate::canceled_ = false; -class TestView : public views::View { +class TestView : public View { public: TestView() {} - virtual void SchedulePaintInRect(const gfx::Rect& r) { + + virtual void SchedulePaintInRect(const gfx::Rect& r) OVERRIDE { if (dirty_rect_.IsEmpty()) dirty_rect_ = r; else @@ -146,8 +143,8 @@ TEST_F(BoundsAnimatorTest, DeleteDelegateOnCancel) { EXPECT_FALSE(animator()->IsAnimating()); // The cancel should both cancel the delegate and delete it. - EXPECT_TRUE(OwnedDelegate::get_and_clear_canceled()); - EXPECT_TRUE(OwnedDelegate::get_and_clear_deleted()); + EXPECT_TRUE(OwnedDelegate::GetAndClearCanceled()); + EXPECT_TRUE(OwnedDelegate::GetAndClearDeleted()); } // Make sure an AnimationDelegate is deleted when another animation is @@ -159,8 +156,8 @@ TEST_F(BoundsAnimatorTest, DeleteDelegateOnNewAnimate) { animator()->AnimateViewTo(child(), gfx::Rect(0, 0, 10, 10)); // Starting a new animation should both cancel the delegate and delete it. - EXPECT_TRUE(OwnedDelegate::get_and_clear_deleted()); - EXPECT_TRUE(OwnedDelegate::get_and_clear_canceled()); + EXPECT_TRUE(OwnedDelegate::GetAndClearDeleted()); + EXPECT_TRUE(OwnedDelegate::GetAndClearCanceled()); } // Makes sure StopAnimating works. @@ -176,6 +173,8 @@ TEST_F(BoundsAnimatorTest, StopAnimating) { EXPECT_FALSE(animator()->IsAnimating()); // Stopping should both cancel the delegate and delete it. - EXPECT_TRUE(OwnedDelegate::get_and_clear_deleted()); - EXPECT_TRUE(OwnedDelegate::get_and_clear_canceled()); + EXPECT_TRUE(OwnedDelegate::GetAndClearDeleted()); + EXPECT_TRUE(OwnedDelegate::GetAndClearCanceled()); } + +} // namespace views |