Chromium Code Reviews| 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 9eea0b6e924bbbe8e6e04ef942f3361e6d84df7b..3bc2f1854bdfb1fb308490f8bd1375541c8c60e6 100644 |
| --- a/chrome/test/data/webrtc/peerconnection_getstats.js |
| +++ b/chrome/test/data/webrtc/peerconnection_getstats.js |
| @@ -261,6 +261,29 @@ function verifyStatsGeneratedPromise() { |
| } |
| /** |
| + * Gets the result of the promise-based |RTCPeerConnection.getStats| as a |
| + * dictionary of RTCStats-dictionaries. |
| + * |
| + * Returns "ok-" followed by a JSON-stringified dictionary of dictionaries to |
| + * the test. |
| + */ |
| +function getStatsAsDictionary() { |
| + peerConnection_().getStats() |
| + .then(function(report) { |
| + if (report == null || report.size == 0) |
| + throw new failTest('report is null or empty.'); |
| + let reportDictionary = {}; |
| + for (let stats of report.values()) { |
| + reportDictionary[stats.id] = stats; |
| + } |
| + returnToTest('ok-' + JSON.stringify(reportDictionary, null, ' ')); |
|
hbos_chromium
2016/11/30 12:38:05
nit: "null, ' '" does pretty indented JSON, I did
|
| + }, |
| + 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. |
| */ |