blob: fe97fe6b342de0ff0528a30bcaf17d5de235273a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests the RTCPeerConnection Ice functionality.");
var pc = null;
var iceCandidate = null;
function onIceChange2()
{
if (pc.iceConnectionState === "closed") {
testPassed("iceConnectionState is closed.");
finishJSTest();
}
}
function addIceCandidateSuccess()
{
testPassed("addIceCandidateSuccess was called.");
pc.oniceconnectionstatechange = onIceChange2;
pc.close();
}
function addIceCandidateFailure()
{
testFailed("addIceCandidateFailue was called.");
finishJSTest();
}
function onIceChange1()
{
if (pc.iceConnectionState === "completed") {
testPassed("iceConnectionState is completed");
iceCandidate = new RTCIceCandidate({candidate:"nano nano"});
shouldThrow('pc.addIceCandidate(null, null, null);');
shouldThrow('pc.addIceCandidate(iceCandidate, null, null);');
shouldThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, null);');
shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, addIceCandidateFailure);');
}
}
shouldNotThrow("pc = new RTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});");
pc.oniceconnectionstatechange = onIceChange1;
window.jsTestIsAsync = true;
window.successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>