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

Unified Diff: Source/core/animation/AnimationTest.cpp

Issue 466323002: IDL: Use Nullable for union type return value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/core/animation/AnimationNodeTiming.cpp ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationTest.cpp
diff --git a/Source/core/animation/AnimationTest.cpp b/Source/core/animation/AnimationTest.cpp
index f07bfdaacab8298941d8051feee71f71042f749e..e094c9d002367180a1ebdf4346211155a8ff411e 100644
--- a/Source/core/animation/AnimationTest.cpp
+++ b/Source/core/animation/AnimationTest.cpp
@@ -6,6 +6,7 @@
#include "core/animation/Animation.h"
#include "bindings/core/v8/Dictionary.h"
+#include "bindings/core/v8/Nullable.h"
#include "core/animation/AnimationClock.h"
#include "core/animation/AnimationHelpers.h"
#include "core/animation/AnimationNodeTiming.h"
@@ -250,15 +251,12 @@ TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter)
RefPtrWillBeRawPtr<Animation> animationWithDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryWithDuration, exceptionState);
RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedWithDuration = animationWithDuration->timing();
- bool isNumber = false;
- double numberDuration = std::numeric_limits<double>::quiet_NaN();
- bool isString = false;
- String stringDuration = "";
- specifiedWithDuration->getDuration("duration", isNumber, numberDuration, isString, stringDuration);
- EXPECT_TRUE(isNumber);
- EXPECT_EQ(2.5, numberDuration);
- EXPECT_FALSE(isString);
- EXPECT_EQ("", stringDuration);
+ Nullable<double> numberDuration;
+ String stringDuration;
+ specifiedWithDuration->getDuration("duration", numberDuration, stringDuration);
+ EXPECT_FALSE(numberDuration.isNull());
+ EXPECT_EQ(2.5, numberDuration.get());
+ EXPECT_TRUE(stringDuration.isNull());
v8::Handle<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate);
@@ -267,15 +265,12 @@ TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter)
RefPtrWillBeRawPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryNoDuration, exceptionState);
RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedNoDuration = animationNoDuration->timing();
- isNumber = false;
- numberDuration = std::numeric_limits<double>::quiet_NaN();
- isString = false;
- stringDuration = "";
- specifiedNoDuration->getDuration("duration", isNumber, numberDuration, isString, stringDuration);
- EXPECT_FALSE(isNumber);
- EXPECT_TRUE(std::isnan(numberDuration));
- EXPECT_TRUE(isString);
- EXPECT_EQ("auto", stringDuration);
+ Nullable<double> numberDuration2;
+ String stringDuration2;
+ specifiedNoDuration->getDuration("duration", numberDuration2, stringDuration2);
+ EXPECT_TRUE(numberDuration2.isNull());
+ EXPECT_FALSE(stringDuration2.isNull());
+ EXPECT_EQ("auto", stringDuration2);
}
TEST_F(AnimationAnimationV8Test, SpecifiedSetters)
@@ -329,26 +324,20 @@ TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration)
RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing();
- bool isNumber = false;
- double numberDuration = std::numeric_limits<double>::quiet_NaN();
- bool isString = false;
- String stringDuration = "";
- specified->getDuration("duration", isNumber, numberDuration, isString, stringDuration);
- EXPECT_FALSE(isNumber);
- EXPECT_TRUE(std::isnan(numberDuration));
- EXPECT_TRUE(isString);
+ Nullable<double> numberDuration;
+ String stringDuration;
+ specified->getDuration("duration", numberDuration, stringDuration);
+ EXPECT_TRUE(numberDuration.isNull());
+ EXPECT_FALSE(stringDuration.isNull());
EXPECT_EQ("auto", stringDuration);
specified->setDuration("duration", 2.5);
- isNumber = false;
- numberDuration = std::numeric_limits<double>::quiet_NaN();
- isString = false;
- stringDuration = "";
- specified->getDuration("duration", isNumber, numberDuration, isString, stringDuration);
- EXPECT_TRUE(isNumber);
- EXPECT_EQ(2.5, numberDuration);
- EXPECT_FALSE(isString);
- EXPECT_EQ("", stringDuration);
+ Nullable<double> numberDuration2;
+ String stringDuration2;
+ specified->getDuration("duration", numberDuration2, stringDuration2);
+ EXPECT_FALSE(numberDuration2.isNull());
+ EXPECT_EQ(2.5, numberDuration2.get());
+ EXPECT_TRUE(stringDuration2.isNull());
}
TEST_F(AnimationAnimationTest, TimeToEffectChange)
« no previous file with comments | « Source/core/animation/AnimationNodeTiming.cpp ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698