summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/compute-pressure/compute_pressure_options.https.any.js
blob: d0760ef6224db7555943f2241b1b16d40162aa6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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');