Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / credentialmanager / credentialscontainer-store-basics.html
blob19392daaa4672a51299ffe1d6d4165db1977ba2e
1 <!DOCTYPE html>
2 <title>Credential Manager: store() basics.</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script>
6 function stubResolverChecker(c) {
7 assert_equals(c, undefined, "FIXME: We're currently always returning 'undefined'.");
8 this.done();
11 function stubRejectionChecker(reason) {
12 assert_unreached("store() should not reject, but did: " + reason.name);
15 var local = new PasswordCredential({
16 id: 'id',
17 password: 'pencil',
18 name: 'name',
19 iconURL: 'https://example.com/icon.png'
20 });
22 var federated = new FederatedCredential({
23 id: 'id',
24 provider: 'https://federation.test/',
25 name: 'name',
26 iconURL: 'https://example.test/icon.png'
27 });
29 async_test(function () {
30 navigator.credentials.store().then(
31 this.step_func(function () { assert_unreached("store() should reject."); }),
32 this.step_func(function (reason) {
33 assert_equals(reason.name, "TypeError");
34 this.done();
35 }));
36 }, "Verify the basics of store(): PasswordCredential.");
38 async_test(function () {
39 navigator.credentials.store("not a credential").then(
40 this.step_func(function () { assert_unreached("store([string]) should reject."); }),
41 this.step_func(function (reason) {
42 assert_equals(reason.name, "TypeError");
43 this.done();
44 }));
45 }, "Verify the basics of store(): PasswordCredential.");
47 async_test(function () {
48 navigator.credentials.store(local).then(
49 this.step_func(stubResolverChecker.bind(this)),
50 this.step_func(stubRejectionChecker.bind(this)));
51 }, "Verify the basics of store(): PasswordCredential.");
53 async_test(function () {
54 navigator.credentials.store(federated).then(
55 this.step_func(stubResolverChecker.bind(this)),
56 this.step_func(stubRejectionChecker.bind(this)));
57 }, "Verify the basics of store(): FederatedCredential.");
58 </script>