gecko/dom/media/tests/identity/test_peerConnection_peerIdentity.html
2014-05-15 18:41:00 +02:00

92 lines
2.5 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<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="../mochitest/head.js"></script>
<script type="application/javascript" src="../mochitest/pc.js"></script>
<script type="application/javascript" src="../mochitest/templates.js"></script>
<script type="application/javascript" src="../mochitest/blacksilence.js"></script>
<script type="application/javascript" src="../mochitest/turnConfig.js"></script>
</head>
<body>
<div id="display"></div>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "setIdentityProvider leads to peerIdentity and assertions in SDP"
});
var test;
function theTest() {
var id1 = 'someone@test1.example.com';
var id2 = 'someone@test2.example.com';
test = new PeerConnectionTest({
config_local: {
peerIdentity: id2
},
config_remote: {
peerIdentity: id1
}
});
test.setMediaConstraints([{
audio: true,
peerIdentity: id2
}, {
video: true,
peerIdentity: id2
}], [{
audio: true,
fake: true,
peerIdentity: id1
}, {
video: true,
fake: true,
peerIdentity: id1
}]);
test.setIdentityProvider(test.pcLocal, 'test1.example.com', 'idp.html');
test.setIdentityProvider(test.pcRemote, 'test2.example.com', 'idp.html');
test.chain.append([
[
"PEER_IDENTITY_IS_SET_CORRECTLY",
function(test) {
// no need to wait to check identity in this case,
// setRemoteDescription should wait for the IdP to complete
function checkIdentity(pc, pfx, idp, name) {
is(pc.peerIdentity.idp, idp, pfx + "IdP is correct");
is(pc.peerIdentity.name, name + "@" + idp, pfx + "identity is correct");
}
checkIdentity(test.pcLocal._pc, "local: ", "test2.example.com", "someone");
checkIdentity(test.pcRemote._pc, "remote: ", "test1.example.com", "someone");
test.next();
}
],
[
"REMOTE_STREAMS_ARE_RESTRICTED",
function(test) {
var remoteStream = test.pcLocal._pc.getRemoteStreams()[0];
var oneDone = false;
function done() {
if (!oneDone) {
oneDone = true;
return;
}
test.next();
}
audioIsSilence(true, remoteStream, done);
videoIsBlack(true, remoteStream, done);
}
],
]);
test.run();
}
runTest(theTest);
</script>
</pre>
</body>
</html>