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

Side by Side Diff: cc/blink/web_compositor_animation_player_unittest.cc

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 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 "base/memory/scoped_ptr.h"
6 #include "base/time/time.h"
7 #include "cc/animation/animation_player.h"
8 #include "cc/blink/web_compositor_animation_player_impl.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/WebKit/public/platform/WebCompositorAnimationDelegate.h"
12
13 using base::TimeTicks;
14 using blink::WebCompositorAnimationDelegate;
15 using cc::Animation;
16 using testing::_;
17
18 namespace cc_blink {
19 namespace {
20
21 class MockWebCompositorAnimationDelegate
22 : public WebCompositorAnimationDelegate {
23 public:
24 MockWebCompositorAnimationDelegate() {}
25
26 MOCK_METHOD2(notifyAnimationStarted, void(double, int));
27 MOCK_METHOD2(notifyAnimationFinished, void(double, int));
28 MOCK_METHOD2(notifyAnimationAborted, void(double, int));
29 };
30
31 // Test that when the animation delegate is null, the animation player
32 // doesn't forward the finish notification.
33 TEST(WebCompositorAnimationPlayerTest, NullDelegate) {
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<WebCompositorAnimationPlayerImpl> web_player(
41 new WebCompositorAnimationPlayerImpl);
42 cc::AnimationPlayer* player = web_player->animation_player();
43
44 web_player->setAnimationDelegate(delegate.get());
45 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
46
47 web_player->setAnimationDelegate(nullptr);
48 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
49 }
50
51 } // namespace
52 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_compositor_animation_player_impl.cc ('k') | cc/blink/web_compositor_animation_timeline_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698