Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 5 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="application/javascript" src="head.js"></script> |
michael@0 | 7 | </head> |
michael@0 | 8 | <body> |
michael@0 | 9 | <pre id="test"> |
michael@0 | 10 | <script type="application/javascript"> |
michael@0 | 11 | createHTML({ |
michael@0 | 12 | bug: "834270", |
michael@0 | 13 | title: "Align PeerConnection error handling with WebRTC specification" |
michael@0 | 14 | }); |
michael@0 | 15 | |
michael@0 | 16 | function errorCallback(nextStep) { |
michael@0 | 17 | return function (err) { |
michael@0 | 18 | ok(err, "Error is set"); |
michael@0 | 19 | ok(err.name && err.name.length, "Error name = " + err.name); |
michael@0 | 20 | ok(err.message && err.message.length, "Error message = " + err.message); |
michael@0 | 21 | nextStep(); |
michael@0 | 22 | } |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | function testCreateAnswerError() { |
michael@0 | 26 | var pc = new mozRTCPeerConnection(); |
michael@0 | 27 | info ("Testing createAnswer error callback"); |
michael@0 | 28 | pc.createAnswer(generateErrorCallback("createAnswer before offer should fail"), |
michael@0 | 29 | errorCallback(testSetLocalDescriptionError)); |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | function testSetLocalDescriptionError() { |
michael@0 | 33 | var pc = new mozRTCPeerConnection(); |
michael@0 | 34 | info ("Testing setLocalDescription error callback"); |
michael@0 | 35 | pc.setLocalDescription(new mozRTCSessionDescription({ sdp: "Picklechips!", |
michael@0 | 36 | type: "offer" }), |
michael@0 | 37 | generateErrorCallback("setLocalDescription with nonsense SDP should fail"), |
michael@0 | 38 | errorCallback(testSetRemoteDescriptionError)); |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | function testSetRemoteDescriptionError() { |
michael@0 | 42 | var pc = new mozRTCPeerConnection(); |
michael@0 | 43 | info ("Testing setRemoteDescription error callback"); |
michael@0 | 44 | pc.setRemoteDescription(new mozRTCSessionDescription({ sdp: "Who?", |
michael@0 | 45 | type: "offer" }), |
michael@0 | 46 | generateErrorCallback("setRemoteDescription with nonsense SDP should fail"), |
michael@0 | 47 | errorCallback(testAddIceCandidateError)); |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | function testAddIceCandidateError() { |
michael@0 | 51 | var pc = new mozRTCPeerConnection(); |
michael@0 | 52 | info ("Testing addIceCandidate error callback"); |
michael@0 | 53 | pc.addIceCandidate(new mozRTCIceCandidate({ candidate: "Pony Lords, jump!", |
michael@0 | 54 | sdpMid: "whee", |
michael@0 | 55 | sdpMLineIndex: 1 }), |
michael@0 | 56 | generateErrorCallback("addIceCandidate with nonsense candidate should fail"), |
michael@0 | 57 | errorCallback(SimpleTest.finish)); |
michael@0 | 58 | }; |
michael@0 | 59 | |
michael@0 | 60 | // No test for createOffer errors -- there's nothing we can do at this |
michael@0 | 61 | // level to evoke an error in createOffer. |
michael@0 | 62 | |
michael@0 | 63 | runTest(function () { |
michael@0 | 64 | testCreateAnswerError(); |
michael@0 | 65 | }); |
michael@0 | 66 | </script> |
michael@0 | 67 | </pre> |
michael@0 | 68 | </body> |
michael@0 | 69 | </html> |