2 <!-- Any copyright is dedicated to the Public Domain.
3 - http://creativecommons.org/publicdomain/zero/1.0/ -->
7 <title>Test for navigator.id identity provider (IDP) authentication basics
</title>
8 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <script type=
"application/javascript;version=1.8" src=
"head_identity.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 <a target=
"_blank">navigator.id identity provider (IDP) authentication basics
</a>
15 <div id=
"content" style=
"display: none">
19 <script type=
"application/javascript;version=1.8">
24 // completeAuthentication tests
25 function completeAuthenticationExists() {
26 is(typeof(identity.completeAuthentication),
"function",
27 "Check completeAuthentication is a function");
28 SimpleTest.executeSoon(next);
30 function completeAuthenticationOutsideFlow() {
31 expectException(function() {
32 identity.completeAuthentication();
33 },
"Check completeAuthentication outside of an auth. flow");
34 SimpleTest.executeSoon(next);
37 // raiseAuthenticationFailure tests
38 function raiseAuthenticationFailureExists() {
39 is(typeof(identity.raiseAuthenticationFailure),
"function",
40 "Check raiseAuthenticationFailure is a function");
41 SimpleTest.executeSoon(next);
43 function raiseAuthenticationFailureNoArgs() {
44 expectException(function() {
45 identity.raiseAuthenticationFailure();
46 },
"raiseAuthenticationFailure with no arguments");
47 SimpleTest.executeSoon(next);
50 // beginAuthentication tests
51 function beginAuthenticationExists() {
52 is(typeof(identity.beginAuthentication),
"function",
53 "Check beginAuthentication is a function");
54 SimpleTest.executeSoon(next);
56 function beginAuthenticationNoArgs() {
57 expectException(function() {
58 identity.beginAuthentication();
59 },
"beginAuthentication with no arguments");
60 SimpleTest.executeSoon(next);
62 function beginAuthenticationInvalidArg() {
63 expectException(function() {
64 identity.beginAuthentication(
999);
65 },
"beginAuthentication with a non-function argument");
66 SimpleTest.executeSoon(next);
68 function beginAuthenticationArgs() {
69 function beginAuthenticationCb() {
70 throw
"beginAuthentication callback shouldn't have been called outside of an "
73 is(identity.beginAuthentication(beginAuthenticationCb), undefined,
74 "Check minimum beginAuthentication arguments");
75 SimpleTest.executeSoon(next);
81 SimpleTest.waitForExplicitFinish();