0

Enable "SetTimeoutWithoutClamp" flag on the field trial testing

And add unit tests to cover disable/enable flags using a
`ScopedFeatureList`.

This is a follow-up to the intent-to-ship of removing clamp in
setTimeout(...,0), see
https://groups.google.com/a/chromium.org/g/blink-dev/c/HKPTp7C1LwY/m/5Rl78YJfAwAJ

NOTE TO SHERRIFS:
  If any tests are flaky, please help to change setTimeout(..., 0)
  to setTimeout(..., 1) if it can be found in a test that regressed
  before reverting this CL. Otherwise please disable the test and
  assign the bug to me, I'll dig more.

Bug: 402694

Change-Id: I436dcb6bb4a8ed43844cd0833bf0ef82528b0a95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3243793
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Nate Chapin <japhet@chromium.org>
Commit-Queue: Wanming Lin <wanming.lin@intel.com>
Cr-Commit-Position: refs/heads/main@{#944816}
This commit is contained in:
Wanming Lin
2021-11-24 03:29:10 +00:00
committed by Chromium LUCI CQ
parent 7faac6b1e0
commit 7e3b967806
4 changed files with 49 additions and 2 deletions
testing/variations
third_party/blink
renderer
web_tests
TestExpectations
external
wpt
html
webappapis

@ -7137,6 +7137,28 @@
]
}
],
"SetTimeoutWithoutClamp": [
{
"platforms": [
"android",
"android_weblayer",
"android_webview",
"chromeos",
"ios",
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"SetTimeoutWithoutClamp"
]
}
]
}
],
"SettingsResetPrompt": [
{
"platforms": [

@ -4,8 +4,10 @@
#include "third_party/blink/renderer/core/frame/dom_timer.h"
#include "base/test/scoped_feature_list.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/bindings/core/v8/idl_types.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h"
#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h"
@ -93,9 +95,12 @@ const char* const kSetTimeout0ScriptText =
"}"
"setTimeout(setTimeoutCallback, 0);";
TEST_F(DOMTimerTest, DISABLED_setTimeout_ZeroIsNotClampedToOne) {
TEST_F(DOMTimerTest, setTimeout_ZeroIsNotClampedToOne) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kSetTimeoutWithoutClamp);
ExecuteScriptAndWaitUntilIdle(kSetTimeout0ScriptText);
double time = ToDoubleValue(EvalExpression("elapsed"), scope);
@ -103,6 +108,19 @@ TEST_F(DOMTimerTest, DISABLED_setTimeout_ZeroIsNotClampedToOne) {
EXPECT_THAT(time, DoubleNear(0., kThreshold));
}
TEST_F(DOMTimerTest, setTimeout_ZeroIsClampedToOne) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
base::test::ScopedFeatureList feature_list;
feature_list.InitAndDisableFeature(features::kSetTimeoutWithoutClamp);
ExecuteScriptAndWaitUntilIdle(kSetTimeout0ScriptText);
double time = ToDoubleValue(EvalExpression("elapsed"), scope);
EXPECT_THAT(time, DoubleNear(1., kThreshold));
}
const char* const kSetTimeoutNestedScriptText =
"var last = performance.now();"
"var times = [];"

@ -7349,6 +7349,13 @@ crbug.com/1272203 external/wpt/websockets/stream/tentative/backpressure-send.any
# Times out flakily on all platforms. Previously marked slow, crbug.com/874695.
crbug.com/1272801 http/tests/permissions/chromium/test-request-sharedworker.html [ Pass Timeout ]
# Flaky with setTimeout without clamp
crbug.com/1272954 external/wpt/app-history/currentchange-event/currentchange-app-history-navigate-same-doc.html [ Failure Pass ]
crbug.com/1272954 external/wpt/app-history/currentchange-event/currentchange-app-history-back-forward-same-doc.html [ Failure Pass ]
crbug.com/1272954 external/wpt/app-history/currentchange-event/currentchange-history-back-same-doc.html [ Failure Pass ]
crbug.com/1272954 external/wpt/app-history/navigate-event/navigate-history-back-after-fragment.html [ Failure Pass ]
crbug.com/1272955 http/tests/devtools/extensions/extensions-timeline-api.js [ Failure Pass ]
# Sheriff 2021-11-23
crbug.com/1270963 wpt_internal/fenced_frame/create-credential.https.html [ Skip ]
crbug.com/1046784 http/tests/devtools/tracing/timeline-receive-response-event.js [ Failure Pass ]

@ -1,4 +1,4 @@
This is a testharness.js-based test.
FAIL Ordering of steps in "Update the Rendering" - child document requestAnimationFrame order assert_array_equals: expected order of notifications lengths differ, expected array ["parent_raf", "first_child_raf", "second_child_raf"] length 3, got ["parent_raf", "second_child_raf", "first_child_raf", "parent_raf", "second_child_raf", "first_child_raf"] length 6
FAIL Ordering of steps in "Update the Rendering" - child document requestAnimationFrame order assert_array_equals: expected order of notifications expected property 1 to be "first_child_raf" but got "second_child_raf" (expected array ["parent_raf", "first_child_raf", "second_child_raf"] got ["parent_raf", "second_child_raf", "first_child_raf"])
Harness: the test ran to completion.