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

Unified Diff: ui/gfx/animation/animation_container_unittest.cc

Issue 56193006: ui/gfx: Remove gmock usage from animation_container_unittest.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/animation/animation_container_unittest.cc
diff --git a/ui/gfx/animation/animation_container_unittest.cc b/ui/gfx/animation/animation_container_unittest.cc
index 25977c26161b5d462185f320a1726d5a5505311e..70d3b0e10f8e0721db09fbfec65815689b7006fb 100644
--- a/ui/gfx/animation/animation_container_unittest.cc
+++ b/ui/gfx/animation/animation_container_unittest.cc
@@ -5,27 +5,40 @@
#include "ui/gfx/animation/animation_container.h"
#include "base/memory/scoped_ptr.h"
-#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/animation/animation_container_observer.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/animation/test_animation_delegate.h"
-using testing::AtLeast;
-
namespace gfx {
namespace {
-class MockObserver : public AnimationContainerObserver {
+class FakeAnimationContainerObserver : public AnimationContainerObserver {
public:
- MockObserver() {}
+ FakeAnimationContainerObserver()
+ : progressed_count_(0),
+ empty_(false) {
+ }
- MOCK_METHOD1(AnimationContainerProgressed, void(AnimationContainer*));
- MOCK_METHOD1(AnimationContainerEmpty, void(AnimationContainer*));
+ int progressed_count() const { return progressed_count_; }
+ bool empty() const { return empty_; }
private:
- DISALLOW_COPY_AND_ASSIGN(MockObserver);
+ virtual void AnimationContainerProgressed(
+ AnimationContainer* container) OVERRIDE {
+ progressed_count_++;
+ }
+
+ // Invoked when no more animations are being managed by this container.
+ virtual void AnimationContainerEmpty(AnimationContainer* container) OVERRIDE {
+ empty_ = true;
+ }
+
+ int progressed_count_;
+ bool empty_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeAnimationContainerObserver);
};
class TestAnimation : public LinearAnimation {
@@ -94,7 +107,7 @@ TEST_F(AnimationContainerTest, Multi) {
// Makes sure observer is notified appropriately.
TEST_F(AnimationContainerTest, Observer) {
- MockObserver observer;
+ FakeAnimationContainerObserver observer;
TestAnimationDelegate delegate1;
scoped_refptr<AnimationContainer> container(new AnimationContainer());
@@ -102,12 +115,6 @@ TEST_F(AnimationContainerTest, Observer) {
TestAnimation animation1(&delegate1);
animation1.SetContainer(container.get());
- // We expect to get these two calls: the animation progressed, and then when
- // the animation completed the container went empty.
- EXPECT_CALL(observer, AnimationContainerProgressed(container.get())).Times(
- AtLeast(1));
- EXPECT_CALL(observer, AnimationContainerEmpty(container.get())).Times(1);
-
// Start the animation.
animation1.Start();
EXPECT_TRUE(container->is_running());
@@ -115,9 +122,13 @@ TEST_F(AnimationContainerTest, Observer) {
// Run the message loop. The delegate quits the message loop when notified.
base::MessageLoop::current()->Run();
+ EXPECT_EQ(1, observer.progressed_count());
+
// The timer should have finished.
EXPECT_TRUE(delegate1.finished());
+ EXPECT_TRUE(observer.empty());
+
// And the container should no longer be running.
EXPECT_FALSE(container->is_running());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698