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

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

Issue 2097563002: Split the mediastream module in Blink into mediastream and peerconnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DEPS file Created 4 years, 5 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
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <!-- TODO(guidou): Convert test to testharness.js. crbug.com/614963 -->
6 </head>
7 <body>
8 <script>
9 description("Tests the RTCPeerConnection Ice functionality.");
10
11 var pc = null;
12 var iceCandidate = null;
13
14 function onIceChange2()
15 {
16 if (pc.iceConnectionState === "closed") {
17 testPassed("iceConnectionState is closed.");
18 finishJSTest();
19 }
20 }
21
22 function addIceCandidateSuccess1()
23 {
24 testPassed("addIceCandidateSuccess1 was called.");
25 shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMid: 0}, addI ceCandidateSuccess2, unexpectedCallback);');
26 }
27
28 function addIceCandidateSuccess2()
29 {
30 testPassed("addIceCandidateSuccess2 was called.");
31 shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMLineIndex: 0 }, addIceCandidateSuccess3, unexpectedCallback);');
32 }
33
34 function addIceCandidateSuccess3()
35 {
36 testPassed("addIceCandidateSuccess3 was called.");
37 shouldNotThrow('pc.addIceCandidate({candidate: "candidate", sdpMid: 0, sdpML ineIndex: 0}, addIceCandidateSuccess4, unexpectedCallback);');
38 }
39
40 function addIceCandidateSuccess4()
41 {
42 testPassed("addIceCandidateSuccess4 was called.");
43 pc.oniceconnectionstatechange = onIceChange2;
44 pc.close();
45 }
46
47 function unexpectedCallback()
48 {
49 testFailed("unexpectedCallback was called.");
50 finishJSTest();
51 }
52
53 function expectedTypeError(error)
54 {
55 window.error = error;
56 shouldBe('error.name', '"TypeError"');
57 testPassed("expectedTypeError was called.");
58 }
59
60 function onIceChange1()
61 {
62 if (pc.iceConnectionState === "completed") {
63 testPassed("iceConnectionState is completed");
64 iceCandidate = new RTCIceCandidate({candidate:"nano nano"});
65 shouldNotThrow('pc.addIceCandidate(null, unexpectedCallback, unexpectedC allback).catch(expectedTypeError);');
66 shouldNotThrow('pc.addIceCandidate({candidate: "candidate"}, unexpectedC allback, unexpectedCallback).catch(expectedTypeError);');
67 shouldNotThrow('pc.addIceCandidate(iceCandidate, null, unexpectedCallbac k).catch(expectedTypeError);');
68 shouldNotThrow('pc.addIceCandidate(iceCandidate, unexpectedCallback, nul l).catch(expectedTypeError);');
69 shouldNotThrow('pc.addIceCandidate(iceCandidate, addIceCandidateSuccess1 , unexpectedCallback);');
70 }
71 }
72
73 function testExecutionOrderClosedConnection()
74 {
75 var localPeerConnection = new webkitRTCPeerConnection(null, null);
76 localPeerConnection.close();
77 var counter = 0;
78 window.events = [];
79 Promise.resolve().then(_ => events[counter++] = 1);
80 var iceCandidate = new RTCIceCandidate({candidate:"nano nano"});
81 localPeerConnection.addIceCandidate(iceCandidate, unexpectedCallback, error => {
82 window.error = error;
83 shouldBe('error.name', '"InvalidStateError"');
84 shouldBe('error.toString()', '"InvalidStateError: The RTCPeerConnection\ 's signalingState is \'closed\'."');
85 events[counter++] = 2;
86 });
87 Promise.resolve().then(_ => {
88 events[counter++] = 3;
89 shouldBe('events', '[1,2,3]');
90 });
91 }
92
93 shouldNotThrow('testExecutionOrderClosedConnection()');
94 shouldNotThrow('pc = new webkitRTCPeerConnection(null, null);');
95 pc.oniceconnectionstatechange = onIceChange1;
96
97 window.jsTestIsAsync = true;
98 window.successfullyParsed = true;
99 </script>
100 </body>
101 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698