summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc b/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc
index 9982f48ab31..1e2f5ab8eb8 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc
@@ -6,6 +6,7 @@
#include "cc/animation/animation.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/renderer/bindings/core/v8/v8_union_cssnumericvalue_double.h"
#include "third_party/blink/renderer/core/animation/animation.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/element_animations.h"
@@ -349,21 +350,37 @@ TEST_F(CSSAnimationsCompositorSyncTest, SetStartTime) {
Animation* animation = GetAnimation();
int compositor_group = animation->CompositorGroup();
+#if defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
+ V8CSSNumberish* start_time = animation->startTime();
+ V8CSSNumberish* current_time = animation->currentTime();
+#else // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
CSSNumberish start_time, current_time;
animation->startTime(start_time);
animation->currentTime(current_time);
+#endif // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
// Partially rewind the animation via setStartTime.
+#if defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
+ V8CSSNumberish* new_start_time = MakeGarbageCollected<V8CSSNumberish>(
+ start_time->GetAsDouble() + (current_time->GetAsDouble() / 2));
+#else // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
CSSNumberish new_start_time = CSSNumberish::FromDouble(
start_time.GetAsDouble() + (current_time.GetAsDouble() / 2));
+#endif // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
animation->setStartTime(new_start_time, ASSERT_NO_EXCEPTION);
UpdateAllLifecyclePhasesForTest();
// Verify blink updates.
+#if defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
+ current_time = animation->currentTime();
+ EXPECT_TRUE(current_time->IsDouble());
+ EXPECT_NEAR(250, current_time->GetAsDouble(), kTimeToleranceMilliseconds);
+#else // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
animation->currentTime(current_time);
EXPECT_TRUE(current_time.IsDouble());
EXPECT_NEAR(250, current_time.GetAsDouble(), kTimeToleranceMilliseconds);
+#endif // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
EXPECT_NEAR(0.75, element_->GetComputedStyle()->Opacity(), kTolerance);
// Compositor animation needs to restart and will have a new compositor group.
@@ -394,14 +411,25 @@ TEST_F(CSSAnimationsCompositorSyncTest, SetCurrentTime) {
int compositor_group = animation->CompositorGroup();
// Advance current time.
+#if defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
+ animation->setCurrentTime(MakeGarbageCollected<V8CSSNumberish>(750),
+ ASSERT_NO_EXCEPTION);
+#else // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
animation->setCurrentTime(CSSNumberish::FromDouble(750), ASSERT_NO_EXCEPTION);
+#endif // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
UpdateAllLifecyclePhasesForTest();
// Verify blink updates.
+#if defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
+ V8CSSNumberish* current_time = animation->currentTime();
+ EXPECT_TRUE(current_time->IsDouble());
+ EXPECT_NEAR(750, current_time->GetAsDouble(), kTimeToleranceMilliseconds);
+#else // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
CSSNumberish current_time;
animation->currentTime(current_time);
EXPECT_TRUE(current_time.IsDouble());
EXPECT_NEAR(750, current_time.GetAsDouble(), kTimeToleranceMilliseconds);
+#endif // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
EXPECT_NEAR(0.25, element_->GetComputedStyle()->Opacity(), kTolerance);
// Compositor animation needs to restart and will have a new compositor group.