| Index: chrome/test/data/webrtc/peerconnection_getstats.js
|
| diff --git a/chrome/test/data/webrtc/peerconnection_getstats.js b/chrome/test/data/webrtc/peerconnection_getstats.js
|
| index 6054a5cea7c19057127c4ec5898391e570d5ff35..7fa3333757bdf5a20da61810cde625504bcead6d 100644
|
| --- a/chrome/test/data/webrtc/peerconnection_getstats.js
|
| +++ b/chrome/test/data/webrtc/peerconnection_getstats.js
|
| @@ -301,6 +301,36 @@ function getStatsReportDictionary() {
|
| }
|
|
|
| /**
|
| + * Measures the performance of the promise-based |RTCPeerConnection.getStats|
|
| + * and returns the time it took in milliseconds as a double
|
| + * (DOMHighResTimeStamp, accurate to one thousandth of a millisecond).
|
| + * Verifies that all stats types of the whitelist were contained in the result.
|
| + *
|
| + * Returns "ok-" followed by a double on success.
|
| + */
|
| +function measureGetStatsPerformance() {
|
| + let t0 = performance.now();
|
| + peerConnection_().getStats()
|
| + .then(function(report) {
|
| + let t1 = performance.now();
|
| + let statsTypes = new Set();
|
| + for (let stats of report.values()) {
|
| + verifyStatsIsWhitelisted_(stats);
|
| + statsTypes.add(stats.type);
|
| + }
|
| + if (statsTypes.size != gStatsWhitelist.size) {
|
| + returnToTest('The returned report contains a different number (' +
|
| + statsTypes.size + ') of stats types than the whitelist. ' +
|
| + JSON.stringify(Array.from(statsTypes)));
|
| + }
|
| + returnToTest('ok-' + (t1 - t0));
|
| + },
|
| + function(e) {
|
| + throw failTest('Promise was rejected: ' + e);
|
| + });
|
| +}
|
| +
|
| +/**
|
| * Returns a complete list of whitelisted "RTCStats.type" values as a
|
| * JSON-stringified array of strings to the test.
|
| */
|
|
|