| 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 requestSucceeded1() | |
| 26 { | |
| 27 testPassed('requestSucceeded was called.'); | |
| 28 | |
| 29 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); | |
| 30 shouldNotThrow('pc.setRemoteDescription(sessionDescription, unexpectedCallba
ck, requestFailed2);'); | |
| 31 } | |
| 32 | |
| 33 function unexpectedCallback() | |
| 34 { | |
| 35 testFailed('unexpectedCallback was called.'); | |
| 36 finishJSTest(); | |
| 37 } | |
| 38 | |
| 39 function expectedTypeError(error) | |
| 40 { | |
| 41 window.error = error; | |
| 42 shouldBe('error.name', '"TypeError"'); | |
| 43 testPassed('expectedTypeError was called.'); | |
| 44 } | |
| 45 | |
| 46 function expectedInvalidSessionDescription(error) | |
| 47 { | |
| 48 window.error = error; | |
| 49 shouldBe('error.name', '"OperationError"'); | |
| 50 testPassed('expectedInvalidSessionDescription was called.'); | |
| 51 } | |
| 52 | |
| 53 function testExecutionOrderClosedConnection() | |
| 54 { | |
| 55 var localPeerConnection = new webkitRTCPeerConnection(null, null); | |
| 56 localPeerConnection.close(); | |
| 57 var counter = 0; | |
| 58 window.events = []; | |
| 59 Promise.resolve().then(_ => events[counter++] = 1); | |
| 60 var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remo
te"}); | |
| 61 localPeerConnection.setRemoteDescription(sessionDescription, unexpectedCallb
ack, error => { | |
| 62 window.error = error; | |
| 63 shouldBe('error.name', '"InvalidStateError"'); | |
| 64 shouldBe('error.toString()', '"InvalidStateError: The RTCPeerConnection\
's signalingState is \'closed\'."'); | |
| 65 events[counter++] = 2; | |
| 66 }); | |
| 67 Promise.resolve().then(_ => { | |
| 68 events[counter++] = 3; | |
| 69 shouldBe('events', '[1,2,3]'); | |
| 70 }); | |
| 71 } | |
| 72 | |
| 73 shouldNotThrow('testExecutionOrderClosedConnection()'); | |
| 74 pc = new webkitRTCPeerConnection(null, null); | |
| 75 shouldNotThrow('pc.setRemoteDescription().catch(expectedTypeError)'); | |
| 76 shouldNotThrow('pc.setRemoteDescription(null).catch(expectedInvalidSessionDescri
ption)'); | |
| 77 var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}
); | |
| 78 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, u
nexpectedCallback);'); | |
| 79 | |
| 80 window.jsTestIsAsync = true; | |
| 81 window.successfullyParsed = true; | |
| 82 </script> | |
| 83 </body> | |
| 84 </html> | |
| OLD | NEW |