summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/compute-pressure/compute_pressure_options.tentative.https.any.js
blob: 69999819d962fbf1841d87a817aed1ac23767f17 (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
// 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');