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

Side by Side Diff: third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.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: Rebase. Fix copyrights and years. 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 2016 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/CompositorAnimationPlayer.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/time/time.h"
9 #include "public/platform/WebCompositorAnimationDelegate.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 using base::TimeTicks;
14 using blink::WebCompositorAnimationDelegate;
15 using cc::Animation;
16 using testing::_;
17
18 namespace blink {
19
20 class MockWebCompositorAnimationDelegate : public WebCompositorAnimationDelegate {
21 public:
22 MockWebCompositorAnimationDelegate() {}
23
24 MOCK_METHOD2(notifyAnimationStarted, void(double, int));
25 MOCK_METHOD2(notifyAnimationFinished, void(double, int));
26 MOCK_METHOD2(notifyAnimationAborted, void(double, int));
27 };
28
29 // Test that when the animation delegate is null, the animation player
30 // doesn't forward the finish notification.
31 TEST(WebCompositorAnimationPlayerTest, NullDelegate)
32 {
33 scoped_ptr<WebCompositorAnimationDelegate> delegate(
34 new MockWebCompositorAnimationDelegate);
35 EXPECT_CALL(*static_cast<MockWebCompositorAnimationDelegate*>(delegate.get() ),
36 notifyAnimationFinished(_, _))
37 .Times(1);
38
39 scoped_ptr<CompositorAnimationPlayer> webPlayer(new CompositorAnimationPlaye r);
40 cc::AnimationPlayer* player = webPlayer->animationPlayer();
41
42 webPlayer->setAnimationDelegate(delegate.get());
43 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
44
45 webPlayer->setAnimationDelegate(nullptr);
46 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
47 }
48
49 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698