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 createAnswer."); | |
9 | |
10 var pc = null; | |
11 | |
12 function unexpectedCallback() | |
13 { | |
14 testFailed('unexpectedCallback was called') | |
15 finishJSTest(); | |
16 } | |
17 | |
18 function answerCreated() | |
19 { | |
20 testPassed('createAnswer request succeeded.'); | |
21 finishJSTest(); | |
22 } | |
23 | |
24 function descriptionSet() | |
25 { | |
26 testPassed('setRemoteDescription request succeeded.'); | |
27 shouldNotThrow('pc.createAnswer(answerCreated, unexpectedCallback);'); | |
28 } | |
29 | |
30 function createOfferWithoutDescriptionFailed() | |
31 { | |
32 testPassed('createOffer request without remote description failed.'); | |
33 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}
); | |
34 shouldNotThrow('pc.setRemoteDescription(sessionDescription, descriptionSet,
unexpectedCallback);'); | |
35 } | |
36 | |
37 function testExecutionOrderClosedConnection() | |
38 { | |
39 var localPeerConnection = new webkitRTCPeerConnection(null, null); | |
40 localPeerConnection.close(); | |
41 var counter = 0; | |
42 window.events = []; | |
43 Promise.resolve().then(_ => window.events[counter++] = 1); | |
44 localPeerConnection.createAnswer(unexpectedCallback, error => { | |
45 window.error = error; | |
46 shouldBe('error.name', '"InvalidStateError"'); | |
47 shouldBe('error.toString()', '"InvalidStateError: The RTCPeerConnection\
's signalingState is \'closed\'."'); | |
48 window.events[counter++] = 2; | |
49 }); | |
50 Promise.resolve().then(_ => { | |
51 window.events[counter++] = 3; | |
52 shouldBe('events', '[1,2,3]'); | |
53 }); | |
54 } | |
55 | |
56 shouldNotThrow('testExecutionOrderClosedConnection()'); | |
57 pc = new webkitRTCPeerConnection(null, null); | |
58 pc.createOffer(unexpectedCallback, createOfferWithoutDescriptionFailed); | |
59 | |
60 window.jsTestIsAsync = true; | |
61 window.successfullyParsed = true; | |
62 </script> | |
63 </body> | |
64 </html> | |
OLD | NEW |