2013-03-30 00:30:16 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
2014-06-13 18:56:00 +04:00
|
|
|
<script type="application/javascript" src="pc.js"></script>
|
2013-03-30 00:30:16 +04:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
createHTML({
|
|
|
|
bug: "834270",
|
|
|
|
title: "Align PeerConnection error handling with WebRTC specification"
|
|
|
|
});
|
|
|
|
|
2014-12-08 19:28:52 +03:00
|
|
|
function validateReason(reason) {
|
|
|
|
ok(reason.name.length, "Reason name = " + reason.name);
|
|
|
|
ok(reason.message.length, "Reason message = " + reason.message);
|
2013-03-30 00:30:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
function testCreateAnswerError() {
|
2015-09-28 21:25:04 +03:00
|
|
|
var pc = new RTCPeerConnection();
|
2014-12-08 19:28:52 +03:00
|
|
|
info ("Testing createAnswer error");
|
|
|
|
return pc.createAnswer()
|
|
|
|
.then(generateErrorCallback("createAnswer before offer should fail"),
|
|
|
|
validateReason);
|
2013-03-30 00:30:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
function testSetLocalDescriptionError() {
|
2015-09-28 21:25:04 +03:00
|
|
|
var pc = new RTCPeerConnection();
|
2014-12-08 19:28:52 +03:00
|
|
|
info ("Testing setLocalDescription error");
|
2015-09-28 21:25:04 +03:00
|
|
|
return pc.setLocalDescription(new RTCSessionDescription({ sdp: "Picklechips!",
|
2014-12-08 19:28:52 +03:00
|
|
|
type: "offer" }))
|
|
|
|
.then(generateErrorCallback("setLocalDescription with nonsense SDP should fail"),
|
|
|
|
validateReason);
|
2013-03-30 00:30:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
function testSetRemoteDescriptionError() {
|
2015-09-28 21:25:04 +03:00
|
|
|
var pc = new RTCPeerConnection();
|
2014-12-08 19:28:52 +03:00
|
|
|
info ("Testing setRemoteDescription error");
|
2015-09-28 21:25:04 +03:00
|
|
|
return pc.setRemoteDescription(new RTCSessionDescription({ sdp: "Who?",
|
2014-12-08 19:28:52 +03:00
|
|
|
type: "offer" }))
|
|
|
|
.then(generateErrorCallback("setRemoteDescription with nonsense SDP should fail"),
|
|
|
|
validateReason);
|
2013-03-30 00:30:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// No test for createOffer errors -- there's nothing we can do at this
|
|
|
|
// level to evoke an error in createOffer.
|
|
|
|
|
2014-06-13 18:56:00 +04:00
|
|
|
runNetworkTest(function () {
|
2014-12-08 19:28:52 +03:00
|
|
|
testCreateAnswerError()
|
|
|
|
.then(testSetLocalDescriptionError)
|
|
|
|
.then(testSetRemoteDescriptionError)
|
|
|
|
.catch(reason => ok(false, "unexpected error: " + reason))
|
|
|
|
.then(networkTestFinished);
|
2013-05-02 21:33:15 +04:00
|
|
|
});
|
2014-12-08 19:28:52 +03:00
|
|
|
|
2013-03-30 00:30:16 +04:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|