OLD | NEW |
1 /** | 1 /** |
2 * Copyright 2016 The Chromium Authors. All rights reserved. | 2 * Copyright 2016 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 * Maps "RTCStats.type" values to descriptions of whitelisted (allowed to be | 8 * Maps "RTCStats.type" values to descriptions of whitelisted (allowed to be |
9 * exposed to the web) RTCStats-derived dictionaries described below. | 9 * exposed to the web) RTCStats-derived dictionaries described below. |
10 * @private | 10 * @private |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 reportDictionary[stats.id] = stats; | 294 reportDictionary[stats.id] = stats; |
295 } | 295 } |
296 returnToTest('ok-' + JSON.stringify(reportDictionary)); | 296 returnToTest('ok-' + JSON.stringify(reportDictionary)); |
297 }, | 297 }, |
298 function(e) { | 298 function(e) { |
299 throw failTest('Promise was rejected: ' + e); | 299 throw failTest('Promise was rejected: ' + e); |
300 }); | 300 }); |
301 } | 301 } |
302 | 302 |
303 /** | 303 /** |
| 304 * Invokes the promise-based |RTCPeerConnection.getStats| and returns to test |
| 305 * when done, not doing anything with the results. For testing performance. |
| 306 * |
| 307 * Returns "done" on success. |
| 308 */ |
| 309 function getStatsAndReturn() { |
| 310 peerConnection_().getStats() |
| 311 .then(function(report) { |
| 312 returnToTest('done'); |
| 313 }, |
| 314 function(e) { |
| 315 throw failTest('Promise was rejected: ' + e); |
| 316 }); |
| 317 } |
| 318 |
| 319 /** |
304 * Returns a complete list of whitelisted "RTCStats.type" values as a | 320 * Returns a complete list of whitelisted "RTCStats.type" values as a |
305 * JSON-stringified array of strings to the test. | 321 * JSON-stringified array of strings to the test. |
306 */ | 322 */ |
307 function getWhitelistedStatsTypes() { | 323 function getWhitelistedStatsTypes() { |
308 returnToTest(JSON.stringify(Array.from(gStatsWhitelist.keys()))); | 324 returnToTest(JSON.stringify(Array.from(gStatsWhitelist.keys()))); |
309 } | 325 } |
310 | 326 |
311 // Internals. | 327 // Internals. |
312 | 328 |
313 /** @private */ | 329 /** @private */ |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 if (typeof(element) !== elementType) { | 384 if (typeof(element) !== elementType) { |
369 throw failTest('stats.' + propertyName + ' should have a different ' + | 385 throw failTest('stats.' + propertyName + ' should have a different ' + |
370 'type according to the whitelist (an element of the array has ' + | 386 'type according to the whitelist (an element of the array has ' + |
371 'the incorrect type): ' + JSON.stringify(stats[propertyName]) + | 387 'the incorrect type): ' + JSON.stringify(stats[propertyName]) + |
372 ' vs ' + whitelistedStats[propertyName]); | 388 ' vs ' + whitelistedStats[propertyName]); |
373 } | 389 } |
374 } | 390 } |
375 } | 391 } |
376 } | 392 } |
377 } | 393 } |
OLD | NEW |