gecko-dev/testing/web-platform/tests/web-locks/idlharness.tentative.https.any.js
Joshua Bell d9c00fd14d Bug 1488977 [wpt PR 12860] - Web Locks API: Run tests in additional globals, a=testonly
Automatic update from web-platform-testsWeb Locks API: Run tests in additional globals

Use the "META: global=" annotation to run the web-locks/ tests in
shared and service workers, as appropriate.

Change-Id: I1d6acd9b4e2932bf3a60b1e41285cbe74e3cb8ff
Reviewed-on: https://chromium-review.googlesource.com/1208447
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590265}

--

wpt-commits: 7d538d126b49411702cdd88354f520cdf9a65702
wpt-pr: 12860

--HG--
extra : rebase_source : 125cfaf5b02d72d5746aaeb894d27ef8da08c929
extra : source : 703c030316ba169ade809c83d901a58f1881677c
2018-09-13 02:53:08 +00:00

34 lines
880 B
JavaScript

// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: global=window,dedicatedworker,sharedworker,serviceworker
'use strict';
promise_test(async t => {
const srcs = ['./web-locks.idl', '/interfaces/html.idl'];
const [weblocks, html] = await Promise.all(
srcs.map(i => fetch(i).then(r => r.text())));
const idl_array = new IdlArray();
idl_array.add_idls(weblocks);
idl_array.add_dependency_idls(html);
try {
await navigator.locks.request('name', l => { self.lock = l; });
} catch (e) {
// Surfaced in idlharness.js's test_object below.
}
idl_array.add_objects({
LockManager: ['navigator.locks'],
Lock: ['lock'],
});
if (self.Window) {
idl_array.add_objects({ Navigator: ['navigator'] });
} else {
idl_array.add_objects({ WorkerNavigator: ['navigator'] });
}
idl_array.test();
});