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 the RTCPeerConnection Ice functionality."); | |
9 | |
10 var pc = null; | |
11 var iceCandidate = null; | |
12 | |
13 function onIceChange2() | |
14 { | |
15 if (pc.iceConnectionState === "closed") { | |
16 testPassed("iceConnectionState is closed."); | |
17 finishJSTest(); | |
18 } | |
19 } | |
20 | |
21 function addIceCandidateSuccess() | |
22 { | |
23 testPassed("addIceCandidateSuccess was called."); | |
24 pc.oniceconnectionstatechange = onIceChange2; | |
25 pc.close(); | |
26 } | |
27 | |
28 function addIceCandidateFailure() | |
29 { | |
30 testFailed("addIceCandidateFailure was called."); | |
31 finishJSTest(); | |
32 } | |
33 | |
34 function unexpectedSuccess() | |
35 { | |
36 testFailed("unexpectedSuccess was called."); | |
37 finishJSTest(); | |
38 } | |
39 | |
40 function expectedTypeError(error) | |
41 { | |
42 window.error = error; | |
43 shouldBe('error.name', '"TypeError"') | |
44 testPassed('expectedTypeError was called.') | |
45 } | |
46 | |
47 function onIceChange1() | |
48 { | |
49 if (pc.iceConnectionState === "completed") { | |
50 testPassed("iceConnectionState is completed"); | |
51 iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); | |
52 shouldNotThrow('pc.addIceCandidate(null).then(unexpectedSuccess, expecte
dTypeError);'); | |
53 shouldNotThrow('pc.addIceCandidate(iceCandidate).then(addIceCandidateSuc
cess, addIceCandidateFailure);'); | |
54 } | |
55 } | |
56 | |
57 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); | |
58 pc.oniceconnectionstatechange = onIceChange1; | |
59 | |
60 window.jsTestIsAsync = true; | |
61 window.successfullyParsed = true; | |
62 </script> | |
63 </body> | |
64 </html> | |
OLD | NEW |