| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/compositorworker/WorkletAnimation.h" |
| 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "bindings/core/v8/V8BindingForTesting.h" |
| 10 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 11 #include "bindings/core/v8/serialization/SerializedScriptValue.h" |
| 12 #include "core/animation/KeyframeEffectReadOnly.h" |
| 13 #include "core/frame/Settings.h" |
| 14 #include "core/testing/DummyPageHolder.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 |
| 17 namespace blink { |
| 18 |
| 19 TEST(WorkletAnimationTest, CreateWorkletAnimation) { |
| 20 V8TestingScope scope; |
| 21 DummyExceptionStateForTesting exception_state; |
| 22 |
| 23 const HeapVector<Member<KeyframeEffectReadOnly>> effects; |
| 24 HeapVector<DocumentTimelineOrScrollTimeline> timelines; |
| 25 |
| 26 V8ObjectBuilder builder(scope.GetScriptState()); |
| 27 builder.AddString("my_prop", "value"); |
| 28 v8::Local<v8::Object> worklet_options = builder.V8Value(); |
| 29 |
| 30 SerializedScriptValue::SerializeOptions serialize_options; |
| 31 RefPtr<SerializedScriptValue> serialized_worklet_options = |
| 32 SerializedScriptValue::Serialize(scope.GetIsolate(), worklet_options, |
| 33 serialize_options, exception_state); |
| 34 ASSERT_FALSE(exception_state.HadException()); |
| 35 |
| 36 WorkletAnimation* animation = WorkletAnimation::Create( |
| 37 "Test", effects, timelines, std::move(serialized_worklet_options), |
| 38 exception_state); |
| 39 ASSERT_TRUE(animation); |
| 40 } |
| 41 |
| 42 } // namespace blink |
| OLD | NEW |