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