mirror of
https://github.com/servo/servo.git
synced 2025-08-28 00:28:20 +01:00
Update web-platform-tests to revision 2dda7b8c10c7566fa6167a32b09c85d51baf2a85
This commit is contained in:
parent
25ebde78aa
commit
8edc7686ef
129 changed files with 5280 additions and 820 deletions
|
@ -0,0 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>TestDriver bless method</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script>
|
||||
promise_test(() => {
|
||||
return test_driver.bless('empty', () => {});
|
||||
}, 'functions in the absence of a `body` element');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
// At the time of this writing, the only standard requirement for user
|
||||
// activation concerns the interaction between iframe elements and their parent
|
||||
// browsing contexts [1]. Because testdriver.js currently cannot operate within
|
||||
// an iframe, the standard requirement cannot be used to verify the correctness
|
||||
// of the `bless` method. Instead, rely on the non-standard restriction on
|
||||
// unattended media playback. Browsers which do not implement such a
|
||||
// restriction will pass this test spuriously.
|
||||
//
|
||||
// [1] https://html.spec.whatwg.org/multipage/origin.html#attr-iframe-sandbox-allow-top-navigation-by-user-activation
|
||||
promise_test(() => {
|
||||
const video = document.createElement('video');
|
||||
video.setAttribute('src', '/media/counting.ogv');
|
||||
document.body.appendChild(video);
|
||||
return test_driver.bless('start video playback', () => video.play())
|
||||
}, 'user activation');
|
||||
|
||||
promise_test(() => {
|
||||
return test_driver.bless('demonstrates return value without action')
|
||||
.then((value) => {
|
||||
assert_equals(value, undefined);
|
||||
});
|
||||
}, 'no action function provided');
|
||||
|
||||
promise_test(() => {
|
||||
const expectedValue = {};
|
||||
|
||||
return test_driver.bless('demonstrate a synchronous return value', () => {
|
||||
return expectedValue;
|
||||
}).then((actualValue) => {
|
||||
assert_equals(
|
||||
actualValue,
|
||||
expectedValue,
|
||||
'the promise should be fulfilled with the returned value'
|
||||
);
|
||||
});
|
||||
|
||||
}, 'synchronous return value');
|
||||
|
||||
promise_test(() => {
|
||||
const expectedError = new Error();
|
||||
|
||||
return test_driver.bless('demonstrates a synchronous error', () => {
|
||||
throw expectedError;
|
||||
})
|
||||
.then(() => {
|
||||
assert_unreached('the promise should be rejected');
|
||||
}, (actualError) => {
|
||||
assert_equals(
|
||||
actualError,
|
||||
expectedError,
|
||||
'the promise should be rejected with the thrown value'
|
||||
);
|
||||
});
|
||||
}, 'synchronous error');
|
||||
|
||||
promise_test(() => {
|
||||
const expectedValue = {};
|
||||
|
||||
return test_driver.bless('demonstrate an asynchronous return value', () => {
|
||||
return Promise.resolve(expectedValue);
|
||||
}).then((actualValue) => {
|
||||
assert_equals(
|
||||
actualValue,
|
||||
expectedValue,
|
||||
'the promise should be fulfilled with the fulfillment value'
|
||||
);
|
||||
});
|
||||
|
||||
}, 'asynchronous return value');
|
||||
|
||||
promise_test(() => {
|
||||
const expectedError = new Error();
|
||||
|
||||
return test_driver.bless('demonstrates an asynchronous error', () => {
|
||||
return Promise.reject(expectedError);
|
||||
})
|
||||
.then(() => {
|
||||
assert_unreached('the promise should be rejected');
|
||||
}, (actualError) => {
|
||||
assert_equals(
|
||||
actualError,
|
||||
expectedError,
|
||||
'the promise should be rejected with the rejected value'
|
||||
);
|
||||
});
|
||||
}, 'asynchronous error');
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue