Commit 14e74beb authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Allow command line parameters to override "test" features.

Prior to this CL, any feature marked "test" in runtime_enabled_features.json5
could not be disabled for web_tests without extra work. This includes
attempting to disable via command line flags passed into run_web_tests, or
more seriously, through a VirtualTestSuite that attempts to disable the
feature for testing.

The problem was that renderer features were enabled first for command line
flags, and then enabled for any features marked "test". Therefore, any
command line flag that tries to disable a "test" feature will get overridden,
and the feature will be left enabled for testing.

In this CL, the order of those two initializations is reversed: first enable
any "test" features, and then handle command line flags. Note that in two
cases (portals and ARIA) the command line flags were set to kUseFeatureState,
which meant that those "test" features would be re-disabled if the explicit
command line flag was not present. As both flags are named "EnableXyz" they
should likely use kEnableOnly instead.

Change-Id: I50a0f498b93520fd23e7c5bcd6d1e19680006236
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1960985Reviewed-by: default avatarLucas Gadani <lfg@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#724076}
parent b9bab54b
...@@ -253,15 +253,14 @@ void SetRuntimeFeaturesFromChromiumFeatures() { ...@@ -253,15 +253,14 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
{wf::EnableFeaturePolicyForSandbox, {wf::EnableFeaturePolicyForSandbox,
features::kFeaturePolicyForSandbox, kEnableOnly}, features::kFeaturePolicyForSandbox, kEnableOnly},
{wf::EnableAccessibilityExposeARIAAnnotations, {wf::EnableAccessibilityExposeARIAAnnotations,
features::kEnableAccessibilityExposeARIAAnnotations, features::kEnableAccessibilityExposeARIAAnnotations, kEnableOnly},
kUseFeatureState},
{wf::EnableAccessibilityExposeDisplayNone, {wf::EnableAccessibilityExposeDisplayNone,
features::kEnableAccessibilityExposeDisplayNone, kUseFeatureState}, features::kEnableAccessibilityExposeDisplayNone, kEnableOnly},
{wf::EnableAllowSyncXHRInPageDismissal, {wf::EnableAllowSyncXHRInPageDismissal,
blink::features::kAllowSyncXHRInPageDismissal, kEnableOnly}, blink::features::kAllowSyncXHRInPageDismissal, kEnableOnly},
{wf::EnableAutoplayIgnoresWebAudio, media::kAutoplayIgnoreWebAudio, {wf::EnableAutoplayIgnoresWebAudio, media::kAutoplayIgnoreWebAudio,
kUseFeatureState}, kUseFeatureState},
{wf::EnablePortals, blink::features::kPortals, kUseFeatureState}, {wf::EnablePortals, blink::features::kPortals, kEnableOnly},
{wf::EnableImplicitRootScroller, {wf::EnableImplicitRootScroller,
blink::features::kImplicitRootScroller, kUseFeatureState}, blink::features::kImplicitRootScroller, kUseFeatureState},
{wf::EnableCSSOMViewScrollCoordinates, {wf::EnableCSSOMViewScrollCoordinates,
......
...@@ -982,10 +982,14 @@ void RenderThreadImpl::InitializeWebKit(mojo::BinderMap* binders) { ...@@ -982,10 +982,14 @@ void RenderThreadImpl::InitializeWebKit(mojo::BinderMap* binders) {
blink_platform_impl_.reset( blink_platform_impl_.reset(
new RendererBlinkPlatformImpl(main_thread_scheduler_.get())); new RendererBlinkPlatformImpl(main_thread_scheduler_.get()));
SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line); // This, among other things, enables any feature marked "test" in
// runtime_enabled_features. It is run before
// SetRuntimeFeaturesDefaultsAndUpdateFromArgs() so that command line
// arguments take precedence over (and can disable) "test" features.
GetContentClient() GetContentClient()
->renderer() ->renderer()
->SetRuntimeFeaturesDefaultsBeforeBlinkInitialization(); ->SetRuntimeFeaturesDefaultsBeforeBlinkInitialization();
SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line);
blink::Initialize(blink_platform_impl_.get(), binders, blink::Initialize(blink_platform_impl_.get(), binders,
main_thread_scheduler_.get()); main_thread_scheduler_.get());
......
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