diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/compute-pressure | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/compute-pressure')
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_basic.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_basic.tentative.https.any.js) | 8 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_detached_iframe.https.html (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_detached_iframe.tentative.https.html) | 4 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_disconnect.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_disconnect.tentative.https.any.js) | 2 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_idempotent.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_idempotent.tentative.https.any.js) | 2 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_immediately.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_immediately.tentative.https.any.js) | 4 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_duplicate_updates.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_duplicate_updates.tentative.https.any.js) | 4 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_multiple.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.any.js) | 2 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_observe_idempotent.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_observe_idempotent.tentative.https.any.js) | 2 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_observe_unobserve_failure.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_observe_unobserve_failure.tentative.https.any.js) | 0 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_options.https.any.js | 26 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_options.tentative.https.any.js | 25 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_not_triggered.https.window.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_not_triggered.tentative.https.window.js) | 6 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_triggered.https.window.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_triggered.tentative.https.window.js) | 6 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_supported_sources.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_supported_sources.tentative.https.any.js) | 0 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_take_records.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_take_records.tentative.https.any.js) | 2 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_timestamp.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_timestamp.tentative.https.any.js) | 26 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/compute_pressure_update_toJSON.https.any.js (renamed from testing/web-platform/tests/compute-pressure/compute_pressure_update_toJSON.tentative.https.any.js) | 2 | ||||
-rw-r--r-- | testing/web-platform/tests/compute-pressure/idlharness.https.any.js | 2 |
18 files changed, 60 insertions, 63 deletions
diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_basic.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_basic.https.any.js index 28322ced72..15d572bd8e 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_basic.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_basic.https.any.js @@ -21,7 +21,7 @@ pressure_test(async (t, mockPressureService) => { t.add_cleanup(() => observer.disconnect()); observer.observe('cpu'); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_true(changes.length === 1); assert_equals(changes[0].state, 'critical'); @@ -37,7 +37,7 @@ pressure_test((t, mockPressureService) => { const promise = observer.observe('cpu'); observer.unobserve('cpu'); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); return promise_rejects_dom(t, 'AbortError', promise); }, 'Removing observer before observe() resolves works'); @@ -57,7 +57,7 @@ pressure_test(async (t, mockPressureService) => { await Promise.all(observePromises); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); return Promise.all(callbackPromises); }, 'Calling observe() multiple times works'); @@ -72,7 +72,7 @@ pressure_test(async (t, mockPressureService) => { t.add_cleanup(() => observer1.disconnect()); observer1.observe('cpu'); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_true(observer1_changes.length === 1); assert_equals(observer1_changes[0][0].source, 'cpu'); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_detached_iframe.tentative.https.html b/testing/web-platform/tests/compute-pressure/compute_pressure_detached_iframe.https.html index 5511a14704..6123521248 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_detached_iframe.tentative.https.html +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_detached_iframe.https.html @@ -69,7 +69,7 @@ pressure_test(async (t, mockPressureService) => { t.add_cleanup(() => observer.disconnect()); observer.observe('cpu').catch(reject); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_equals(changes[0].state, 'critical'); }, 'Detaching frame while PressureObserver.observe() settles'); @@ -84,7 +84,7 @@ pressure_test(async (t, mockPressureService) => { await observer.observe('cpu'); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); iframe.remove(); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect.https.any.js index 1d188fad8b..f8bc3fb357 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect.https.any.js @@ -31,7 +31,7 @@ pressure_test(async (t, mockPressureService) => { t.add_cleanup(() => observer2.disconnect()); observer2.observe('cpu').catch(reject); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_equals( diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_idempotent.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_idempotent.https.any.js index 74d37bd6e5..3c9a6688a4 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_idempotent.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_idempotent.https.any.js @@ -25,7 +25,7 @@ pressure_test(async (t, mockPressureService) => { t.add_cleanup(() => observer2.disconnect()); observer2.observe('cpu').catch(reject); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_equals( diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_immediately.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_immediately.https.any.js index 9b545fbe1c..86963e242a 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_immediately.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_disconnect_immediately.https.any.js @@ -24,7 +24,7 @@ pressure_test(async (t, mockPressureService) => { t.add_cleanup(() => observer2.disconnect()); observer2.observe('cpu').catch(reject); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_equals( @@ -55,7 +55,7 @@ pressure_test(async (t, mockPressureService) => { observer1.disconnect(); await promise_rejects_dom(t, 'AbortError', promise); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_equals( diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_duplicate_updates.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_duplicate_updates.https.any.js index dde92932dd..04c5df5e57 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_duplicate_updates.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_duplicate_updates.https.any.js @@ -12,11 +12,11 @@ pressure_test(async (t, mockPressureService) => { observer_changes.push(changes); if (++n === 2) resolve(observer_changes); - }, {sampleRate: 5.0}); + }, {sampleInterval: 200}); observer.observe('cpu'); const updatesDelivered = mockPressureService.updatesDelivered(); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval*/ 200); // Deliver 2 updates. await t.step_wait( () => mockPressureService.updatesDelivered() >= (updatesDelivered + 2), diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.https.any.js index c8cef5beca..8c50cc4b3d 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_multiple.https.any.js @@ -24,7 +24,7 @@ pressure_test(async (t, mockPressureService) => { }); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); const [changes1, changes2, changes3] = await Promise.all([changes1_promise, changes2_promise, changes3_promise]); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_observe_idempotent.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_observe_idempotent.https.any.js index 5dc3804b2f..9fcbb49814 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_observe_idempotent.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_observe_idempotent.https.any.js @@ -12,7 +12,7 @@ pressure_test(async (t, mockPressureService) => { observer.observe('cpu').catch(reject); observer.observe('cpu').catch(reject); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_equals(update[0].state, 'critical'); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_observe_unobserve_failure.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_observe_unobserve_failure.https.any.js index 8eafeb356d..8eafeb356d 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_observe_unobserve_failure.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_observe_unobserve_failure.https.any.js diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_options.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_options.https.any.js new file mode 100644 index 0000000000..d0760ef622 --- /dev/null +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_options.https.any.js @@ -0,0 +1,26 @@ +// META: global=window,dedicatedworker,sharedworker + +'use strict'; + +test(t => { + const observer = new PressureObserver(() => {}, {sampleInterval: 0}); + assert_equals(typeof observer, 'object'); +}, 'PressureObserver constructor doesnt throw error for sampleInterval value 0'); + + +test(t => { + assert_throws_js(TypeError, () => { + new PressureObserver(() => {}, {sampleInterval: -2}); + }); +}, 'PressureObserver constructor requires a positive sampleInterval'); + +test(t => { + assert_throws_js(TypeError, () => { + new PressureObserver(() => {}, {sampleInterval: 2 ** 32}); + }); +}, 'PressureObserver constructor requires a sampleInterval in unsigned long range'); + +test(t => { + const observer = new PressureObserver(() => {}, {}); + assert_equals(typeof observer, 'object'); +}, 'PressureObserver constructor succeeds on empty sampleInterval'); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_options.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_options.tentative.https.any.js deleted file mode 100644 index 69999819d9..0000000000 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_options.tentative.https.any.js +++ /dev/null @@ -1,25 +0,0 @@ -// META: global=window,dedicatedworker,sharedworker - -'use strict'; - -test(t => { - assert_throws_js(RangeError, () => { - new PressureObserver(() => {}, {sampleRate: 0}); - }); -}, 'PressureObserver constructor requires a non-zero sampleRate'); - -test(t => { - assert_throws_js(RangeError, () => { - new PressureObserver(() => {}, {sampleRate: -2}); - }); -}, 'PressureObserver constructor requires a positive sampleRate'); - -test(t => { - const observer = new PressureObserver(() => {}, {sampleRate: 0.5}); - assert_equals(typeof observer, 'object'); -}, 'PressureObserver constructor doesnt throw error on positive sampleRate'); - -test(t => { - const observer = new PressureObserver(() => {}, {}); - assert_equals(typeof observer, 'object'); -}, 'PressureObserver constructor succeeds on empty sampleRate'); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_not_triggered.tentative.https.window.js b/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_not_triggered.https.window.js index cb1aa432ce..e348a8ea08 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_not_triggered.tentative.https.window.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_not_triggered.https.window.js @@ -6,7 +6,7 @@ 'use strict'; pressure_test(async (t, mockPressureService) => { - const sampleRateInHz = 10; + const sampleIntervalInMs = 100; const readings = ['nominal', 'fair', 'serious', 'critical']; // Normative values for rate obfuscation parameters. // https://w3c.github.io/compute-pressure/#rate-obfuscation-normative-parameters. @@ -17,10 +17,10 @@ pressure_test(async (t, mockPressureService) => { const observerChanges = []; const observer = new PressureObserver(changes => { observerChanges.push(changes); - }, {sampleRate: sampleRateInHz}); + }, {sampleInterval: sampleIntervalInMs}); observer.observe('cpu'); - mockPressureService.startPlatformCollector(sampleRateInHz); + mockPressureService.startPlatformCollector(sampleIntervalInMs); let i = 0; // mockPressureService.updatesDelivered() does not necessarily match // pressureChanges.length, as system load and browser optimizations can diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_triggered.tentative.https.window.js b/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_triggered.https.window.js index 11dcc3c70a..ebe33bc8bf 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_triggered.tentative.https.window.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_rate_obfuscation_mitigation_triggered.https.window.js @@ -6,7 +6,7 @@ 'use strict'; pressure_test(async (t, mockPressureService) => { - const sampleRateInHz = 25; + const sampleIntervalInMs = 40; const readings = ['nominal', 'fair', 'serious', 'critical']; // Normative values for rate obfuscation parameters. // https://w3c.github.io/compute-pressure/#rate-obfuscation-normative-parameters. @@ -31,10 +31,10 @@ pressure_test(async (t, mockPressureService) => { } } observerChanges.push(changes); - }, {sampleRate: sampleRateInHz}); + }, {sampleInterval: sampleIntervalInMs}); observer.observe('cpu'); - mockPressureService.startPlatformCollector(sampleRateInHz); + mockPressureService.startPlatformCollector(sampleIntervalInMs); let i = 0; // mockPressureService.updatesDelivered() does not necessarily match // pressureChanges.length, as system load and browser optimizations can diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_supported_sources.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_supported_sources.https.any.js index 63f2666cca..63f2666cca 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_supported_sources.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_supported_sources.https.any.js diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_take_records.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_take_records.https.any.js index d93c9b5c88..55660b228b 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_take_records.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_take_records.https.any.js @@ -20,7 +20,7 @@ pressure_test(async (t, mockPressureService) => { observer.observe('cpu'); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_equals(changes[0].state, 'critical'); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_timestamp.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_timestamp.https.any.js index f283caa6ba..09caeb3478 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_timestamp.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_timestamp.https.any.js @@ -7,15 +7,15 @@ pressure_test(async (t, mockPressureService) => { const readings = ['nominal', 'fair', 'serious', 'critical']; - const sampleRate = 4.0; + const sampleInterval = 250; const pressureChanges = await new Promise(async resolve => { const observerChanges = []; const observer = new PressureObserver(changes => { observerChanges.push(changes); - }, {sampleRate}); + }, {sampleInterval}); observer.observe('cpu'); - mockPressureService.startPlatformCollector(sampleRate * 2); + mockPressureService.startPlatformCollector(sampleInterval / 2); let i = 0; // mockPressureService.updatesDelivered() does not necessarily match // pressureChanges.length, as system load and browser optimizations can @@ -34,27 +34,24 @@ pressure_test(async (t, mockPressureService) => { assert_equals(pressureChanges.length, 4); assert_greater_than_equal( - pressureChanges[1][0].time - pressureChanges[0][0].time, - (1 / sampleRate * 1000)); + pressureChanges[1][0].time - pressureChanges[0][0].time, sampleInterval); assert_greater_than_equal( - pressureChanges[2][0].time - pressureChanges[1][0].time, - (1 / sampleRate * 1000)); + pressureChanges[2][0].time - pressureChanges[1][0].time, sampleInterval); assert_greater_than_equal( - pressureChanges[3][0].time - pressureChanges[2][0].time, - (1 / sampleRate * 1000)); + pressureChanges[3][0].time - pressureChanges[2][0].time, sampleInterval); }, 'Faster collector: Timestamp difference between two changes should be higher or equal to the observer sample rate'); pressure_test(async (t, mockPressureService) => { const pressureChanges = []; - const sampleRate = 1.0; + const sampleInterval = 1000; const observer = new PressureObserver(changes => { pressureChanges.push(changes); - }, {sampleRate}); + }, {sampleInterval}); await new Promise(async resolve => { observer.observe('cpu'); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(sampleRate); + mockPressureService.startPlatformCollector(sampleInterval); await t.step_wait(() => pressureChanges.length == 1); observer.disconnect(); resolve(); @@ -63,7 +60,7 @@ pressure_test(async (t, mockPressureService) => { await new Promise(async resolve => { observer.observe('cpu'); mockPressureService.setPressureUpdate('cpu', 'serious'); - mockPressureService.startPlatformCollector(sampleRate * 4); + mockPressureService.startPlatformCollector(sampleInterval / 4); await t.step_wait(() => pressureChanges.length == 2); observer.disconnect(); resolve(); @@ -74,6 +71,5 @@ pressure_test(async (t, mockPressureService) => { // should be deleted. So the second PressureRecord is not discarded even // though the time interval does not meet the requirement. assert_less_than( - pressureChanges[1][0].time - pressureChanges[0][0].time, - (1 / sampleRate * 1000)); + pressureChanges[1][0].time - pressureChanges[0][0].time, sampleInterval); }, 'disconnect() should update [[LastRecordMap]]'); diff --git a/testing/web-platform/tests/compute-pressure/compute_pressure_update_toJSON.tentative.https.any.js b/testing/web-platform/tests/compute-pressure/compute_pressure_update_toJSON.https.any.js index 0024d69754..7f726698d6 100644 --- a/testing/web-platform/tests/compute-pressure/compute_pressure_update_toJSON.tentative.https.any.js +++ b/testing/web-platform/tests/compute-pressure/compute_pressure_update_toJSON.https.any.js @@ -7,7 +7,7 @@ pressure_test(async (t, mockPressureService) => { const observer = new PressureObserver(resolve); observer.observe('cpu'); mockPressureService.setPressureUpdate('cpu', 'critical'); - mockPressureService.startPlatformCollector(/*sampleRate=*/ 5.0); + mockPressureService.startPlatformCollector(/*sampleInterval=*/ 200); }); assert_true(changes.length === 1); const json = changes[0].toJSON(); diff --git a/testing/web-platform/tests/compute-pressure/idlharness.https.any.js b/testing/web-platform/tests/compute-pressure/idlharness.https.any.js index e828996232..48ab5615b0 100644 --- a/testing/web-platform/tests/compute-pressure/idlharness.https.any.js +++ b/testing/web-platform/tests/compute-pressure/idlharness.https.any.js @@ -11,5 +11,5 @@ idl_test(['compute-pressure'], ['dom', 'html'], async idl_array => { PressureObserver: ['observer'], }); - self.observer = new PressureObserver(() => {}, {sampleRate: 1.0}); + self.observer = new PressureObserver(() => {}, {sampleInterval: 1000}); }); |