mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
Update web-platform-tests to revision c792ea26624bde49b72afce348de07ab72fb9ad7
This commit is contained in:
parent
e051c5880e
commit
ca45711d07
178 changed files with 2163 additions and 1807 deletions
|
@ -0,0 +1,33 @@
|
|||
// META: title=Web Locks API: Exclusive Mode
|
||||
|
||||
'use strict';
|
||||
|
||||
promise_test(async t => {
|
||||
const granted = [];
|
||||
function log_grant(n) { return () => { granted.push(n); }; }
|
||||
|
||||
await Promise.all([
|
||||
navigator.locks.request('a', log_grant(1)),
|
||||
navigator.locks.request('a', log_grant(2)),
|
||||
navigator.locks.request('a', log_grant(3))
|
||||
]);
|
||||
assert_array_equals(granted, [1, 2, 3]);
|
||||
}, 'Lock requests are granted in order');
|
||||
|
||||
promise_test(async t => {
|
||||
const granted = [];
|
||||
function log_grant(n) { return () => { granted.push(n); }; }
|
||||
|
||||
let inner_promise;
|
||||
await navigator.locks.request('a', async lock => {
|
||||
inner_promise = Promise.all([
|
||||
// This will be blocked.
|
||||
navigator.locks.request('a', log_grant(1)),
|
||||
// But this should be grantable immediately.
|
||||
navigator.locks.request('b', log_grant(2))
|
||||
]);
|
||||
});
|
||||
|
||||
await inner_promise;
|
||||
assert_array_equals(granted, [2, 1]);
|
||||
}, 'Requests for distinct resources can be granted');
|
Loading…
Add table
Add a link
Reference in a new issue