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

Unified 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: Updated peerconnection.js (re-running trybots can wait, will need to rebase with master) Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webrtc/peerconnection.js
diff --git a/chrome/test/data/webrtc/peerconnection.js b/chrome/test/data/webrtc/peerconnection.js
index 639e0f41a8ff34624bc5be8ea6fed1aeb640b757..2f4f1c6d8235c1c983e73b7f8c99398439fd6709 100644
--- a/chrome/test/data/webrtc/peerconnection.js
+++ b/chrome/test/data/webrtc/peerconnection.js
@@ -289,6 +289,36 @@ function hasSeenCryptoInSdp() {
returnToTest(gHasSeenCryptoInSdp);
}
+/**
+ * Gets and iterates stats. Makes sure at least one report stat is returned.
+ *
+ * Returns ok on success.
+ */
+function getStats() {
+ peerConnection_().getStats(
+ function(response) {
+ var statsStr = '';
+ var reports = response.result();
+ var numStats = 0;
+ for (var i = 0; i < reports.length; i++) {
+ var report = reports[i];
+ statsStr += '\nReport #' + i + ': ' + report.id + ' (type: ' +
phoglund_chromium 2016/07/27 12:52:10 Maybe call it statsText or result? It appears this
hbos_chromium 2016/07/27 13:50:31 Done.
+ report.type + ', timestamp: ' + report.timestamp + ')';
+ var statNames = report.names();
+ numStats += statNames.length;
+ for (var j = 0; j < statNames.length; j++) {
+ var statName = statNames[j];
+ var statValue = report.stat(statName);
+ statsStr += '\n- ' + statName + ': ' + statValue;
+ }
+ }
+ console.log('getStats:' + statsStr);
+ if (numStats === 0)
+ throw failTest('No stats was returned by getStats.');
+ returnToTest('ok');
phoglund_chromium 2016/07/27 12:52:10 ok-got-stats perhaps?
hbos_chromium 2016/07/27 13:50:31 Done.
+ });
+}
+
// Internals.
/** @private */

Powered by Google App Engine
This is Rietveld 408576698