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

Unified Diff: third_party/WebKit/Source/core/animation/EffectInputTest.cpp

Issue 2047293002: Code cleanup: Replace Element with Document in element.animate() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_killForceConversionsToAnimatableValues
Patch Set: Fix unit test crash. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/EffectInputTest.cpp
diff --git a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
index 32cf30f7d9349743cd4aa48b2196d1b04f9f3528..115ba9f5dd6040d25e5614409c92798d6a77251f 100644
--- a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
+++ b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
@@ -19,13 +19,6 @@
namespace blink {
-Element* appendElement(Document& document)
-{
- Element* element = document.createElement("foo", ASSERT_NO_EXCEPTION);
- document.documentElement()->appendChild(element);
- return element;
-}
-
TEST(AnimationEffectInputTest, SortedOffsets)
{
V8TestingScope scope;
@@ -41,8 +34,7 @@ TEST(AnimationEffectInputTest, SortedOffsets)
jsKeyframes.append(Dictionary(keyframe1, scope.isolate(), scope.getExceptionState()));
jsKeyframes.append(Dictionary(keyframe2, scope.isolate(), scope.getExceptionState()));
- Element* element = appendElement(scope.document());
- EffectModel* animationEffect = EffectInput::convert(element, EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
+ EffectModel* animationEffect = EffectInput::convert(scope.document(), EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
EXPECT_FALSE(scope.getExceptionState().hadException());
const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(animationEffect);
EXPECT_EQ(1.0, keyframeEffect.getFrames()[1]->offset());
@@ -63,8 +55,7 @@ TEST(AnimationEffectInputTest, UnsortedOffsets)
jsKeyframes.append(Dictionary(keyframe1, scope.isolate(), scope.getExceptionState()));
jsKeyframes.append(Dictionary(keyframe2, scope.isolate(), scope.getExceptionState()));
- Element* element = appendElement(scope.document());
- EffectInput::convert(element, EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
+ EffectInput::convert(scope.document(), EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
EXPECT_TRUE(scope.getExceptionState().hadException());
EXPECT_EQ(V8TypeError, scope.getExceptionState().code());
}
@@ -87,8 +78,7 @@ TEST(AnimationEffectInputTest, LooslySorted)
jsKeyframes.append(Dictionary(keyframe2, scope.isolate(), scope.getExceptionState()));
jsKeyframes.append(Dictionary(keyframe3, scope.isolate(), scope.getExceptionState()));
- Element* element = appendElement(scope.document());
- EffectModel* animationEffect = EffectInput::convert(element, EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
+ EffectModel* animationEffect = EffectInput::convert(scope.document(), EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
EXPECT_FALSE(scope.getExceptionState().hadException());
const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(animationEffect);
EXPECT_EQ(1, keyframeEffect.getFrames()[2]->offset());
@@ -116,8 +106,7 @@ TEST(AnimationEffectInputTest, OutOfOrderWithNullOffsets)
jsKeyframes.append(Dictionary(keyframe3, scope.isolate(), scope.getExceptionState()));
jsKeyframes.append(Dictionary(keyframe4, scope.isolate(), scope.getExceptionState()));
- Element* element = appendElement(scope.document());
- EffectInput::convert(element, EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
+ EffectInput::convert(scope.document(), EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
EXPECT_TRUE(scope.getExceptionState().hadException());
}
@@ -140,8 +129,7 @@ TEST(AnimationEffectInputTest, Invalid)
jsKeyframes.append(Dictionary(keyframe2, scope.isolate(), scope.getExceptionState()));
jsKeyframes.append(Dictionary(keyframe3, scope.isolate(), scope.getExceptionState()));
- Element* element = appendElement(scope.document());
- EffectInput::convert(element, EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
+ EffectInput::convert(scope.document(), EffectModelOrDictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes), nullptr, scope.getExceptionState());
EXPECT_TRUE(scope.getExceptionState().hadException());
EXPECT_EQ(V8TypeError, scope.getExceptionState().code());
}
« no previous file with comments | « third_party/WebKit/Source/core/animation/EffectInput.cpp ('k') | third_party/WebKit/Source/core/animation/ElementAnimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698