зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1535899 [wpt PR 15800] - [wake-lock] Adapted IDL tests to latest spec, a=testonly
Automatic update from web-platform-tests [wake-lock] Adapted IDL tests to latest spec (#15800) -- wpt-commits: 8ab29ab9f6ccec92deb35fff33fceb0862916852 wpt-pr: 15800
This commit is contained in:
Родитель
72bc5ecfa2
Коммит
29cb8bb80d
|
@ -5,17 +5,14 @@
|
|||
|
||||
enum WakeLockType { "screen", "system" };
|
||||
|
||||
partial interface Navigator {
|
||||
[SecureContext] Promise<WakeLock> getWakeLock(WakeLockType type);
|
||||
};
|
||||
|
||||
[SecureContext, Exposed=Window] interface WakeLock : EventTarget {
|
||||
[Constructor(WakeLockType type), SecureContext, Exposed=(DedicatedWorker, Window)]
|
||||
interface WakeLock : EventTarget {
|
||||
readonly attribute WakeLockType type;
|
||||
readonly attribute boolean active;
|
||||
attribute EventHandler onactivechange;
|
||||
WakeLockRequest createRequest();
|
||||
Promise<void> request(optional WakeLockRequestOptions options);
|
||||
};
|
||||
|
||||
[SecureContext, Exposed=Window] interface WakeLockRequest {
|
||||
void cancel();
|
||||
dictionary WakeLockRequestOptions {
|
||||
AbortSignal? signal;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://w3c.github.io/wake-lock/
|
||||
|
||||
'use strict';
|
||||
|
||||
idl_test(
|
||||
['wake-lock'],
|
||||
['dom', 'html'],
|
||||
idl_array => {
|
||||
idl_array.add_objects({
|
||||
WakeLock: ['new WakeLock("screen")']
|
||||
});
|
||||
}
|
||||
);
|
|
@ -1,31 +0,0 @@
|
|||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://w3c.github.io/wake-lock/
|
||||
|
||||
'use strict';
|
||||
|
||||
promise_test(async () => {
|
||||
const srcs = ['wake-lock', 'dom', 'html'];
|
||||
const [wakelock, dom, html] = await Promise.all(
|
||||
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(wakelock);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
idl_array.add_dependency_idls(html);
|
||||
|
||||
try {
|
||||
window.wakelock = await navigator.getWakeLock("screen");
|
||||
window.request = window.wakelock.createRequest();
|
||||
} catch (e) {
|
||||
// Surfaced in idlharness.js's test_object below.
|
||||
}
|
||||
|
||||
idl_array.add_objects({
|
||||
Navigator: ['navigator'],
|
||||
WakeLock: ['wakelock'],
|
||||
WakeLockRequest: ['request']
|
||||
});
|
||||
idl_array.test();
|
||||
}, 'Test IDL implementation of WakeLock API');
|
Загрузка…
Ссылка в новой задаче