Update web-platform-tests to revision fc33be9acfbf8e883fd9683c527aab22d842542b

This commit is contained in:
WPT Sync Bot 2018-03-30 21:21:31 -04:00
parent d232705106
commit 09b1413275
32 changed files with 1112 additions and 577 deletions

View file

@ -0,0 +1,30 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('/resources/WebIDLParser.js', '/resources/idlharness.js');
}
// https://w3c.github.io/webauthn/
promise_test(async () => {
const webauthnIdl = await fetch('/interfaces/webauthn.idl').then(r => r.text());
const idlArray = new IdlArray();
idlArray.add_idls(webauthnIdl);
// static IDL tests
idlArray.add_untested_idls('interface CredentialCreationOptions {};');
idlArray.add_untested_idls('interface CredentialRequestOptions {};');
idlArray.add_untested_idls("interface Navigator { };");
// TODO: change to "tested" for real browsers?
idlArray.add_untested_idls("partial interface Navigator { readonly attribute WebAuthentication authentication; };");
idlArray.add_objects({
WebAuthentication: ["navigator.authentication"]
});
idlArray.test();
done();
}, 'WebAuthn interfaces.');

View file

@ -1,60 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>WebAuthn WebIDL Tests</title>
<link rel="author" title="Adam Powers" href="mailto:adam@fidoalliance.org">
<link rel="help" href="https://w3c.github.io/webauthn/#iface-credential">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src=helpers.js></script>
<!-- for testing WebIDL -->
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<body></body>
<script>
standardSetup(function() {
"use strict";
// loads an IDL file from the webserver
function fetchIdl(idlUrl) {
return new Promise(function(resolve, reject) {
if (typeof idlUrl !== "string") {
return reject("fetchIdl: expected argument to be URL string");
}
var request = new XMLHttpRequest();
request.open("GET", idlUrl);
request.send();
request.onload = function() {
var idls = request.responseText;
return resolve(idls);
};
});
}
// this does the real work of running the IDL tests
function runIdlTests(idls) {
return new Promise(function(resolve, reject) {
var idlArray = new window.IdlArray();
// static IDL tests
idlArray.add_untested_idls("interface Navigator { };");
// TODO: change to "tested" for real browsers?
idlArray.add_untested_idls("partial interface Navigator { readonly attribute WebAuthentication authentication; };");
idlArray.add_objects({
WebAuthentication: ["navigator.authentication"]
});
// run test WebIDL tests loaded from the idls file
idlArray.add_idls(idls);
return resolve(idlArray.test());
});
}
// test harness function
window.promise_test(function() {
return fetchIdl("/interfaces/webauthn.idl") // load the IDL file ...
.then(function(idls) {
return runIdlTests(idls); // ... then run the tests.
});
}, "Validate WebAuthn IDL");
});
</script>