Commit 58048fe5 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Use css_test_helpers to register properties in unit tests

Change-Id: I7e4b2b61214ccb74a14a7bffb4a4b64eb9d80f9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724525
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683497}
parent 7239338f
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
#include "third_party/blink/public/web/web_script_source.h" #include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/renderer/core/animation/animatable.h" #include "third_party/blink/renderer/core/animation/animatable.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/css/css_style_sheet.h" #include "third_party/blink/renderer/core/css/css_style_sheet.h"
#include "third_party/blink/renderer/core/css/property_definition.h" #include "third_party/blink/renderer/core/css/css_test_helpers.h"
#include "third_party/blink/renderer/core/css/property_registration.h" #include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/testing/sim/sim_compositor.h" #include "third_party/blink/renderer/core/testing/sim/sim_compositor.h"
...@@ -48,16 +50,10 @@ TEST_F(AnimationSimTest, CustomPropertyBaseComputedStyle) { ...@@ -48,16 +50,10 @@ TEST_F(AnimationSimTest, CustomPropertyBaseComputedStyle) {
// initialValue: '0%', // initialValue: '0%',
// inherits: false // inherits: false
// }) // })
DummyExceptionStateForTesting exception_state; css_test_helpers::RegisterProperty(GetDocument(), "--x", "<percentage>", "0%",
PropertyDefinition* property_definition = PropertyDefinition::Create(); false);
property_definition->setName("--x");
property_definition->setSyntax("<percentage>");
property_definition->setInitialValue("0%");
property_definition->setInherits(false);
PropertyRegistration::registerProperty(&GetDocument(), property_definition,
exception_state);
EXPECT_FALSE(exception_state.HadException());
DummyExceptionStateForTesting exception_state;
// target.style.setProperty('--x', '100%'); // target.style.setProperty('--x', '100%');
target->style()->setProperty(&GetDocument(), "--x", "100%", g_empty_string, target->style()->setProperty(&GetDocument(), "--x", "100%", g_empty_string,
exception_state); exception_state);
......
...@@ -39,8 +39,7 @@ ...@@ -39,8 +39,7 @@
#include "third_party/blink/renderer/core/animation/invalidatable_interpolation.h" #include "third_party/blink/renderer/core/animation/invalidatable_interpolation.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h" #include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h"
#include "third_party/blink/renderer/core/css/property_definition.h" #include "third_party/blink/renderer/core/css/css_test_helpers.h"
#include "third_party/blink/renderer/core/css/property_registration.h"
#include "third_party/blink/renderer/core/css/property_registry.h" #include "third_party/blink/renderer/core/css/property_registry.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/element.h"
...@@ -140,13 +139,8 @@ const PropertySpecificKeyframeVector& ConstructEffectAndGetKeyframes( ...@@ -140,13 +139,8 @@ const PropertySpecificKeyframeVector& ConstructEffectAndGetKeyframes(
const String& zero_value, const String& zero_value,
const String& one_value, const String& one_value,
ExceptionState& exception_state) { ExceptionState& exception_state) {
PropertyDefinition* property_definition = PropertyDefinition::Create(); css_test_helpers::RegisterProperty(*document, property_name, type, zero_value,
property_definition->setName(property_name); false);
property_definition->setSyntax(type);
property_definition->setInitialValue(zero_value);
property_definition->setInherits(false);
PropertyRegistration::registerProperty(document, property_definition,
exception_state);
StringKeyframeVector keyframes = StringKeyframeVector keyframes =
KeyframesAtZeroAndOne(property_name, zero_value, one_value); KeyframesAtZeroAndOne(property_name, zero_value, one_value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment