Chromium Code Reviews| 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; |
| 11 var iceCandidate = null; | 11 var iceCandidate = null; |
| 12 | 12 |
| 13 function onIceChange2() | 13 function onIceChange2() |
| 14 { | 14 { |
| 15 if (pc.iceConnectionState === "closed") { | 15 if (pc.iceConnectionState === "closed") { |
| 16 testPassed("iceConnectionState is closed."); | 16 testPassed("iceConnectionState is closed."); |
| 17 finishJSTest(); | 17 finishJSTest(); |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 | 20 |
| 21 function addIceCandidateSuccess() | 21 function addIceCandidateSuccess1() |
|
hta - Chromium
2016/05/26 04:56:41
Is it time to rewrite this test as a testharness.j
Guido Urdaneta
2016/05/26 14:37:36
Created a bug to migrate all mediastream tests and
| |
| 22 { | 22 { |
| 23 testPassed("addIceCandidateSuccess was called."); | 23 testPassed("addIceCandidateSuccess1 was called."); |
| 24 shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMid: 0}, addI ceCandidateSuccess2, unexpectedCallback);'); | |
| 25 } | |
| 26 | |
| 27 function addIceCandidateSuccess2() | |
| 28 { | |
| 29 testPassed("addIceCandidateSuccess2 was called."); | |
| 30 shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMLineIndex: 0 }, addIceCandidateSuccess3, unexpectedCallback);'); | |
| 31 } | |
| 32 | |
| 33 function addIceCandidateSuccess3() | |
| 34 { | |
| 35 testPassed("addIceCandidateSuccess3 was called."); | |
| 36 shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMid: 0, sdpML ineIndex: 0}, addIceCandidateSuccess4, unexpectedCallback);'); | |
| 37 } | |
| 38 | |
| 39 function addIceCandidateSuccess4() | |
| 40 { | |
| 41 testPassed("addIceCandidateSuccess4 was called."); | |
| 24 pc.oniceconnectionstatechange = onIceChange2; | 42 pc.oniceconnectionstatechange = onIceChange2; |
| 25 pc.close(); | 43 pc.close(); |
| 26 } | 44 } |
| 27 | 45 |
| 28 function unexpectedCallback() | 46 function unexpectedCallback() |
| 29 { | 47 { |
| 30 testFailed("unexpectedCallback was called."); | 48 testFailed("unexpectedCallback was called."); |
| 31 finishJSTest(); | 49 finishJSTest(); |
| 32 } | 50 } |
| 33 | 51 |
| 34 function expectedTypeError(error) | 52 function expectedTypeError(error) |
| 35 { | 53 { |
| 36 window.error = error; | 54 window.error = error; |
| 37 shouldBe('error.name', '"TypeError"'); | 55 shouldBe('error.name', '"TypeError"'); |
| 38 testPassed("expectedTypeError was called."); | 56 testPassed("expectedTypeError was called."); |
| 39 } | 57 } |
| 40 | 58 |
| 41 function onIceChange1() | 59 function onIceChange1() |
| 42 { | 60 { |
| 43 if (pc.iceConnectionState === "completed") { | 61 if (pc.iceConnectionState === "completed") { |
| 44 testPassed("iceConnectionState is completed"); | 62 testPassed("iceConnectionState is completed"); |
| 45 iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); | 63 iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); |
| 46 shouldNotThrow('pc.addIceCandidate(null, addIceCandidateSuccess, unexpec tedCallback).catch(expectedTypeError);'); | 64 shouldNotThrow('pc.addIceCandidate(null, unexpectedCallback, unexpectedC allback).catch(expectedTypeError);'); |
| 65 shouldNotThrow('pc.addIceCandidate({candidate: "candidate"}, unexpectedC allback, unexpectedCallback).catch(expectedTypeError);'); | |
| 47 shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallbac k).catch(expectedTypeError);'); | 66 shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallbac k).catch(expectedTypeError);'); |
| 48 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, null).catch(expectedTypeError);'); | 67 shouldNotThrow('pc.addIceCandidate(iceCandidate, unexpectedCallback, nul l).catch(expectedTypeError);'); |
| 49 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, unexpectedCallback);'); | 68 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess1 , unexpectedCallback);'); |
| 50 } | 69 } |
| 51 } | 70 } |
| 52 | 71 |
| 53 function testExecutionOrderClosedConnection() | 72 function testExecutionOrderClosedConnection() |
| 54 { | 73 { |
| 55 var localPeerConnection = new webkitRTCPeerConnection(null, null); | 74 var localPeerConnection = new webkitRTCPeerConnection(null, null); |
| 56 localPeerConnection.close(); | 75 localPeerConnection.close(); |
| 57 var counter = 0; | 76 var counter = 0; |
| 58 window.events = []; | 77 window.events = []; |
| 59 Promise.resolve().then(_ => events[counter++] = 1); | 78 Promise.resolve().then(_ => events[counter++] = 1); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 72 | 91 |
| 73 shouldNotThrow('testExecutionOrderClosedConnection()'); | 92 shouldNotThrow('testExecutionOrderClosedConnection()'); |
| 74 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); | 93 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); |
| 75 pc.oniceconnectionstatechange = onIceChange1; | 94 pc.oniceconnectionstatechange = onIceChange1; |
| 76 | 95 |
| 77 window.jsTestIsAsync = true; | 96 window.jsTestIsAsync = true; |
| 78 window.successfullyParsed = true; | 97 window.successfullyParsed = true; |
| 79 </script> | 98 </script> |
| 80 </body> | 99 </body> |
| 81 </html> | 100 </html> |
| OLD | NEW |