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

Side by Side Diff: Source/core/animation/KeyframeEffectModelTest.cpp

Issue 204743002: Oilpan: Move AnimatableValue's hierarchy to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 #include "core/animation/AnimatableUnknown.h" 35 #include "core/animation/AnimatableUnknown.h"
36 #include "core/css/CSSPrimitiveValue.h" 36 #include "core/css/CSSPrimitiveValue.h"
37 #include "core/css/parser/BisonCSSParser.h" 37 #include "core/css/parser/BisonCSSParser.h"
38 #include "core/css/resolver/CSSToStyleMap.h" 38 #include "core/css/resolver/CSSToStyleMap.h"
39 #include <gtest/gtest.h> 39 #include <gtest/gtest.h>
40 40
41 using namespace WebCore; 41 using namespace WebCore;
42 42
43 namespace { 43 namespace {
44 44
45 PassRefPtr<AnimatableValue> unknownAnimatableValue(double n) 45 PassRefPtrWillBeRawPtr<AnimatableValue> unknownAnimatableValue(double n)
46 { 46 {
47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa lue::CSS_UNKNOWN).get()); 47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa lue::CSS_UNKNOWN).get());
48 } 48 }
49 49
50 PassRefPtr<AnimatableValue> pixelAnimatableValue(double n) 50 PassRefPtrWillBeRawPtr<AnimatableValue> pixelAnimatableValue(double n)
51 { 51 {
52 return AnimatableLength::create(CSSPrimitiveValue::create(n, CSSPrimitiveVal ue::CSS_PX).get()); 52 return AnimatableLength::create(CSSPrimitiveValue::create(n, CSSPrimitiveVal ue::CSS_PX).get());
53 } 53 }
54 54
55 KeyframeEffectModel::KeyframeVector keyframesAtZeroAndOne(PassRefPtr<AnimatableV alue> zeroValue, PassRefPtr<AnimatableValue> oneValue) 55 KeyframeEffectModel::KeyframeVector keyframesAtZeroAndOne(PassRefPtrWillBeRawPtr <AnimatableValue> zeroValue, PassRefPtrWillBeRawPtr<AnimatableValue> oneValue)
56 { 56 {
57 KeyframeEffectModel::KeyframeVector keyframes(2); 57 KeyframeEffectModel::KeyframeVector keyframes(2);
58 keyframes[0] = Keyframe::create(); 58 keyframes[0] = Keyframe::create();
59 keyframes[0]->setOffset(0.0); 59 keyframes[0]->setOffset(0.0);
60 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue.get()); 60 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue.get());
61 keyframes[1] = Keyframe::create(); 61 keyframes[1] = Keyframe::create();
62 keyframes[1]->setOffset(1.0); 62 keyframes[1]->setOffset(1.0);
63 keyframes[1]->setPropertyValue(CSSPropertyLeft, oneValue.get()); 63 keyframes[1]->setPropertyValue(CSSPropertyLeft, oneValue.get());
64 return keyframes; 64 return keyframes;
65 } 65 }
66 66
67 void expectProperty(CSSPropertyID property, PassRefPtr<Interpolation> interpolat ionValue) 67 void expectProperty(CSSPropertyID property, PassRefPtr<Interpolation> interpolat ionValue)
68 { 68 {
69 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); 69 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get());
70 ASSERT_EQ(property, interpolation->id()); 70 ASSERT_EQ(property, interpolation->id());
71 } 71 }
72 72
73 void expectDoubleValue(double expectedValue, PassRefPtr<Interpolation> interpola tionValue) 73 void expectDoubleValue(double expectedValue, PassRefPtr<Interpolation> interpola tionValue)
74 { 74 {
75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); 75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get());
76 RefPtr<AnimatableValue> value = interpolation->currentValue(); 76 RefPtrWillBeRawPtr<AnimatableValue> value = interpolation->currentValue();
77 77
78 ASSERT_TRUE(value->isLength() || value->isUnknown()); 78 ASSERT_TRUE(value->isLength() || value->isUnknown());
79 79
80 double actualValue; 80 double actualValue;
81 if (value->isLength()) 81 if (value->isLength())
82 actualValue = toCSSPrimitiveValue(toAnimatableLength(value.get())->toCSS Value().get())->getDoubleValue(); 82 actualValue = toCSSPrimitiveValue(toAnimatableLength(value.get())->toCSS Value().get())->getDoubleValue();
83 else 83 else
84 actualValue = toCSSPrimitiveValue(toAnimatableUnknown(value.get())->toCS SValue().get())->getDoubleValue(); 84 actualValue = toCSSPrimitiveValue(toAnimatableUnknown(value.get())->toCS SValue().get())->getDoubleValue();
85 85
86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue); 86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue);
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); 552 EXPECT_DOUBLE_EQ(0.6, result[5]->offset());
553 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); 553 EXPECT_DOUBLE_EQ(0.7, result[6]->offset());
554 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); 554 EXPECT_DOUBLE_EQ(0.8, result[7]->offset());
555 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); 555 EXPECT_DOUBLE_EQ(0.85, result[8]->offset());
556 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); 556 EXPECT_DOUBLE_EQ(0.9, result[9]->offset());
557 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); 557 EXPECT_DOUBLE_EQ(0.95, result[10]->offset());
558 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); 558 EXPECT_DOUBLE_EQ(1.0, result[11]->offset());
559 } 559 }
560 560
561 } // namespace WebCore 561 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/animation/KeyframeEffectModel.cpp ('k') | Source/core/animation/css/CSSAnimatableValueFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698