Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / credentialmanager / federatedcredential-basics.html
blob30eba952007870ef9e138dbc09726c6f63708467
1 <!DOCTYPE html>
2 <title>Credential Manager: FederatedCredential basics.</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="/serviceworker/resources/interfaces.js"></script>
6 <script>
7 test(function() {
8 var credential = new FederatedCredential({
9 'id': 'id',
10 'provider': 'https://federation.test/',
11 'name': 'name',
12 'iconURL': 'https://example.test/icon.png'
13 });
15 assert_true(credential instanceof Credential);
16 assert_true(credential instanceof FederatedCredential);
18 verify_interface('FederatedCredential', credential, {
19 id: 'string',
20 name: 'string',
21 iconURL: 'string',
22 provider: 'string',
23 type: 'string'
24 });
26 assert_equals(credential.id, 'id');
27 assert_equals(credential.name, 'name');
28 assert_equals(credential.iconURL, 'https://example.test/icon.png');
29 assert_equals(credential.provider, 'https://federation.test/');
30 assert_equals(credential.type, 'federated');
31 }, 'Interfaces and attributes of FederatedCredential');
33 test(function() {
34 var credential = new FederatedCredential({
35 'id': 'id',
36 'provider': 'https://federation.test/',
37 'name': 'name'
38 });
40 assert_equals(credential.id, 'id');
41 assert_equals(credential.name, 'name');
42 assert_equals(credential.iconURL, '');
43 assert_equals(credential.provider, 'https://federation.test/');
44 assert_equals(credential.type, 'federated');
45 }, 'Interfaces and attributes of FederatedCredential');
47 test(function() {
48 var credential = new FederatedCredential({
49 'id': 'id',
50 'provider': 'https://federation.test/',
51 });
53 assert_equals(credential.id, 'id');
54 assert_equals(credential.name, '');
55 assert_equals(credential.iconURL, '');
56 assert_equals(credential.provider, 'https://federation.test/');
57 assert_equals(credential.type, 'federated');
58 }, 'Interfaces and attributes of FederatedCredential');
60 test(function() {
61 assert_throws(new SyntaxError(), function () {
62 var credential = new FederatedCredential({
63 'id': 'id',
64 'provider': 'https://federation.test/',
65 'name': 'name',
66 'iconURL': '-'
67 });
68 });
69 }, 'Construct a FederatedCredential with an invalid Icon URL.');
71 test(function() {
72 assert_throws(new SyntaxError(), function () {
73 var credential = new FederatedCredential({
74 'id': 'id',
75 'provider': '-',
76 'name': 'name',
77 'iconURL': 'https://example.test/icon.png'
78 });
79 });
80 }, 'Construct a FederatedCredential with an invalid federation URL.');
81 </script>