Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: views/animation/bounds_animator_unittest.cc

Issue 6250141: Sidebar mini tabs UI (views version).... Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/animation/bounds_animator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « views/animation/bounds_animator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698