| Index: views/animation/bounds_animator_unittest.cc
|
| ===================================================================
|
| --- views/animation/bounds_animator_unittest.cc (revision 74134)
|
| +++ views/animation/bounds_animator_unittest.cc (working copy)
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/base/animation/slide_animation.h"
|
| #include "ui/base/animation/test_animation_delegate.h"
|
| @@ -15,6 +16,12 @@
|
|
|
| namespace {
|
|
|
| +class MockBoundsAnimatorObserver : public views::BoundsAnimatorObserver {
|
| + public:
|
| + MOCK_METHOD1(OnBoundsAnimatorProgressed, void(BoundsAnimator* animator));
|
| + MOCK_METHOD1(OnBoundsAnimatorDone, void(BoundsAnimator* animator));
|
| +};
|
| +
|
| class TestBoundsAnimator : public BoundsAnimator {
|
| public:
|
| explicit TestBoundsAnimator(views::View* view) : BoundsAnimator(view) {
|
| @@ -101,12 +108,14 @@
|
| TestView* parent() { return &parent_; }
|
| TestView* child() { return child_; }
|
| TestBoundsAnimator* animator() { return &animator_; }
|
| + MockBoundsAnimatorObserver* observer() { return &observer_; }
|
|
|
| private:
|
| MessageLoopForUI message_loop_;
|
| TestView parent_;
|
| TestView* child_; // Owned by |parent_|.
|
| TestBoundsAnimator animator_;
|
| + testing::StrictMock<MockBoundsAnimatorObserver> observer_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(BoundsAnimatorTest);
|
| };
|
| @@ -119,7 +128,13 @@
|
| gfx::Rect target_bounds(10, 10, 20, 20);
|
| animator()->AnimateViewTo(child(), target_bounds);
|
| animator()->SetAnimationDelegate(child(), &delegate, false);
|
| + animator()->set_observer(observer());
|
|
|
| + EXPECT_CALL(*observer(), OnBoundsAnimatorProgressed(animator()))
|
| + .Times(testing::AnyNumber());
|
| + EXPECT_CALL(*observer(), OnBoundsAnimatorDone(animator()))
|
| + .Times(1);
|
| +
|
| // The animator should be animating now.
|
| EXPECT_TRUE(animator()->IsAnimating());
|
|
|
|
|