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

Side by Side Diff: chrome/test/data/webrtc/peerconnection.js

Issue 2186853002: WebRTCStats added, retaining type info when surfacing WebRTC stats into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed phoglund's comments Created 4 years, 4 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 /** 1 /**
2 * Copyright 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * The one and only peer connection in this page. 8 * The one and only peer connection in this page.
9 * @private 9 * @private
10 */ 10 */
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 returnToTest('ok-muted'); 282 returnToTest('ok-muted');
283 } 283 }
284 284
285 /** 285 /**
286 * Returns 286 * Returns
287 */ 287 */
288 function hasSeenCryptoInSdp() { 288 function hasSeenCryptoInSdp() {
289 returnToTest(gHasSeenCryptoInSdp); 289 returnToTest(gHasSeenCryptoInSdp);
290 } 290 }
291 291
292 /**
293 * Verifies that |RTCPeerConnection.getStats| returns stats.
294 *
295 * Returns ok-got-stats on success.
296 */
297 function verifyStatsGenerated() {
298 peerConnection_().getStats(
299 function(response) {
300 var reports = response.result();
301 var numStats = 0;
302 for (var i = 0; i < reports.length; i++) {
303 var statNames = reports[i].names();
304 numStats += statNames.length;
305 for (var j = 0; j < statNames.length; j++) {
306 var statValue = reports[i].stat(statNames[j]);
307 if (typeof statValue !== 'string')
tommi (sloooow) - chröme 2016/07/27 18:38:40 != should be enough. !== is used to do equality+t
hbos_chromium 2016/07/28 08:27:45 Done.
308 throw failTest('A stat was returned that is not a string.');
309 }
310 }
311 if (numStats === 0)
312 throw failTest('No stats was returned by getStats.');
313 returnToTest('ok-got-stats');
314 });
315 }
316
292 // Internals. 317 // Internals.
293 318
294 /** @private */ 319 /** @private */
295 function createPeerConnection_(rtcConfig) { 320 function createPeerConnection_(rtcConfig) {
296 try { 321 try {
297 peerConnection = new RTCPeerConnection(rtcConfig, {}); 322 peerConnection = new RTCPeerConnection(rtcConfig, {});
298 } catch (exception) { 323 } catch (exception) {
299 throw failTest('Failed to create peer connection: ' + exception); 324 throw failTest('Failed to create peer connection: ' + exception);
300 } 325 }
301 peerConnection.onaddstream = addStreamCallback_; 326 peerConnection.onaddstream = addStreamCallback_;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 function parseJson_(json) { 374 function parseJson_(json) {
350 // Escape since the \r\n in the SDP tend to get unescaped. 375 // Escape since the \r\n in the SDP tend to get unescaped.
351 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n'); 376 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n');
352 try { 377 try {
353 return JSON.parse(jsonWithEscapedLineBreaks); 378 return JSON.parse(jsonWithEscapedLineBreaks);
354 } catch (exception) { 379 } catch (exception) {
355 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' + 380 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' +
356 exception); 381 exception);
357 } 382 }
358 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698