Commit fa911afe authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Move animation_test_helper.h/cc to animation_test_helpers.h/cc

The basename suffix '_test_helpers' (with an 's' at the end) gets
special treatment by audit_non_blink_usage.py: like other test code,
it's exempt from the audit. This came up when trying to use
the css_test_helpers namespace in a new animation_test_helper.h/cc
util, which was frowned upon by audit_non_blink_usage.py.

This CL also wraps the functions in a animation_test_helpers namespace.
This is just something I recommend, and not strictly required. (It
makes it less risky and more acceptable to add new helpers with
"common" names, like CreateAnimation).

Change-Id: I627fa6987c5dfad9b7c1d1452de10b07ee9b8ac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391221Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804336}
parent a9cd5419
...@@ -285,8 +285,8 @@ blink_core_tests("unit_tests") { ...@@ -285,8 +285,8 @@ blink_core_tests("unit_tests") {
"animation_input_helpers_test.cc", "animation_input_helpers_test.cc",
"animation_sim_test.cc", "animation_sim_test.cc",
"animation_test.cc", "animation_test.cc",
"animation_test_helper.cc", "animation_test_helpers.cc",
"animation_test_helper.h", "animation_test_helpers.h",
"animation_time_delta_test.cc", "animation_time_delta_test.cc",
"animation_utils_test.cc", "animation_utils_test.cc",
"compositor_animations_test.cc", "compositor_animations_test.cc",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/animation/css_interpolation_environment.h" #include "third_party/blink/renderer/core/animation/css_interpolation_environment.h"
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/computed_style.h"
namespace blink { namespace blink {
namespace animation_test_helpers {
void SetV8ObjectPropertyAsString(v8::Isolate* isolate, void SetV8ObjectPropertyAsString(v8::Isolate* isolate,
v8::Local<v8::Object> object, v8::Local<v8::Object> object,
...@@ -80,4 +81,5 @@ void EnsureInterpolatedValueCached(ActiveInterpolations* interpolations, ...@@ -80,4 +81,5 @@ void EnsureInterpolatedValueCached(ActiveInterpolations* interpolations,
cascade.Apply(); cascade.Apply();
} }
} // namespace animation_test_helpers
} // namespace blink } // namespace blink
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_ANIMATION_TEST_HELPER_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_ANIMATION_TEST_HELPERS_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_ANIMATION_TEST_HELPER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_ANIMATION_TEST_HELPERS_H_
#include "third_party/blink/renderer/core/animation/interpolation.h" #include "third_party/blink/renderer/core/animation/interpolation.h"
#include "third_party/blink/renderer/platform/wtf/text/string_view.h" #include "third_party/blink/renderer/platform/wtf/text/string_view.h"
...@@ -16,6 +16,8 @@ class Document; ...@@ -16,6 +16,8 @@ class Document;
class Element; class Element;
class KeyframeEffect; class KeyframeEffect;
namespace animation_test_helpers {
void SetV8ObjectPropertyAsString(v8::Isolate*, void SetV8ObjectPropertyAsString(v8::Isolate*,
v8::Local<v8::Object>, v8::Local<v8::Object>,
const StringView& name, const StringView& name,
...@@ -39,6 +41,8 @@ KeyframeEffect* CreateSimpleKeyframeEffectForTest(Element*, ...@@ -39,6 +41,8 @@ KeyframeEffect* CreateSimpleKeyframeEffectForTest(Element*,
// All members of the ActiveInterpolations must be instances of // All members of the ActiveInterpolations must be instances of
// InvalidatableInterpolation. // InvalidatableInterpolation.
void EnsureInterpolatedValueCached(ActiveInterpolations*, Document&, Element*); void EnsureInterpolatedValueCached(ActiveInterpolations*, Document&, Element*);
} // namespace animation_test_helpers
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_ANIMATION_TEST_HELPER_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_ANIMATION_TEST_HELPERS_H_
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h" #include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h" #include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/element.h"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <memory> #include <memory>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/animation/animation_clock.h" #include "third_party/blink/renderer/core/animation/animation_clock.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h" #include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/element_animations.h" #include "third_party/blink/renderer/core/animation/element_animations.h"
#include "third_party/blink/renderer/core/animation/interpolable_length.h" #include "third_party/blink/renderer/core/animation/interpolable_length.h"
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
namespace blink { namespace blink {
using animation_test_helpers::EnsureInterpolatedValueCached;
class AnimationEffectStackTest : public PageTestBase { class AnimationEffectStackTest : public PageTestBase {
protected: protected:
void SetUp() override { void SetUp() override {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <memory> #include <memory>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/animation/css_length_interpolation_type.h" #include "third_party/blink/renderer/core/animation/css_length_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/css_number_interpolation_type.h" #include "third_party/blink/renderer/core/animation/css_number_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/interpolable_value.h" #include "third_party/blink/renderer/core/animation/interpolable_value.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <memory> #include <memory>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/animation/css_number_interpolation_type.h" #include "third_party/blink/renderer/core/animation/css_number_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/interpolation_effect.h" #include "third_party/blink/renderer/core/animation/interpolation_effect.h"
#include "third_party/blink/renderer/core/animation/transition_interpolation.h" #include "third_party/blink/renderer/core/animation/transition_interpolation.h"
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h" #include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/animation/css/compositor_keyframe_color.h" #include "third_party/blink/renderer/core/animation/css/compositor_keyframe_color.h"
#include "third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h" #include "third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h"
#include "third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.h" #include "third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.h"
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
namespace blink { namespace blink {
using animation_test_helpers::EnsureInterpolatedValueCached;
class AnimationKeyframeEffectModel : public PageTestBase { class AnimationKeyframeEffectModel : public PageTestBase {
protected: protected:
void SetUp() override { void SetUp() override {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_optional_effect_timing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_optional_effect_timing.h"
#include "third_party/blink/renderer/core/animation/animation.h" #include "third_party/blink/renderer/core/animation/animation.h"
#include "third_party/blink/renderer/core/animation/animation_clock.h" #include "third_party/blink/renderer/core/animation/animation_clock.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h" #include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h" #include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "third_party/blink/renderer/core/animation/timing.h" #include "third_party/blink/renderer/core/animation/timing.h"
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
namespace blink { namespace blink {
using animation_test_helpers::SetV8ObjectPropertyAsNumber;
using animation_test_helpers::SetV8ObjectPropertyAsString;
class KeyframeEffectTest : public PageTestBase { class KeyframeEffectTest : public PageTestBase {
protected: protected:
void SetUp() override { void SetUp() override {
......
...@@ -10,12 +10,15 @@ ...@@ -10,12 +10,15 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_keyframe_animation_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_keyframe_animation_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_keyframe_effect_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_keyframe_effect_options.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h" #include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
namespace blink { namespace blink {
using animation_test_helpers::SetV8ObjectPropertyAsNumber;
using animation_test_helpers::SetV8ObjectPropertyAsString;
class AnimationTimingInputTest : public testing::Test { class AnimationTimingInputTest : public testing::Test {
public: public:
Timing ApplyTimingInputNumber(v8::Isolate*, Timing ApplyTimingInputNumber(v8::Isolate*,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/animation/animation_test_helper.h" #include "third_party/blink/renderer/core/animation/animation_test_helpers.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h" #include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/element_animations.h" #include "third_party/blink/renderer/core/animation/element_animations.h"
#include "third_party/blink/renderer/core/css/css_image_value.h" #include "third_party/blink/renderer/core/css/css_image_value.h"
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
namespace blink { namespace blink {
using animation_test_helpers::CreateSimpleKeyframeEffectForTest;
class StyleResolverTest : public PageTestBase { class StyleResolverTest : public PageTestBase {
public: public:
scoped_refptr<ComputedStyle> StyleForId(AtomicString id) { scoped_refptr<ComputedStyle> StyleForId(AtomicString id) {
......
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