Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html

Issue 1661493002: Add promise-based addIceCandidate, setLocalDescription and setRemoteDescription to RTCPeerConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: philipj's comments on tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
11 11
12 function requestFailed2() 12 function requestFailed2()
13 { 13 {
14 testPassed('requestFailed was called.'); 14 testPassed('requestFailed was called.');
15 15
16 shouldBeEqualToString('pc.localDescription.type', "offer"); 16 shouldBeEqualToString('pc.localDescription.type', "offer");
17 shouldBeEqualToString('pc.localDescription.sdp', "local"); 17 shouldBeEqualToString('pc.localDescription.sdp', "local");
18 pc.close(); 18 pc.close();
19 shouldBeEqualToString('pc.localDescription.type', "offer"); 19 shouldBeEqualToString('pc.localDescription.type', "offer");
20 shouldBeEqualToString('pc.localDescription.sdp', "local"); 20 shouldBeEqualToString('pc.localDescription.sdp', "local");
21 21
22 finishJSTest(); 22 finishJSTest();
23 } 23 }
24 24
25 function requestSucceeded2()
26 {
27 testFailed('requestSucceeded was called.');
28 finishJSTest();
29 }
30
31 function requestFailed1()
32 {
33 testFailed('requestFailed was called.');
34 finishJSTest();
35 }
36
37 function requestSucceeded1() 25 function requestSucceeded1()
38 { 26 {
39 testPassed('requestSucceeded was called.'); 27 testPassed('requestSucceeded was called.');
40 28
41 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} ); 29 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} );
42 shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded2 , requestFailed2);'); 30 shouldNotThrow('pc.setLocalDescription(sessionDescription, unexpectedCallbac k, requestFailed2);');
43 } 31 }
44 32
33 function unexpectedCallback()
34 {
35 testFailed('unexpectedCallback was called.');
36 finishJSTest();
37 }
38
39 function expectedTypeError(error)
40 {
41 window.error = error;
42 shouldBe('error.name', '"TypeError"')
43 testPassed('expectedTypeError was called.')
44 }
45
46 function expectedInvalidSessionDescription(error)
47 {
48 testPassed('expectedInvalidSessionDescription was called.')
49 }
50
51 function testExecutionOrderClosedConnection()
52 {
53 var localPeerConnection = new webkitRTCPeerConnection(null, null);
54 localPeerConnection.close();
55 var counter = 0;
56 events = [];
57 Promise.resolve().then(_ => events[counter++] = 1);
58 var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local "});
59 localPeerConnection.setLocalDescription(sessionDescription, unexpectedCallba ck, (error) => {
60 window.error = error;
61 shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\ '."');
62 events[counter++] = 2;
63 });
64 Promise.resolve().then(_ => {
65 events[counter++] = 3;
66 shouldBe('events', '[1,2,3]');
67 });
68 }
69
70 shouldNotThrow('testExecutionOrderClosedConnection()');
45 pc = new webkitRTCPeerConnection(null, null); 71 pc = new webkitRTCPeerConnection(null, null);
46 shouldThrow('pc.setLocalDescription(null)'); 72 shouldNotThrow('pc.setLocalDescription().catch(expectedTypeError)');
73 shouldNotThrow('pc.setLocalDescription(null).catch(expectedInvalidSessionDescrip tion)');
47 var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); 74 var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
48 shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, re questFailed1);'); 75 shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, un expectedCallback);');
49
50 76
51 window.jsTestIsAsync = true; 77 window.jsTestIsAsync = true;
52 window.successfullyParsed = true; 78 window.successfullyParsed = true;
53 </script> 79 </script>
54 </body> 80 </body>
55 </html> 81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698