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

Side by Side Diff: third_party/WebKit/Source/platform/animation/WebCompositorAnimationPlayerTest.cpp

Issue 1616653002: CC Animation: Move files from cc_blink to Source/platform/animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ScrollAnimatorCompositorCoordinator for MSVC. Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/animation/WebCompositorAnimationPlayer.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/time/time.h"
9 #include "cc/animation/animation_player.h"
10 #include "public/platform/WebCompositorAnimationDelegate.h"
11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 using base::TimeTicks;
15 using blink::WebCompositorAnimationDelegate;
16 using cc::Animation;
17 using testing::_;
18
19 namespace blink {
20
21 class MockWebCompositorAnimationDelegate : public WebCompositorAnimationDelegate {
22 public:
23 MockWebCompositorAnimationDelegate() {}
24
25 MOCK_METHOD2(notifyAnimationStarted, void(double, int));
26 MOCK_METHOD2(notifyAnimationFinished, void(double, int));
27 MOCK_METHOD2(notifyAnimationAborted, void(double, int));
28 };
29
30 // Test that when the animation delegate is null, the animation player
31 // doesn't forward the finish notification.
32 TEST(WebCompositorAnimationPlayerTest, NullDelegate)
33 {
34 scoped_ptr<WebCompositorAnimationDelegate> delegate(
35 new MockWebCompositorAnimationDelegate);
36 EXPECT_CALL(*static_cast<MockWebCompositorAnimationDelegate*>(delegate.get() ),
37 notifyAnimationFinished(_, _))
38 .Times(1);
39
40 scoped_ptr<WebCompositorAnimationPlayer> webPlayer(new WebCompositorAnimatio nPlayer);
41 cc::AnimationPlayer* player = webPlayer->animationPlayer();
42
43 webPlayer->setAnimationDelegate(delegate.get());
44 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
45
46 webPlayer->setAnimationDelegate(nullptr);
47 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
48 }
49
50 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698