gecko/dom/media/tests/mochitest/test_getIdentityAssertion.html

86 lines
2.4 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "getIdentityAssertion Tests"
});
var test;
function theTest() {
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.append([
[
"GET_IDENTITY_ASSERTION_FAILS_WITHOUT_PROVIDER",
function(test) {
test.pcLocal._pc.getIdentityAssertion(function(err) {
ok(err, "getIdentityAssertion must fail without provider");
test.next();
});
},
],
[
"GET_IDENTITY_ASSERTION_FIRES_EVENTUALLY_AND_SUBSEQUENTLY",
function(test) {
var fired = 0;
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html', 'nobody');
test.pcLocal._pc.onidentityresult = function() {
fired++;
if (fired == 1) {
ok(true, "identityresult fired");
} else if (fired == 2) {
ok(true, "identityresult fired 2x");
test.next();
}
};
test.pcLocal._pc.getIdentityAssertion();
test.pcLocal._pc.getIdentityAssertion();
}
],
[
"GET_IDENTITY_ASSERTION_FAILS",
function(test) {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error');
test.pcLocal._pc.onidentityresult = function(e) {
ok(false, "Should not get an identity result");
test.next();
};
test.pcLocal._pc.getIdentityAssertion(function(err) {
ok(err, "Got error callback from getIdentityAssertion");
test.next();
});
}
],
[
"GET_IDENTITY_ASSERTION_IDP_NOT_READY",
function(test) {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error:ready');
test.pcLocal._pc.onidentityresult = function(e) {
ok(false, "Should not get an identity result");
test.next();
};
test.pcLocal._pc.getIdentityAssertion(function(err) {
ok(err, "Got error callback from getIdentityAssertion");
test.next();
});
}
]
]);
test.run();
}
runTest(theTest);
</script>
</pre>
</body>
</html>