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 RTCPeerConnection localDescription."); | 8 description("Tests RTCPeerConnection localDescription."); |
9 | 9 |
10 var pc = null; | 10 var pc = null; |
(...skipping 18 matching lines...) Expand all Loading... | |
29 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} ); | 29 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} ); |
30 shouldNotThrow('pc.setLocalDescription(sessionDescription, unexpectedCallbac k, requestFailed2);'); | 30 shouldNotThrow('pc.setLocalDescription(sessionDescription, unexpectedCallbac k, requestFailed2);'); |
31 } | 31 } |
32 | 32 |
33 function unexpectedCallback() | 33 function unexpectedCallback() |
34 { | 34 { |
35 testFailed('unexpectedCallback was called.'); | 35 testFailed('unexpectedCallback was called.'); |
36 finishJSTest(); | 36 finishJSTest(); |
37 } | 37 } |
38 | 38 |
39 function expectedTypeError(error) | 39 function expectedTypeError(reason) |
40 { | 40 { |
41 window.error = error; | 41 window.error = reason; |
42 shouldBe('error.name', '"TypeError"') | 42 shouldBe('error.name', '"TypeError"') |
43 testPassed('expectedTypeError was called.') | 43 testPassed('expectedTypeError was called.') |
44 } | 44 } |
45 | 45 |
46 function expectedInvalidSessionDescription(error) | 46 function expectedInvalidSessionDescription(error) |
47 { | 47 { |
48 window.error = reason; | |
philipj_slow
2016/02/24 08:14:03
Oops, here the local variable is still called erro
Guido Urdaneta
2016/02/24 12:42:10
Done.
| |
49 shouldBe('error.name', '"InvalidStateError"') | |
48 testPassed('expectedInvalidSessionDescription was called.') | 50 testPassed('expectedInvalidSessionDescription was called.') |
49 } | 51 } |
50 | 52 |
51 function testExecutionOrderClosedConnection() | 53 function testExecutionOrderClosedConnection() |
52 { | 54 { |
53 var localPeerConnection = new webkitRTCPeerConnection(null, null); | 55 var localPeerConnection = new webkitRTCPeerConnection(null, null); |
54 localPeerConnection.close(); | 56 localPeerConnection.close(); |
55 var counter = 0; | 57 var counter = 0; |
56 events = []; | 58 window.events = []; |
57 Promise.resolve().then(_ => events[counter++] = 1); | 59 Promise.resolve().then(_ => events[counter++] = 1); |
58 var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local "}); | 60 var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local "}); |
59 localPeerConnection.setLocalDescription(sessionDescription, unexpectedCallba ck, (error) => { | 61 localPeerConnection.setLocalDescription(sessionDescription, unexpectedCallba ck, (reason) => { |
philipj_slow
2016/02/24 08:14:03
Just as an FYI, it's OK to omit the parens when th
Guido Urdaneta
2016/02/24 12:42:10
Done.
| |
60 window.error = error; | 62 window.error = reason; |
61 shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\ '."'); | 63 shouldBe('error.name', '"InvalidStateError"'); |
62 events[counter++] = 2; | 64 events[counter++] = 2; |
63 }); | 65 }); |
64 Promise.resolve().then(_ => { | 66 Promise.resolve().then(_ => { |
65 events[counter++] = 3; | 67 events[counter++] = 3; |
66 shouldBe('events', '[1,2,3]'); | 68 shouldBe('events', '[1,2,3]'); |
67 }); | 69 }); |
68 } | 70 } |
69 | 71 |
70 shouldNotThrow('testExecutionOrderClosedConnection()'); | 72 shouldNotThrow('testExecutionOrderClosedConnection()'); |
71 pc = new webkitRTCPeerConnection(null, null); | 73 pc = new webkitRTCPeerConnection(null, null); |
72 shouldNotThrow('pc.setLocalDescription().catch(expectedTypeError)'); | 74 shouldNotThrow('pc.setLocalDescription().catch(expectedTypeError)'); |
73 shouldNotThrow('pc.setLocalDescription(null).catch(expectedInvalidSessionDescrip tion)'); | 75 shouldNotThrow('pc.setLocalDescription(null).catch(expectedInvalidSessionDescrip tion)'); |
74 var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); | 76 var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); |
75 shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, un expectedCallback);'); | 77 shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, un expectedCallback);'); |
76 | 78 |
77 window.jsTestIsAsync = true; | 79 window.jsTestIsAsync = true; |
78 window.successfullyParsed = true; | 80 window.successfullyParsed = true; |
79 </script> | 81 </script> |
80 </body> | 82 </body> |
81 </html> | 83 </html> |
OLD | NEW |