| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <script> | |
| 8 description("Tests RTCPeerConnection remoteDescription."); | |
| 9 | |
| 10 var pc = null; | |
| 11 | |
| 12 function requestFailed2() | |
| 13 { | |
| 14 testPassed('requestFailed was called.'); | |
| 15 | |
| 16 shouldBeEqualToString('pc.remoteDescription.type', "answer"); | |
| 17 shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); | |
| 18 pc.close(); | |
| 19 shouldBeEqualToString('pc.remoteDescription.type', "answer"); | |
| 20 shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); | |
| 21 | |
| 22 finishJSTest(); | |
| 23 } | |
| 24 | |
| 25 function requestSucceeded2() | |
| 26 { | |
| 27 testFailed('requestSucceeded was called.'); | |
| 28 finishJSTest(); | |
| 29 } | |
| 30 | |
| 31 function requestFailed1() | |
| 32 { | |
| 33 testFailed('requestFailed was called.'); | |
| 34 finishJSTest(); | |
| 35 } | |
| 36 | |
| 37 function requestSucceeded1() | |
| 38 { | |
| 39 testPassed('requestSucceeded was called.'); | |
| 40 | |
| 41 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); | |
| 42 shouldNotThrow('pc.setRemoteDescription(sessionDescription).then(requestSucc
eeded2, requestFailed2);'); | |
| 43 } | |
| 44 | |
| 45 function expectedTypeError(error) | |
| 46 { | |
| 47 window.error = error; | |
| 48 shouldBe('error.name', '"TypeError"') | |
| 49 testPassed('expectedTypeError was called.') | |
| 50 } | |
| 51 | |
| 52 function expectedInvalidSessionDescription(error) | |
| 53 { | |
| 54 window.error = error; | |
| 55 shouldBe('error.name', '"OperationError"') | |
| 56 testPassed('expectedInvalidSessionDescription was called.') | |
| 57 } | |
| 58 | |
| 59 pc = new webkitRTCPeerConnection(null, null); | |
| 60 shouldNotThrow('pc.setRemoteDescription().catch(expectedTypeError)'); | |
| 61 shouldNotThrow('pc.setRemoteDescription(null).catch(expectedInvalidSessionDescri
ption)'); | |
| 62 var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}
); | |
| 63 shouldNotThrow('pc.setRemoteDescription(sessionDescription).then(requestSucceede
d1, requestFailed1);'); | |
| 64 | |
| 65 window.jsTestIsAsync = true; | |
| 66 window.successfullyParsed = true; | |
| 67 </script> | |
| 68 </body> | |
| 69 </html> | |
| OLD | NEW |