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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 the RTCPeerConnection Ice functionality."); 8 description("Tests the RTCPeerConnection Ice functionality.");
9 9
10 var pc = null; 10 var pc = null;
11 var iceCandidate = null; 11 var iceCandidate = null;
12 12
13 function onIceChange2() 13 function onIceChange2()
14 { 14 {
15 if (pc.iceConnectionState === "closed") { 15 if (pc.iceConnectionState === "closed") {
16 testPassed("iceConnectionState is closed."); 16 testPassed("iceConnectionState is closed.");
17 finishJSTest(); 17 finishJSTest();
18 } 18 }
19 } 19 }
20 20
21 function addIceCandidateSuccess() 21 function addIceCandidateSuccess()
22 { 22 {
23 testPassed("addIceCandidateSuccess was called."); 23 testPassed("addIceCandidateSuccess was called.");
24 pc.oniceconnectionstatechange = onIceChange2; 24 pc.oniceconnectionstatechange = onIceChange2;
25 pc.close(); 25 pc.close();
26 } 26 }
27 27
28 function addIceCandidateFailure() 28 function unexpectedCallback()
29 { 29 {
30 testFailed("addIceCandidateFailue was called."); 30 testFailed("unexpectedCallback was called.");
31 finishJSTest(); 31 finishJSTest();
32 } 32 }
33 33
34 function expectedTypeError(error)
35 {
36 shouldBe(error.name, "TypeError")
37 testPassed("expectedTypeError was called.")
38 }
39
34 function onIceChange1() 40 function onIceChange1()
35 { 41 {
36 if (pc.iceConnectionState === "completed") { 42 if (pc.iceConnectionState === "completed") {
37 testPassed("iceConnectionState is completed"); 43 testPassed("iceConnectionState is completed");
38 iceCandidate = new RTCIceCandidate({candidate:"nano nano"}); 44 iceCandidate = new RTCIceCandidate({candidate:"nano nano"});
39 shouldThrow('pc.addIceCandidate(null, addIceCandidateSuccess, addIceCand idateFailure);'); 45 shouldNotThrow('pc.addIceCandidate(null, addIceCandidateSuccess, unexpec tedCallback).catch(expectedTypeError);');
40 shouldThrow('pc.addIceCandidate(iceCandidate, null, addIceCandidateFailu re);'); 46 shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallbac k).catch(expectedTypeError);');
41 shouldThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, nu ll);'); 47 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, null).catch(expectedTypeError);');
42 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, addIceCandidateFailure);'); 48 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess, unexpectedCallback);');
43 } 49 }
44 } 50 }
45 51
52 function testExecutionOrderClosedConnection()
53 {
54 var localPeerConnection = new webkitRTCPeerConnection(null, null);
55 orderCounter = 0;
philipj_slow 2016/02/18 02:31:56 add var or let here, or it ends up on window
Guido Urdaneta 2016/02/18 12:30:22 If I use var, I cannot check its value with should
56 localPeerConnection.addIceCandidate(1).catch(function(error) {
57 window.error = error;
58 shouldBe('error.name', '"TypeError"');
59 orderCounter++;
60 shouldBeEqualToNumber('orderCounter', 1);
61 });
62 localPeerConnection.close();
63 var iceCandidate = new RTCIceCandidate({candidate:"nano nano"});
64 localPeerConnection.addIceCandidate(iceCandidate, unexpectedCallback, functi on(error) {
65 window.error = error;
66 shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\ '."');
philipj_slow 2016/02/18 02:31:56 This is testing the right thing, the timing of asy
Guido Urdaneta 2016/02/18 12:30:22 It does fail with the Timer implementation.
67 orderCounter++;
68 shouldBeEqualToNumber('orderCounter', 2);
69 });
70 localPeerConnection.addIceCandidate(1).catch(function(error) {
71 window.error = error;
72 shouldBe('error.name', '"TypeError"');
73 orderCounter++;
74 shouldBeEqualToNumber('orderCounter', 3);
75 });
76 }
77
78 shouldNotThrow('testExecutionOrderClosedConnection()');
46 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);'); 79 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);');
47 pc.oniceconnectionstatechange = onIceChange1; 80 pc.oniceconnectionstatechange = onIceChange1;
48 81
49 window.jsTestIsAsync = true; 82 window.jsTestIsAsync = true;
50 window.successfullyParsed = true; 83 window.successfullyParsed = true;
51 </script> 84 </script>
52 </body> 85 </body>
53 </html> 86 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-ice-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698