mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
Update web-platform-tests to revision cfada7e6cb379699fa94c7ed8fcb97082327e10c
This commit is contained in:
parent
87e7e3d429
commit
06b00da16b
179 changed files with 6103 additions and 1186 deletions
|
@ -12,28 +12,29 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
promise_test(async t => {
|
||||
const reader = new NFCReader({url: "www.a.com"});
|
||||
function waitSyntaxErrorPromise(t, reader) {
|
||||
const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
|
||||
const promise = readerWatcher.wait_for("error").then(event => {
|
||||
assert_equals(event.error.name, 'SyntaxError');
|
||||
});
|
||||
// NFCReader#start() synchronously dispatches the syntax error event.
|
||||
reader.start();
|
||||
const event = await readerWatcher.wait_for("error");
|
||||
assert_equals(event.error.name, 'SyntaxError');
|
||||
return promise;
|
||||
}
|
||||
|
||||
promise_test(t => {
|
||||
const reader = new NFCReader({url: "www.a.com"});
|
||||
return waitSyntaxErrorPromise(t, reader);
|
||||
}, 'Test that NFCReader.start fails if NFCReaderOptions.url is missing components.');
|
||||
|
||||
promise_test(async t => {
|
||||
promise_test(t => {
|
||||
const reader = new NFCReader({url: "invalid"});
|
||||
const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
|
||||
reader.start();
|
||||
const event = await readerWatcher.wait_for("error");
|
||||
assert_equals(event.error.name, 'SyntaxError');
|
||||
return waitSyntaxErrorPromise(t, reader);
|
||||
}, 'Test that NFCReader.start fails if NFCReaderOptions.url is invalid.');
|
||||
|
||||
promise_test(async t => {
|
||||
promise_test(t => {
|
||||
const reader = new NFCReader({url: "http://a.com"});
|
||||
const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
|
||||
reader.start();
|
||||
const event = await readerWatcher.wait_for("error");
|
||||
assert_equals(event.error.name, 'SyntaxError');
|
||||
return waitSyntaxErrorPromise(t, reader);
|
||||
}, 'Test that NFCReader.start fails if NFCReaderOptions.url has wrong protocol.');
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue