[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and...
[WebKit-https.git] / LayoutTests / credentials / idlharness.html
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/WebIDLParser.js"></script>
5 <script src="../resources/idlharness.js"></script>
6
7 <h1>idlharness test</h1>
8 <p>This test validates the WebIDL included in the Credential Management API.</p>
9
10 <script type="text/plain" class="untested-idl">
11 interface Window {};
12 </script>
13
14 <script type="text/plain" class="idl">
15 // 3.1.1 Credential
16
17 dictionary CredentialData {
18   required USVString id;
19 };
20
21 [SecureContext] interface Credential {
22   readonly attribute USVString id;
23   readonly attribute DOMString type;
24 };
25
26 // No Transferable at this moment
27 // Credential implements Transferable;
28
29 dictionary SiteBoundCredentialData : CredentialData {
30   USVString name;
31   USVString iconURL;
32 };
33
34 [SecureContext] interface SiteBoundCredential : Credential {
35   readonly attribute USVString name;
36   readonly attribute USVString iconURL;
37 };
38
39 // 3.1.3 PasswordCredential
40
41 dictionary PasswordCredentialData : SiteBoundCredentialData {
42   required USVString password;
43 };
44
45 typedef (FormData or URLSearchParams) CredentialBodyType;
46
47 [Constructor(PasswordCredentialData data),
48  Constructor(HTMLFormElement form),
49  Exposed=Window,
50  SecureContext]
51 interface PasswordCredential : SiteBoundCredential {
52   attribute USVString idName;
53   attribute USVString passwordName;
54
55   attribute CredentialBodyType? additionalData;
56 };
57
58 </script>
59
60 <script>
61 function select(selector) {
62   return [].slice.call(document.querySelectorAll(selector))
63     .map(function(e) { return e.textContent; })
64     .join('\n\n');
65 }
66
67 var idl = select('.idl')
68 var untested = select('.untested-idl');
69 var idl_array = new IdlArray();
70 idl_array.add_untested_idls(untested);
71 idl_array.add_idls(idl);
72 idl_array.add_objects({
73   PasswordCredential: ['new PasswordCredential({ password: "12345", id: "12345" })'],
74 });
75 idl_array.test();
76 </script>