gecko/dom/identity/tests/test_identity_idp_auth_basics.html
Matthew Noorenberghe 06b4273206 Bug 753239 - Implement a DOM component for navigator.id. r=jst
--HG--
extra : rebase_source : 4cd2b33f46c6c884dc9a3ff4820203275a6c5ae9
2012-06-29 16:12:00 -07:00

88 lines
2.7 KiB
HTML

<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<meta charset="utf-8">
<title>Test for navigator.id identity provider (IDP) authentication basics</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript;version=1.8" src="head_identity.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank">navigator.id identity provider (IDP) authentication basics</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript;version=1.8">
"use strict"
let steps = [
// completeAuthentication tests
function completeAuthenticationExists() {
is(typeof(identity.completeAuthentication), "function",
"Check completeAuthentication is a function");
SimpleTest.executeSoon(next);
},
function completeAuthenticationOutsideFlow() {
expectException(function() {
identity.completeAuthentication();
}, "Check completeAuthentication outside of an auth. flow");
SimpleTest.executeSoon(next);
},
// raiseAuthenticationFailure tests
function raiseAuthenticationFailureExists() {
is(typeof(identity.raiseAuthenticationFailure), "function",
"Check raiseAuthenticationFailure is a function");
SimpleTest.executeSoon(next);
},
function raiseAuthenticationFailureNoArgs() {
expectException(function() {
identity.raiseAuthenticationFailure();
}, "raiseAuthenticationFailure with no arguments");
SimpleTest.executeSoon(next);
},
// beginAuthentication tests
function beginAuthenticationExists() {
is(typeof(identity.beginAuthentication), "function",
"Check beginAuthentication is a function");
SimpleTest.executeSoon(next);
},
function beginAuthenticationNoArgs() {
expectException(function() {
identity.beginAuthentication();
}, "beginAuthentication with no arguments");
SimpleTest.executeSoon(next);
},
function beginAuthenticationInvalidArg() {
expectException(function() {
identity.beginAuthentication(999);
}, "beginAuthentication with a non-function argument");
SimpleTest.executeSoon(next);
},
function beginAuthenticationArgs() {
function beginAuthenticationCb() {
throw "beginAuthentication callback shouldn't have been called outside of an "
+ "auth flow";
}
is(identity.beginAuthentication(beginAuthenticationCb), undefined,
"Check minimum beginAuthentication arguments");
SimpleTest.executeSoon(next);
},
finish_tests,
];
SimpleTest.waitForExplicitFinish();
addLoadEvent(next);
</script>
</pre>
</body>
</html>