tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d963d4845fe6bbe740201859e630004b470a155f
parent c7fab23dcfbed628d5f55c08b300e9963b69f600
Author: Scott Haseley <shaseley@chromium.org>
Date:   Mon, 17 Nov 2025 21:50:11 +0000

Bug 2000519 [wpt PR 56044] - [soft navs] Clean up SoftNavigationTestHelper.get*PerformanceEntries*, a=testonly

Automatic update from web-platform-tests
[soft navs] Clean up SoftNavigationTestHelper.get*PerformanceEntries*

Drive-by cleanup of soft navs test helpers. The main thing is that the
include_soft_navigation_observations option was previously removed from
getPerformanceEntries, but was still being passed in some places, so
some tests were actually comparing minNumEntries to a bool.

Additionally, this changes minNumEntries to default to 1 to remove
some boilerplate, since we almost always use that. I think this is a
minor readability improvement.

Bug: None
Change-Id: I727d3c2e9c4b9d9d2b3c564eb69e7b798e693f59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7157755
Reviewed-by: Michal Mocny <mmocny@chromium.org>
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1545286}

--

wpt-commits: 9e63cb5491a67c31337e81455c16d23a96ba1b3c
wpt-pr: 56044

Diffstat:
Mtesting/web-platform/tests/soft-navigation-heuristics/detection/tentative/navigation-api-precommit-handler.html | 4++--
Mtesting/web-platform/tests/soft-navigation-heuristics/detection/tentative/node-with-image-pseudo-element-and-text.html | 10++++------
Mtesting/web-platform/tests/soft-navigation-heuristics/detection/tentative/node-with-image-pseudo-element.html | 10++++------
Mtesting/web-platform/tests/soft-navigation-heuristics/detection/tentative/overwriting-text-once-per-interaction.html | 14+++++---------
Mtesting/web-platform/tests/soft-navigation-heuristics/detection/tentative/overwriting-text.html | 10++++------
Mtesting/web-platform/tests/soft-navigation-heuristics/detection/tentative/video-srcObject-change.html | 7++-----
Mtesting/web-platform/tests/soft-navigation-heuristics/interaction-with-paint-before-back.tentative.html | 12++++--------
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/background-image-set-image.html | 6++----
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/broken-image-icon.html | 16++++------------
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/contracted-image.html | 16++++------------
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/cross-origin-image.sub.html | 12++++--------
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/element-only-when-fully-active.html | 7++-----
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/expanded-image.html | 16++++------------
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/first-paint-equals-lcp-text.html | 21+++++----------------
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/iframe-content-not-observed.html | 20++++++++------------
Mtesting/web-platform/tests/soft-navigation-heuristics/lcp/tentative/raf-loop.html | 13++++---------
Mtesting/web-platform/tests/soft-navigation-heuristics/resources/soft-navigation-test-helper.js | 7++++---
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/almost-soft-navigation.html | 6++----
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/dom.html | 6++----
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/image-src-change.html | 7++-----
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/late-url-change.html | 7++-----
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/lcp-unbuffered.html | 22++++++----------------
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/lcp.html | 17++++-------------
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/task-attribution-link-load.html | 7++-----
Mtesting/web-platform/tests/soft-navigation-heuristics/smoke/tentative/video-src-change.html | 7++-----
25 files changed, 88 insertions(+), 192 deletions(-)

diff --git a/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/navigation-api-precommit-handler.html b/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/navigation-api-precommit-handler.html @@ -38,8 +38,8 @@ }); promise_test(async t => { - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - "soft-navigation", /* minNumEntries= */ 1); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); const helper = new SoftNavigationTestHelper(t); const softNavs = await helper.withTimeoutMessage( softNavPromise, "Soft navigation not detected.", /*timeout=*/ 3000); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/node-with-image-pseudo-element-and-text.html b/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/node-with-image-pseudo-element-and-text.html @@ -27,9 +27,8 @@ const url = 'soft-nav-1'; navigateButton.addEventListener('click', async () => { - const firstIcpPromise = SoftNavigationTestHelper.getPerformanceEntries( - 'interaction-contentful-paint', - /* minNumEntries= */ 1); + const firstIcpPromise = + SoftNavigationTestHelper.getPerformanceEntries('interaction-contentful-paint'); container.innerHTML = `<div><div id="content">Text</div></div>`; history.pushState({}, '', url); @@ -44,9 +43,8 @@ // Set up the PerformanceObservers before clicking to avoid races, // and use unbuffered here so we don't get duplicate entries. - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - 'soft-navigation', - /* minNumEntries= */ 1); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries('soft-navigation'); const icpPromise = SoftNavigationTestHelper.getPerformanceEntries( 'interaction-contentful-paint', /* minNumEntries= */ 2); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/node-with-image-pseudo-element.html b/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/node-with-image-pseudo-element.html @@ -33,12 +33,10 @@ // Set up the PerformanceObservers before clicking to avoid races, // and use unbuffered here so we don't get duplicate entries. - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - "soft-navigation", - /* minNumEntries= */ 1); - const icpPromise = SoftNavigationTestHelper.getPerformanceEntries( - "interaction-contentful-paint", - /* minNumEntries= */ 1); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); + const icpPromise = + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"); if (test_driver) { test_driver.click(navigateButton); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/overwriting-text-once-per-interaction.html b/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/overwriting-text-once-per-interaction.html @@ -31,12 +31,10 @@ entries[0].identifier, elementId, `Unexpected ElementTiming entry: expected "${elementId}"`); - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - "soft-navigation", - /* minNumEntries= */ 1); - let icpPromise = SoftNavigationTestHelper.getPerformanceEntries( - "interaction-contentful-paint", - /* minNumEntries= */ 1); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); + let icpPromise = + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"); const {promise, resolve} = Promise.withResolvers(); navigateButton.addEventListener('click', async () => { @@ -77,9 +75,7 @@ // Set things up for the next ICP entry. - icpPromise = SoftNavigationTestHelper.getPerformanceEntries( - "interaction-contentful-paint", - /* minNumEntries= */ 1); + icpPromise = SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"); resolve(); icps = await helper.withTimeoutMessage( diff --git a/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/overwriting-text.html b/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/overwriting-text.html @@ -45,12 +45,10 @@ // and use unbuffered here so we don't get duplicate entries. const elementTimingPromise = waitForExactlyOneElementTimingEntry(url, /*buffered=*/false); - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - "soft-navigation", - /* minNumEntries= */ 1); - const icpPromise = SoftNavigationTestHelper.getPerformanceEntries( - "interaction-contentful-paint", - /* minNumEntries= */ 1); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); + const icpPromise = + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"); if (test_driver) { test_driver.click(navigateButton); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/video-srcObject-change.html b/testing/web-platform/tests/soft-navigation-heuristics/detection/tentative/video-srcObject-change.html @@ -56,11 +56,8 @@ testVideo.play(); }, {once: true}); - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*include_soft_navigation_observations=*/ false, - /*min_num_entries=*/ 1, - ); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); if (test_driver) { test_driver.click(navigateButton); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/interaction-with-paint-before-back.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/interaction-with-paint-before-back.tentative.html @@ -56,10 +56,8 @@ // Now, click almost_soft_nav_div, and observe that time image // was rendered but no soft nav was triggered. { - const element_timing_promise = helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "element", - /*minNumEntries=*/ 1, - ); + const element_timing_promise = + helper.getBufferedPerformanceEntriesWithTimeout("element"); if (test_driver) { test_driver.click(almost_soft_nav_div); } @@ -77,10 +75,8 @@ // Now, click soft_nav_div, and observe the detected soft navigation. { - const soft_nav_promise = helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "soft-navigation", - /*minNumEntries=*/ 1, - ); + const soft_nav_promise = + helper.getBufferedPerformanceEntriesWithTimeout("soft-navigation"); if (test_driver) { test_driver.click(soft_nav_div); } diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/background-image-set-image.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/background-image-set-image.html @@ -36,10 +36,8 @@ Notes: promise_test(async (t) => { assert_implements(window.InteractionContentfulPaint, "InteractionContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/broken-image-icon.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/broken-image-icon.html @@ -34,22 +34,14 @@ Notes: promise_test(async (t) => { assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); const promise = Promise.all([ - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", - /*minNumEntries=*/ 1, - ), - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*minNumEntries=*/ 1, - ), + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"), + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"), ]); if (test_driver) { diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/contracted-image.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/contracted-image.html @@ -39,22 +39,14 @@ promise_test(async (t) => { assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); const promises = Promise.all([ - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*minNumEntries=*/ 1, - ), - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", - /*minNumEntries=*/ 1, - ), + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"), + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"), ]); const beforeLoad = performance.now(); if (test_driver) { diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/cross-origin-image.sub.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/cross-origin-image.sub.html @@ -33,16 +33,12 @@ promise_test(async (t) => { assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); - const softLcpPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", - /*minNumEntries=*/ 1, - ); + const softLcpPromise = + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"); if (test_driver) { test_driver.click(document.getElementById("click-target")); } diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/element-only-when-fully-active.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/element-only-when-fully-active.html @@ -29,11 +29,8 @@ Notes: let t = async_test( "Only expose element attribute for fully active documents (after soft navigation)", ); - const softNavigationPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "largest-contentful-paint", - /*include_soft_navigation=*/ true, - /*min_entries=*/ 1, - ); + const softNavigationPromise = + SoftNavigationTestHelper.getPerformanceEntries("largest-contentful-paint"); if (test_driver) { test_driver.click(document.getElementById("click-target")); } diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/expanded-image.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/expanded-image.html @@ -35,22 +35,14 @@ Notes: promise_test(async (t) => { assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); const beforeLoad = performance.now(); const promise = Promise.all([ - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", - /*minNumEntries=*/ 1, - ), - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*minNumEntries=*/ 1, - ), + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"), + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"), ]); if (test_driver) { test_driver.click(document.getElementById("click-target")); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/first-paint-equals-lcp-text.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/first-paint-equals-lcp-text.html @@ -32,26 +32,15 @@ Notes: assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); const beforeLoad = performance.now(); const promise = Promise.all([ - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*minNumEntries=*/ 1, - ), - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "element", - /*minNumEntries=*/ 1, - ), - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", - /*minNumEntries=*/ 1, - ), + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"), + SoftNavigationTestHelper.getPerformanceEntries("element"), + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"), ]); if (test_driver) { test_driver.click(document.getElementById("click-target")); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/iframe-content-not-observed.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/iframe-content-not-observed.html @@ -30,23 +30,19 @@ Notes: promise_test(async (t) => { assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); - const softNavigationPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*minNumEntries=*/ 1, - ).then((entries) => { + const softNavigationPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation") + .then((entries) => { assert_unreached("Should not have received a soft navigation entry!"); }); - const softLcpPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", - /*minNumEntries=*/ 1, - ).then((entries) => { + const softLcpPromise = + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint") + .then((entries) => { assert_unreached("Should not have received an a soft LCP entry!"); }); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/raf-loop.html b/testing/web-platform/tests/soft-navigation-heuristics/lcp/tentative/raf-loop.html @@ -55,20 +55,15 @@ promise_test(async (t) => { assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); const helper = new SoftNavigationTestHelper(t); - const lcpEntries = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*minNumEntries=*/ 1, - ); + const lcpEntries = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(lcpEntries.length, 1, "There should be only one LCP entry"); assert_equals(lcpEntries[0].id, "click-target", "The first entry should be the button"); const promise = Promise.all([ + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"), SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*minNumEntries=*/ 1, - ), - SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", + "interaction-contentful-paint", /*minNumEntries=*/ 2, ), ]); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/resources/soft-navigation-test-helper.js b/testing/web-platform/tests/soft-navigation-heuristics/resources/soft-navigation-test-helper.js @@ -54,12 +54,13 @@ class SoftNavigationTestHelper { * optionally including soft navigation observations, with a timeout message. * @param {string} type The type of the entries to wait for. * @param {number} minNumEntries The minimum number of entries to wait for. + * Defaults to 1. * @param {number=} timeout The timeout in milliseconds. Defaults to 1000. * @return {!Promise} The promise, which either resolves with the entries or * rejects with a timeout message. */ async getBufferedPerformanceEntriesWithTimeout( - type, minNumEntries, timeout = 1000) { + type, minNumEntries = 1, timeout = 1000) { let observer; return this .newPromiseWithTimeoutMessage( @@ -88,10 +89,10 @@ class SoftNavigationTestHelper { * optionally including soft navigation observations. * @param {string} type The type of the entries to wait for. * @param {number} minNumEntries The minimum number of entries to wait for. + * Defaults to 1. * @return {!Promise} The promise, which resolves with the entries. */ - static getPerformanceEntries( - type, minNumEntries) { + static getPerformanceEntries(type, minNumEntries = 1) { return new Promise((resolve) => { const entries = []; const observer = new PerformanceObserver((list) => { diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/almost-soft-navigation.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/almost-soft-navigation.html @@ -86,10 +86,8 @@ <script> function test_template(test_id, description) { promise_test(async (t) => { - const promise = SoftNavigationTestHelper.getPerformanceEntries( - "soft-navigation", - /*minNumEntries=*/ 1, - ); + const promise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); if (test_driver) { global_test_id = test_id; test_driver.click(document.getElementById(test_id)); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/dom.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/dom.html @@ -103,10 +103,8 @@ <script> function test_template(test_id, description) { promise_test(async (t) => { - const promise = SoftNavigationTestHelper.getPerformanceEntries( - "soft-navigation", - /* minNumEntries= */ 1, - ); + const promise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); if (test_driver) { test_driver.click(document.getElementById(test_id)); } diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/image-src-change.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/image-src-change.html @@ -29,11 +29,8 @@ testImage.src = newImageSrc; }, {once: true}); - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*include_soft_navigation_observations=*/ false, - /*min_num_entries=*/ 1, - ); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); if (test_driver) { test_driver.click(navigateButton); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/late-url-change.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/late-url-change.html @@ -29,11 +29,8 @@ history.pushState({}, '', URL); }, {once: true}); - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*include_soft_navigation_observations=*/ false, - /*min_num_entries=*/ 1, - ); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); if (test_driver) { test_driver.click(navigateButton); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/lcp-unbuffered.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/lcp-unbuffered.html @@ -20,11 +20,8 @@ // We start this promise early, so that it can observe the initial LCP, // which is expected to be the div just below. - const firstLcpPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "largest-contentful-paint", - /*include_soft_navigation_observations=*/ false, - /*min_num_entries=*/ 1, - ); + const firstLcpPromise = + SoftNavigationTestHelper.getPerformanceEntries("largest-contentful-paint"); </script> <div id="click-target" onclick="clickHandler()">Click here!</div> @@ -36,17 +33,10 @@ assert_equals(firstLcp[0].id, "click-target", "LCP should be click target."); // Set up promises for soft navigation and LCP entries, before the click. - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*include_soft_navigation_observations=*/ false, - /*min_num_entries=*/ 1, - /*timeout_ms=*/ 3000, - ); - const icpPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "interaction-contentful-paint", - /*include_soft_navigation_observations=*/ true, - /*min_num_entries=*/ 1, - ); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); + const icpPromise = + SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint"); if (test_driver) { test_driver.click(document.getElementById("click-target")); } diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/lcp.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/lcp.html @@ -30,11 +30,8 @@ // Wait for the initial LCP entry, prior to clicking, so that // we may later observe the soft navigation LCP entry in addition. - const initial_lcp = await helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "largest-contentful-paint", - /*min_num_entries=*/ 1, - ); - + const initial_lcp = + await helper.getBufferedPerformanceEntriesWithTimeout("largest-contentful-paint"); assert_equals(initial_lcp.length, 1, "There's one initial LCP entry."); assert_equals( initial_lcp[0].id, @@ -49,14 +46,8 @@ // Now that we've clicked, we expect to see a soft navigation, // and a soft navigation LCP entry; const results = await Promise.allSettled([ - helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "soft-navigation", - /*min_num_entries=*/ 1, - ), - helper.getBufferedPerformanceEntriesWithTimeout( - /*type=*/ "interaction-contentful-paint", - /*min_num_entries=*/ 1, - ), + helper.getBufferedPerformanceEntriesWithTimeout("soft-navigation"), + helper.getBufferedPerformanceEntriesWithTimeout("interaction-contentful-paint"), ]); // If either or both of soft nav entry or soft nav LCP are missing, diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/task-attribution-link-load.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/task-attribution-link-load.html @@ -53,11 +53,8 @@ } }, {once: true}); - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ 'soft-navigation', - /*include_soft_navigation_observations=*/ false, - /*min_num_entries=*/ 1, - ); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries('soft-navigation'); if (test_driver) { test_driver.click(navigateButton); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/video-src-change.html b/testing/web-platform/tests/soft-navigation-heuristics/smoke/tentative/video-src-change.html @@ -27,11 +27,8 @@ testVideo.src = newVideoSrc; }, {once: true}); - const softNavPromise = SoftNavigationTestHelper.getPerformanceEntries( - /*type=*/ "soft-navigation", - /*include_soft_navigation_observations=*/ false, - /*min_num_entries=*/ 1, - ); + const softNavPromise = + SoftNavigationTestHelper.getPerformanceEntries("soft-navigation"); if (test_driver) { test_driver.click(navigateButton);