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..4a81978a509ccface3678249f71e9bf5f346975f 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 getStatsReportDictionary() { |
+ 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)); |
+ }, |
+ 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. |
*/ |