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

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

Issue 1587073011: Plumb NotifyAnimationAborted from the compositor to blink animation delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: initialize aborted_ in unittest Created 4 years, 11 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/time/time.h" 6 #include "base/time/time.h"
7 #include "cc/animation/animation_player.h" 7 #include "cc/animation/animation_player.h"
8 #include "cc/blink/web_compositor_animation_player_impl.h" 8 #include "cc/blink/web_compositor_animation_player_impl.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/WebKit/public/platform/WebCompositorAnimationDelegate.h" 11 #include "third_party/WebKit/public/platform/WebCompositorAnimationDelegate.h"
12 12
13 using base::TimeTicks; 13 using base::TimeTicks;
14 using blink::WebCompositorAnimationDelegate; 14 using blink::WebCompositorAnimationDelegate;
15 using cc::Animation; 15 using cc::Animation;
16 using testing::_; 16 using testing::_;
17 17
18 namespace cc_blink { 18 namespace cc_blink {
19 namespace { 19 namespace {
20 20
21 class MockWebCompositorAnimationDelegate 21 class MockWebCompositorAnimationDelegate
22 : public WebCompositorAnimationDelegate { 22 : public WebCompositorAnimationDelegate {
23 public: 23 public:
24 MockWebCompositorAnimationDelegate() {} 24 MockWebCompositorAnimationDelegate() {}
25 25
26 MOCK_METHOD2(notifyAnimationStarted, void(double, int)); 26 MOCK_METHOD2(notifyAnimationStarted, void(double, int));
27 MOCK_METHOD2(notifyAnimationFinished, void(double, int)); 27 MOCK_METHOD2(notifyAnimationFinished, void(double, int));
28 MOCK_METHOD2(notifyAnimationAborted, void(double, int));
28 }; 29 };
29 30
30 // Test that when the animation delegate is null, the animation player 31 // Test that when the animation delegate is null, the animation player
31 // doesn't forward the finish notification. 32 // doesn't forward the finish notification.
32 TEST(WebCompositorAnimationPlayerTest, NullDelegate) { 33 TEST(WebCompositorAnimationPlayerTest, NullDelegate) {
33 scoped_ptr<WebCompositorAnimationDelegate> delegate( 34 scoped_ptr<WebCompositorAnimationDelegate> delegate(
34 new MockWebCompositorAnimationDelegate); 35 new MockWebCompositorAnimationDelegate);
35 EXPECT_CALL(*static_cast<MockWebCompositorAnimationDelegate*>(delegate.get()), 36 EXPECT_CALL(*static_cast<MockWebCompositorAnimationDelegate*>(delegate.get()),
36 notifyAnimationFinished(_, _)) 37 notifyAnimationFinished(_, _))
37 .Times(1); 38 .Times(1);
38 39
39 scoped_ptr<WebCompositorAnimationPlayerImpl> web_player( 40 scoped_ptr<WebCompositorAnimationPlayerImpl> web_player(
40 new WebCompositorAnimationPlayerImpl); 41 new WebCompositorAnimationPlayerImpl);
41 cc::AnimationPlayer* player = web_player->animation_player(); 42 cc::AnimationPlayer* player = web_player->animation_player();
42 43
43 web_player->setAnimationDelegate(delegate.get()); 44 web_player->setAnimationDelegate(delegate.get());
44 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0); 45 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
45 46
46 web_player->setAnimationDelegate(nullptr); 47 web_player->setAnimationDelegate(nullptr);
47 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0); 48 player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
48 } 49 }
49 50
50 } // namespace 51 } // namespace
51 } // namespace cc_blink 52 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller_unittest.cc ('k') | cc/blink/web_to_cc_animation_delegate_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698