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

Side by Side Diff: third_party/WebKit/Source/core/animation/AnimationStackTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "core/animation/AnimationStack.h" 5 #include "core/animation/AnimationStack.h"
6 6
7 #include "core/animation/AnimationClock.h" 7 #include "core/animation/AnimationClock.h"
8 #include "core/animation/AnimationTimeline.h" 8 #include "core/animation/AnimationTimeline.h"
9 #include "core/animation/CompositorPendingAnimations.h" 9 #include "core/animation/CompositorPendingAnimations.h"
10 #include "core/animation/ElementAnimations.h" 10 #include "core/animation/ElementAnimations.h"
11 #include "core/animation/KeyframeEffectModel.h" 11 #include "core/animation/KeyframeEffectModel.h"
12 #include "core/animation/LegacyStyleInterpolation.h" 12 #include "core/animation/LegacyStyleInterpolation.h"
13 #include "core/animation/animatable/AnimatableDouble.h" 13 #include "core/animation/animatable/AnimatableDouble.h"
14 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include <memory>
16 17
17 namespace blink { 18 namespace blink {
18 19
19 class AnimationAnimationStackTest : public ::testing::Test { 20 class AnimationAnimationStackTest : public ::testing::Test {
20 protected: 21 protected:
21 virtual void SetUp() 22 virtual void SetUp()
22 { 23 {
23 pageHolder = DummyPageHolder::create(); 24 pageHolder = DummyPageHolder::create();
24 document = &pageHolder->document(); 25 document = &pageHolder->document();
25 document->animationClock().resetTimeForTesting(); 26 document->animationClock().resetTimeForTesting();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 timing.iterationDuration = duration; 73 timing.iterationDuration = duration;
73 return KeyframeEffect::create(element.get(), effect, timing); 74 return KeyframeEffect::create(element.get(), effect, timing);
74 } 75 }
75 76
76 AnimatableValue* interpolationValue(const ActiveInterpolationsMap& activeInt erpolations, CSSPropertyID id) 77 AnimatableValue* interpolationValue(const ActiveInterpolationsMap& activeInt erpolations, CSSPropertyID id)
77 { 78 {
78 Interpolation& interpolation = *activeInterpolations.get(PropertyHandle( id)).at(0); 79 Interpolation& interpolation = *activeInterpolations.get(PropertyHandle( id)).at(0);
79 return toLegacyStyleInterpolation(interpolation).currentValue().get(); 80 return toLegacyStyleInterpolation(interpolation).currentValue().get();
80 } 81 }
81 82
82 OwnPtr<DummyPageHolder> pageHolder; 83 std::unique_ptr<DummyPageHolder> pageHolder;
83 Persistent<Document> document; 84 Persistent<Document> document;
84 Persistent<AnimationTimeline> timeline; 85 Persistent<AnimationTimeline> timeline;
85 Persistent<Element> element; 86 Persistent<Element> element;
86 }; 87 };
87 88
88 TEST_F(AnimationAnimationStackTest, ElementAnimationsSorted) 89 TEST_F(AnimationAnimationStackTest, ElementAnimationsSorted)
89 { 90 {
90 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl e::create(1))), 10); 91 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl e::create(1))), 10);
91 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl e::create(2))), 15); 92 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl e::create(2))), 15);
92 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl e::create(3))), 5); 93 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl e::create(3))), 5);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 165
165 updateTimeline(17); 166 updateTimeline(17);
166 ThreadHeap::collectAllGarbage(); 167 ThreadHeap::collectAllGarbage();
167 interpolations = AnimationStack::activeInterpolations(&element->elementAnima tions()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority); 168 interpolations = AnimationStack::activeInterpolations(&element->elementAnima tions()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority);
168 EXPECT_EQ(1u, interpolations.size()); 169 EXPECT_EQ(1u, interpolations.size());
169 EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals( AnimatableDouble::create(3).get())); 170 EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals( AnimatableDouble::create(3).get()));
170 EXPECT_EQ(1u, sampledEffectCount()); 171 EXPECT_EQ(1u, sampledEffectCount());
171 } 172 }
172 173
173 } // namespace blink 174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698