mirror of
https://github.com/servo/servo.git
synced 2025-10-14 23:40:26 +01:00
24 lines
849 B
JavaScript
24 lines
849 B
JavaScript
// META: script=/resources/testdriver.js
|
|
// META: script=/resources/testdriver-vendor.js
|
|
'use strict';
|
|
|
|
promise_test(async t => {
|
|
await test_driver.set_permission(
|
|
{ name: 'notifications' }, 'denied', false);
|
|
|
|
let detector = new IdleDetector();
|
|
await promise_rejects_dom(t, 'NotAllowedError', detector.start());
|
|
}, "Deny notifications permission should work.");
|
|
|
|
promise_test(async t => {
|
|
await test_driver.set_permission(
|
|
{ name: 'notifications' }, 'granted', false);
|
|
|
|
let detector = new IdleDetector();
|
|
await detector.start();
|
|
|
|
assert_true(['active', 'idle'].includes(detector.userState),
|
|
'has a valid user state');
|
|
assert_true(['locked', 'unlocked'].includes(detector.screenState),
|
|
'has a valid screen state');
|
|
}, "Grant notifications permission should work.");
|