Commit 6f7091f6 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Use scoped runtime features in tests.

Make sure RuntimeEnabledFeatures are reset properly in tests.

Change-Id: I13541aac18b6c5aa68753fdca560c8d8da0703a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1771968Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690896}
parent ad3701d4
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h" #include "third_party/blink/renderer/core/style_property_shorthand.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink { namespace blink {
...@@ -268,17 +269,9 @@ class TestCascadeAutoLock { ...@@ -268,17 +269,9 @@ class TestCascadeAutoLock {
StyleCascade::AutoLock lock_; StyleCascade::AutoLock lock_;
}; };
class StyleCascadeTest : public PageTestBase { class StyleCascadeTest : public PageTestBase, private ScopedCSSCascadeForTest {
public: public:
void SetUp() override { StyleCascadeTest() : ScopedCSSCascadeForTest(true) {}
RuntimeEnabledFeatures::SetCSSCascadeEnabled(true);
PageTestBase::SetUp();
}
void TearDown() override {
PageTestBase::TearDown();
RuntimeEnabledFeatures::SetCSSCascadeEnabled(false);
}
CSSStyleSheet* CreateSheet(const String& css_text) { CSSStyleSheet* CreateSheet(const String& css_text) {
auto* init = MakeGarbageCollected<CSSStyleSheetInit>(); auto* init = MakeGarbageCollected<CSSStyleSheetInit>();
......
...@@ -35,12 +35,13 @@ ...@@ -35,12 +35,13 @@
#include "third_party/blink/public/web/web_user_gesture_indicator.h" #include "third_party/blink/public/web/web_user_gesture_indicator.h"
#include "third_party/blink/renderer/core/dom/user_gesture_indicator.h" #include "third_party/blink/renderer/core/dom/user_gesture_indicator.h"
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
namespace blink { namespace blink {
TEST(WebUserGestureTokenTest, Basic) { TEST(WebUserGestureTokenTest, Basic) {
// UserGestureTokens are meaningless with UAv2. // UserGestureTokens are meaningless with UAv2.
RuntimeEnabledFeatures::SetUserActivationV2Enabled(false); ScopedUserActivationV2ForTest scoped_feature(false);
WebUserGestureToken token; WebUserGestureToken token;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "third_party/blink/renderer/platform/loader/testing/mock_fetch_context.h" #include "third_party/blink/renderer/platform/loader/testing/mock_fetch_context.h"
#include "third_party/blink/renderer/platform/loader/testing/test_loader_factory.h" #include "third_party/blink/renderer/platform/loader/testing/test_loader_factory.h"
#include "third_party/blink/renderer/platform/loader/testing/test_resource_fetcher_properties.h" #include "third_party/blink/renderer/platform/loader/testing/test_resource_fetcher_properties.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h" #include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
...@@ -120,7 +121,8 @@ void ModuleScriptLoaderTestModulator::Trace(blink::Visitor* visitor) { ...@@ -120,7 +121,8 @@ void ModuleScriptLoaderTestModulator::Trace(blink::Visitor* visitor) {
} // namespace } // namespace
class ModuleScriptLoaderTest : public PageTestBase { class ModuleScriptLoaderTest : public PageTestBase,
private ScopedJSONModulesForTest {
DISALLOW_COPY_AND_ASSIGN(ModuleScriptLoaderTest); DISALLOW_COPY_AND_ASSIGN(ModuleScriptLoaderTest);
public: public:
...@@ -168,12 +170,12 @@ class ModuleScriptLoaderTest : public PageTestBase { ...@@ -168,12 +170,12 @@ class ModuleScriptLoaderTest : public PageTestBase {
}; };
void ModuleScriptLoaderTest::SetUp() { void ModuleScriptLoaderTest::SetUp() {
RuntimeEnabledFeatures::SetJSONModulesEnabled(true);
PageTestBase::SetUp(IntSize(500, 500)); PageTestBase::SetUp(IntSize(500, 500));
} }
ModuleScriptLoaderTest::ModuleScriptLoaderTest() ModuleScriptLoaderTest::ModuleScriptLoaderTest()
: url_("https://example.test"), : ScopedJSONModulesForTest(true),
url_("https://example.test"),
security_origin_(SecurityOrigin::Create(url_)) { security_origin_(SecurityOrigin::Create(url_)) {
platform_->AdvanceClockSeconds(1.); // For non-zero DocumentParserTimings platform_->AdvanceClockSeconds(1.); // For non-zero DocumentParserTimings
} }
......
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