mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -0,0 +1,71 @@
|
|||
// META: script=helpers.js
|
||||
// META: script=/resources/testdriver.js
|
||||
// META: script=/resources/testdriver-vendor.js
|
||||
'use strict';
|
||||
|
||||
// Document-level test config flags:
|
||||
//
|
||||
// testPrefix: Prefix each test case with an indicator so we know what context
|
||||
// they are run in if they are used in multiple iframes.
|
||||
const {testPrefix} = processQueryParams();
|
||||
|
||||
// Common tests to run in all frames.
|
||||
test(() => {
|
||||
assert_not_equals(document.requestStorageAccess, undefined);
|
||||
}, "[" + testPrefix + "] document.requestStorageAccess() should exist on the document interface");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects_dom(t, "NotAllowedError", document.requestStorageAccess(),
|
||||
"document.requestStorageAccess() call without user gesture");
|
||||
}, "[" + testPrefix + "] document.requestStorageAccess() should be rejected with a NotAllowedError by default with no user gesture");
|
||||
|
||||
promise_test(
|
||||
async () => {
|
||||
await test_driver.set_permission(
|
||||
{name: 'storage-access'}, 'granted');
|
||||
|
||||
const {promise} = await RunCallbackWithGesture('b1', () => document.requestStorageAccess());
|
||||
await promise;
|
||||
|
||||
// Cleanup
|
||||
await test_driver.set_permission(
|
||||
{name: 'storage-access'}, 'prompt');
|
||||
},
|
||||
'[' + testPrefix +
|
||||
'] document.requestStorageAccess() should be resolved when called properly with a user gesture');
|
||||
|
||||
if (testPrefix == 'cross-origin-frame' || testPrefix == 'nested-cross-origin-frame') {
|
||||
promise_test(
|
||||
async t => {
|
||||
await test_driver.set_permission(
|
||||
{name: 'storage-access'}, 'prompt');
|
||||
|
||||
const {promise} = RunCallbackWithGesture('b2', () => {
|
||||
return promise_rejects_dom(t, "NotAllowedError", document.requestStorageAccess(),
|
||||
"document.requestStorageAccess() call without permission");
|
||||
});
|
||||
|
||||
await promise;
|
||||
},
|
||||
'[' + testPrefix +
|
||||
'] document.requestStorageAccess() should be rejected with a NotAllowedError without permission grant');
|
||||
|
||||
promise_test(
|
||||
async t => {
|
||||
await test_driver.set_permission(
|
||||
{name: 'storage-access'}, 'denied');
|
||||
|
||||
const {promise} = RunCallbackWithGesture('b3', () => {
|
||||
return promise_rejects_dom(t, "NotAllowedError", document.requestStorageAccess(),
|
||||
"document.requestStorageAccess() call without permission");
|
||||
});
|
||||
|
||||
await promise;
|
||||
|
||||
// Cleanup
|
||||
await test_driver.set_permission(
|
||||
{name: 'storage-access'}, 'prompt');
|
||||
},
|
||||
'[' + testPrefix +
|
||||
'] document.requestStorageAccess() should be rejected with a NotAllowedError with denied permission');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue