| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script> | 7 <script> |
| 8 description("Tests the RTCPeerConnection Ice functionality."); | 8 description("Tests the RTCPeerConnection Ice functionality."); |
| 9 | 9 |
| 10 var pc = null; | 10 var pc = null; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 function unexpectedCallback() | 28 function unexpectedCallback() |
| 29 { | 29 { |
| 30 testFailed("unexpectedCallback was called."); | 30 testFailed("unexpectedCallback was called."); |
| 31 finishJSTest(); | 31 finishJSTest(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 function expectedTypeError(error) | 34 function expectedTypeError(error) |
| 35 { | 35 { |
| 36 shouldBe(error.name, "TypeError") | 36 window.error = error; |
| 37 testPassed("expectedTypeError was called.") | 37 shouldBe('error.name', '"TypeError"'); |
| 38 testPassed("expectedTypeError was called."); |
| 38 } | 39 } |
| 39 | 40 |
| 40 function onIceChange1() | 41 function onIceChange1() |
| 41 { | 42 { |
| 42 if (pc.iceConnectionState === "completed") { | 43 if (pc.iceConnectionState === "completed") { |
| 43 testPassed("iceConnectionState is completed"); | 44 testPassed("iceConnectionState is completed"); |
| 44 iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); | 45 iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
| 45 shouldNotThrow('pc.addIceCandidate(null, addIceCandidateSuccess, unexpec
tedCallback).catch(expectedTypeError);'); | 46 shouldNotThrow('pc.addIceCandidate(null, addIceCandidateSuccess, unexpec
tedCallback).catch(expectedTypeError);'); |
| 46 shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallbac
k).catch(expectedTypeError);'); | 47 shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallbac
k).catch(expectedTypeError);'); |
| 47 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess,
null).catch(expectedTypeError);'); | 48 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess,
null).catch(expectedTypeError);'); |
| 48 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess,
unexpectedCallback);'); | 49 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess,
unexpectedCallback);'); |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 | 52 |
| 52 function testExecutionOrderClosedConnection() | 53 function testExecutionOrderClosedConnection() |
| 53 { | 54 { |
| 54 var localPeerConnection = new webkitRTCPeerConnection(null, null); | 55 var localPeerConnection = new webkitRTCPeerConnection(null, null); |
| 55 localPeerConnection.close(); | 56 localPeerConnection.close(); |
| 56 var counter = 0; | 57 var counter = 0; |
| 57 events = []; | 58 window.events = []; |
| 58 Promise.resolve().then(_ => events[counter++] = 1); | 59 Promise.resolve().then(_ => events[counter++] = 1); |
| 59 var iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); | 60 var iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
| 60 localPeerConnection.addIceCandidate(iceCandidate, unexpectedCallback, (error
) => { | 61 localPeerConnection.addIceCandidate(iceCandidate, unexpectedCallback, error
=> { |
| 61 window.error = error; | 62 window.error = error; |
| 62 shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\
'."'); | 63 shouldBe('error.name', '"InvalidStateError"'); |
| 64 shouldBe('error.toString()', '"InvalidStateError: The RTCPeerConnection\
's signalingState is \'closed\'."'); |
| 63 events[counter++] = 2; | 65 events[counter++] = 2; |
| 64 }); | 66 }); |
| 65 Promise.resolve().then(_ => { | 67 Promise.resolve().then(_ => { |
| 66 events[counter++] = 3; | 68 events[counter++] = 3; |
| 67 shouldBe('events', '[1,2,3]'); | 69 shouldBe('events', '[1,2,3]'); |
| 68 }); | 70 }); |
| 69 } | 71 } |
| 70 | 72 |
| 71 shouldNotThrow('testExecutionOrderClosedConnection()'); | 73 shouldNotThrow('testExecutionOrderClosedConnection()'); |
| 72 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); | 74 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); |
| 73 pc.oniceconnectionstatechange = onIceChange1; | 75 pc.oniceconnectionstatechange = onIceChange1; |
| 74 | 76 |
| 75 window.jsTestIsAsync = true; | 77 window.jsTestIsAsync = true; |
| 76 window.successfullyParsed = true; | 78 window.successfullyParsed = true; |
| 77 </script> | 79 </script> |
| 78 </body> | 80 </body> |
| 79 </html> | 81 </html> |
| OLD | NEW |