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

Side by Side Diff: LayoutTests/imported/web-platform-tests/webrtc/no-media-call.html

Issue 1188583004: update-w3c-deps import using blink 9d3793ee56e5bb1aa1eef078d848e1b0e6e4d355: (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <!-- 2 <!--
3 This test uses no media, and thus does not require fake media devices. 3 This test uses the legacy callback API with no media, and thus does not require fake media devices.
4 --> 4 -->
5 5
6 <html> 6 <html>
7 <head> 7 <head>
8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9 <title>RTCPeerConnection No-Media Connection Test</title> 9 <title>RTCPeerConnection No-Media Connection Test</title>
10 </head> 10 </head>
11 <body> 11 <body>
12 <div id="log"></div> 12 <div id="log"></div>
13 <h2>iceConnectionState info</h2> 13 <h2>iceConnectionState info</h2>
14 <div id="stateinfo"> 14 <div id="stateinfo">
15 </div> 15 </div>
16 16
17 <!-- These files are in place when executing on W3C. --> 17 <!-- These files are in place when executing on W3C. -->
18 <script src="../../../resources/testharness.js"></script> 18 <script src="../../../resources/testharness.js"></script>
19 <script src="../../../resources/testharnessreport.js"></script> 19 <script src="../../../resources/testharnessreport.js"></script>
20 <script src="../../../resources/vendor-prefix.js" 20 <script src="../../../resources/vendor-prefix.js"
21 data-prefixed-objects= 21 data-prefixed-objects=
22 '[{"ancestors":["window"], "name":"RTCPeerConnection"}, 22 '[{"ancestors":["window"], "name":"RTCPeerConnection"},
23 {"ancestors":["window"], "name":"RTCSessionDescription"}, 23 {"ancestors":["window"], "name":"RTCSessionDescription"}]'
24 {"ancestors":["window"], "name":"RTCIceCandidate"}]'
25 > 24 >
26 </script> 25 </script>
27 <script type="text/javascript"> 26 <script type="text/javascript">
28 var test = async_test('Can set up a basic WebRTC call with no data.'); 27 var test = async_test('Can set up a basic WebRTC call with no data.');
29 28
30 var gFirstConnection = null; 29 var gFirstConnection = null;
31 var gSecondConnection = null; 30 var gSecondConnection = null;
32 31
33 var onOfferCreated = test.step_func(function(offer) { 32 var onOfferCreated = test.step_func(function(offer) {
34 // TODO: Switch to promise-based interface.
35 gFirstConnection.setLocalDescription(offer, ignoreSuccess, 33 gFirstConnection.setLocalDescription(offer, ignoreSuccess,
36 failed('setLocalDescription first')); 34 failed('setLocalDescription first'));
37 35
38 // This would normally go across the application's signaling solution. 36 // This would normally go across the application's signaling solution.
39 // In our case, the "signaling" is to call this function. 37 // In our case, the "signaling" is to call this function.
40 receiveCall(offer.sdp); 38 receiveCall(offer.sdp);
41 }); 39 });
42 40
43 function receiveCall(offerSdp) { 41 function receiveCall(offerSdp) {
44 42
45 var parsedOffer = new RTCSessionDescription({ type: 'offer', 43 var parsedOffer = new RTCSessionDescription({ type: 'offer',
46 sdp: offerSdp }); 44 sdp: offerSdp });
47 // These functions use the legacy interface extensions to RTCPeerConnection. 45 // These functions use the legacy interface extensions to RTCPeerConnection.
48 // TODO: Switch to promise-based interfaces.
49 gSecondConnection.setRemoteDescription(parsedOffer, 46 gSecondConnection.setRemoteDescription(parsedOffer,
50 function() { 47 function() {
51 gSecondConnection.createAnswer(onAnswerCreated, 48 gSecondConnection.createAnswer(onAnswerCreated,
52 failed('createAnswer')); 49 failed('createAnswer'));
53 }, 50 },
54 failed('setRemoteDescription second')); 51 failed('setRemoteDescription second'));
55 }; 52 };
56 53
57 var onAnswerCreated = test.step_func(function(answer) { 54 var onAnswerCreated = test.step_func(function(answer) {
58 gSecondConnection.setLocalDescription(answer, ignoreSuccess, 55 gSecondConnection.setLocalDescription(answer, ignoreSuccess,
59 failed('setLocalDescription second')); 56 failed('setLocalDescription second'));
60 57
61 // Similarly, this would go over the application's signaling solution. 58 // Similarly, this would go over the application's signaling solution.
62 handleAnswer(answer.sdp); 59 handleAnswer(answer.sdp);
63 }); 60 });
64 61
65 function handleAnswer(answerSdp) { 62 function handleAnswer(answerSdp) {
66 var parsedAnswer = new RTCSessionDescription({ type: 'answer', 63 var parsedAnswer = new RTCSessionDescription({ type: 'answer',
67 sdp: answerSdp }); 64 sdp: answerSdp });
68 gFirstConnection.setRemoteDescription(parsedAnswer, ignoreSuccess, 65 gFirstConnection.setRemoteDescription(parsedAnswer, ignoreSuccess,
69 failed('setRemoteDescription first')); 66 failed('setRemoteDescription first'));
70 }; 67 };
71 68
72 var onIceCandidateToFirst = test.step_func(function(event) { 69 var onIceCandidateToFirst = test.step_func(function(event) {
73 // If event.candidate is null = no more candidates. 70 // If event.candidate is null = no more candidates.
74 if (event.candidate) { 71 if (event.candidate) {
75 var candidate = new RTCIceCandidate(event.candidate); 72 gSecondConnection.addIceCandidate(event.candidate);
76 gSecondConnection.addIceCandidate(candidate);
77 } 73 }
78 }); 74 });
79 75
80 var onIceCandidateToSecond = test.step_func(function(event) { 76 var onIceCandidateToSecond = test.step_func(function(event) {
81 if (event.candidate) { 77 if (event.candidate) {
82 var candidate = new RTCIceCandidate(event.candidate); 78 gFirstConnection.addIceCandidate(event.candidate);
83 gFirstConnection.addIceCandidate(candidate);
84 } 79 }
85 }); 80 });
86 81
87 var onRemoteStream = test.step_func(function(event) { 82 var onRemoteStream = test.step_func(function(event) {
88 assert_unreached('WebRTC received a stream when there was none'); 83 assert_unreached('WebRTC received a stream when there was none');
89 }); 84 });
90 85
91 var onIceConnectionStateChange = test.step_func(function(event) { 86 var onIceConnectionStateChange = test.step_func(function(event) {
92 assert_equals(event.type, 'iceconnectionstatechange'); 87 assert_equals(event.type, 'iceconnectionstatechange');
88 assert_not_equals(gFirstConnection.iceConnectionState, "failed", "iceConnect ionState of first connection");
89 assert_not_equals(gSecondConnection.iceConnectionState, "failed", "iceConnec tionState of second connection");
93 var stateinfo = document.getElementById('stateinfo'); 90 var stateinfo = document.getElementById('stateinfo');
94 stateinfo.innerHTML = 'First: ' + gFirstConnection.iceConnectionState 91 stateinfo.innerHTML = 'First: ' + gFirstConnection.iceConnectionState
95 + '<br>Second: ' + gSecondConnection.iceConnectionState; 92 + '<br>Second: ' + gSecondConnection.iceConnectionState;
96 // Note: All these combinations are legal states indicating that the 93 // Note: All these combinations are legal states indicating that the
97 // call has connected. All browsers should end up in completed/completed, 94 // call has connected. All browsers should end up in completed/completed,
98 // but as of this moment, we've chosen to terminate the test early. 95 // but as of this moment, we've chosen to terminate the test early.
99 // TODO: Revise test to ensure completed/completed is reached. 96 // TODO: Revise test to ensure completed/completed is reached.
100 if (gFirstConnection.iceConnectionState == 'connected' && 97 if (gFirstConnection.iceConnectionState == 'connected' &&
101 gSecondConnection.iceConnectionState == 'connected') { 98 gSecondConnection.iceConnectionState == 'connected') {
102 test.done() 99 test.done()
(...skipping 29 matching lines...) Expand all
132 gFirstConnection.onicecandidate = onIceCandidateToFirst; 129 gFirstConnection.onicecandidate = onIceCandidateToFirst;
133 gFirstConnection.oniceconnectionstatechange = onIceConnectionStateChange; 130 gFirstConnection.oniceconnectionstatechange = onIceConnectionStateChange;
134 131
135 gSecondConnection = new RTCPeerConnection(null); 132 gSecondConnection = new RTCPeerConnection(null);
136 gSecondConnection.onicecandidate = onIceCandidateToSecond; 133 gSecondConnection.onicecandidate = onIceCandidateToSecond;
137 gSecondConnection.onaddstream = onRemoteStream; 134 gSecondConnection.onaddstream = onRemoteStream;
138 gSecondConnection.oniceconnectionstatechange = onIceConnectionStateChange; 135 gSecondConnection.oniceconnectionstatechange = onIceConnectionStateChange;
139 136
140 // The offerToReceiveVideo is necessary and sufficient to make 137 // The offerToReceiveVideo is necessary and sufficient to make
141 // an actual connection. 138 // an actual connection.
142 // TODO: Use a promise-based API. This is legacy.
143 gFirstConnection.createOffer(onOfferCreated, failed('createOffer'), 139 gFirstConnection.createOffer(onOfferCreated, failed('createOffer'),
144 {offerToReceiveVideo: true}); 140 {offerToReceiveVideo: true});
145 }); 141 });
146 </script> 142 </script>
147 143
148 </body> 144 </body>
149 </html> 145 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698