mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0
This commit is contained in:
parent
1d40075f03
commit
079092dfea
2381 changed files with 90360 additions and 17722 deletions
|
@ -193,19 +193,40 @@ with extension `.worker.js` that imports `testharness.js`. The test can
|
|||
then use all the usual APIs, and can be run from the path to the
|
||||
JavaScript file with the `.js` removed.
|
||||
|
||||
For example, one could write a test for the `Blob` constructor by
|
||||
creating a `FileAPI/Blob-constructor.worker.js` as follows:
|
||||
For example, one could write a test for the `FileReaderSync` API by
|
||||
creating a `FileAPI/FileReaderSync.worker.js` as follows:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
test(function () {
|
||||
var blob = new Blob(["Hello"]);
|
||||
var fr = new FileReaderSync();
|
||||
assert_equals(fr.readAsText(blob), "Hello");
|
||||
}, "FileReaderSync#readAsText.");
|
||||
done();
|
||||
|
||||
This test could then be run from `FileAPI/FileReaderSync.worker`.
|
||||
|
||||
### Multi-global tests
|
||||
|
||||
Tests for features that exist in multiple global scopes can be written in a way
|
||||
that they are automatically run in a window scope as well as a dedicated worker
|
||||
scope.
|
||||
In this case, the test is a JavaScript file with extension `.any.js`.
|
||||
The test can then use all the usual APIs, and can be run from the path to the
|
||||
JavaScript file with the `.js` replaced by `.worker` or `.html`.
|
||||
|
||||
For example, one could write a test for the `Blob` constructor by
|
||||
creating a `FileAPI/Blob-constructor.any.js` as follows:
|
||||
|
||||
test(function () {
|
||||
var blob = new Blob();
|
||||
assert_equals(blob.size, 0);
|
||||
assert_equals(blob.type, "");
|
||||
assert_false(blob.isClosed);
|
||||
}, "The Blob constructor.");
|
||||
done();
|
||||
|
||||
This test could then be run from `FileAPI/Blob-constructor.worker`.
|
||||
This test could then be run from `FileAPI/Blob-constructor.any.worker` as well
|
||||
as `FileAPI/Blob-constructor.any.html`.
|
||||
|
||||
### Tests Involving Multiple Origins
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue