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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.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: Use ScriptPromiseResolver::detach() to leave the promise unresolved. 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 remoteDescription."); 8 description("Tests RTCPeerConnection remoteDescription.");
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.remoteDescription.type', "answer"); 16 shouldBeEqualToString('pc.remoteDescription.type', "answer");
17 shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); 17 shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
18 pc.close(); 18 pc.close();
19 shouldBeEqualToString('pc.remoteDescription.type', "answer"); 19 shouldBeEqualToString('pc.remoteDescription.type', "answer");
20 shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); 20 shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
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:"offer", sdp:"local"}); 29 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
42 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 2, requestFailed2);'); 30 shouldNotThrow('pc.setRemoteDescription(sessionDescription, unexpectedCallba ck, 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 orderCounter = 0;
55 localPeerConnection.setRemoteDescription().catch(function(error) {
56 window.error = error;
57 shouldBe('error.name', '"TypeError"');
58 orderCounter++;
59 shouldBeEqualToNumber('orderCounter', 1)
60 })
61 localPeerConnection.close();
62 var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remo te"});
63 localPeerConnection.setRemoteDescription(sessionDescription, unexpectedCallb ack, function(error) {
64 window.error = error;
65 shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\ '."');
66 orderCounter++;
67 shouldBeEqualToNumber('orderCounter', 2);
68 });
69 localPeerConnection.setRemoteDescription().catch(function(error) {
70 window.error = error;
71 shouldBe('error.name', '"TypeError"');
72 orderCounter++;
73 shouldBeEqualToNumber('orderCounter', 3)
74 });
75 }
76
77 shouldNotThrow('testExecutionOrderClosedConnection()');
45 pc = new webkitRTCPeerConnection(null, null); 78 pc = new webkitRTCPeerConnection(null, null);
46 shouldThrow('pc.setRemoteDescription(null)'); 79 shouldNotThrow('pc.setRemoteDescription().catch(expectedTypeError)');
80 shouldNotThrow('pc.setRemoteDescription(null).catch(expectedInvalidSessionDescri ption)');
47 var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} ); 81 var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} );
48 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, r equestFailed1);'); 82 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, u nexpectedCallback);');
49
50 83
51 window.jsTestIsAsync = true; 84 window.jsTestIsAsync = true;
52 window.successfullyParsed = true; 85 window.successfullyParsed = true;
53 </script> 86 </script>
54 </body> 87 </body>
55 </html> 88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698