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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 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 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 "platform/animation/CompositorAnimationHost.h" 5 #include "platform/animation/CompositorAnimationHost.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "platform/animation/CompositorAnimationTimeline.h" 8 #include "platform/animation/CompositorAnimationTimeline.h"
9 #include "platform/testing/CompositorTest.h" 9 #include "platform/testing/CompositorTest.h"
10 #include "platform/testing/WebLayerTreeViewImplForTesting.h" 10 #include "platform/testing/WebLayerTreeViewImplForTesting.h"
11 #include "wtf/PtrUtil.h"
12 #include <memory>
13 11
14 namespace blink { 12 namespace blink {
15 13
16 class CompositorAnimationHostTest : public CompositorTest { 14 class CompositorAnimationHostTest : public CompositorTest {
17 }; 15 };
18 16
19 TEST_F(CompositorAnimationHostTest, AnimationHostNullWhenTimelineDetached) 17 TEST_F(CompositorAnimationHostTest, AnimationHostNullWhenTimelineDetached)
20 { 18 {
21 std::unique_ptr<CompositorAnimationTimeline> timeline = CompositorAnimationT imeline::create(); 19 OwnPtr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline:: create();
22 20
23 scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimelin e(); 21 scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimelin e();
24 EXPECT_FALSE(ccTimeline->animation_host()); 22 EXPECT_FALSE(ccTimeline->animation_host());
25 EXPECT_TRUE(timeline->compositorAnimationHost().isNull()); 23 EXPECT_TRUE(timeline->compositorAnimationHost().isNull());
26 24
27 std::unique_ptr<WebLayerTreeView> layerTreeHost = wrapUnique(new WebLayerTre eViewImplForTesting); 25 OwnPtr<WebLayerTreeView> layerTreeHost = adoptPtr(new WebLayerTreeViewImplFo rTesting);
28 DCHECK(layerTreeHost); 26 DCHECK(layerTreeHost);
29 27
30 layerTreeHost->attachCompositorAnimationTimeline(timeline->animationTimeline ()); 28 layerTreeHost->attachCompositorAnimationTimeline(timeline->animationTimeline ());
31 EXPECT_FALSE(timeline->compositorAnimationHost().isNull()); 29 EXPECT_FALSE(timeline->compositorAnimationHost().isNull());
32 30
33 layerTreeHost->detachCompositorAnimationTimeline(timeline->animationTimeline ()); 31 layerTreeHost->detachCompositorAnimationTimeline(timeline->animationTimeline ());
34 EXPECT_TRUE(timeline->compositorAnimationHost().isNull()); 32 EXPECT_TRUE(timeline->compositorAnimationHost().isNull());
35 } 33 }
36 34
37 } // namespace blink 35 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698