Bug 1507039 [wpt PR 14043] - Remove display of stats by default in webrtc/get-stats.html, a=testonly
authorYouenn Fablet <youennf@gmail.com>
Thu, 22 Nov 2018 10:34:33 +0000
changeset 504352 a10a77ee35afb76664e632f7847f8b295e2db241
parent 504351 02868188c96f86cde78d1242b7cb15d888d42ad7
child 504353 c3369eff0b340736674c3e7747e97443e5831c58
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1507039, 14043
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507039 [wpt PR 14043] - Remove display of stats by default in webrtc/get-stats.html, a=testonly Automatic update from web-platform-testsRemove display of stats by default (user needs to click on a button for that). This allows having a consistent WebKitTestRunner output for this test. -- Merge pull request #14043 from youennf/fix-get-stats.html Remove display of stats by default in webrtc/get-stats.html -- wpt-commits: a6be85c1e8b8f301cd8412858cecf1d81923ff58, 6cdb358877f5e93e6e5933f92d4048c6876d324c wpt-pr: 14043
testing/web-platform/tests/webrtc/getstats.html
--- a/testing/web-platform/tests/webrtc/getstats.html
+++ b/testing/web-platform/tests/webrtc/getstats.html
@@ -7,26 +7,27 @@ This test uses data only, and thus does 
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>RTCPeerConnection GetStats</title>
 </head>
 <body>
   <div id="log"></div>
   <h2>Retrieved stats info</h2>
   <pre>
+  <input type="button" onclick="showStats()" value="Show stats"></input>
   <div id="stats">
   </div>
   </pre>
 
   <!-- These files are in place when executing on W3C. -->
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <script type="text/javascript">
   var test = async_test('Can get stats from a basic WebRTC call.');
-
+  var statsToShow;
   var gFirstConnection = null;
   var gSecondConnection = null;
 
   var onIceCandidateToFirst = test.step_func(function(event) {
     // If event.candidate is null = no more candidates.
     if (event.candidate) {
       gSecondConnection.addIceCandidate(event.candidate);
     }
@@ -51,23 +52,21 @@ This test uses data only, and thus does 
     // Wait until connection is established.
     // Note - not all browsers reach 'completed' state, so we're
     // checking for 'connected' state instead.
     if (gFirstConnection.iceConnectionState != 'connected') {
       return;
     }
     gFirstConnection.getStats()
     .then(function(report) {
-      // Show the retrieved stats info
-      var showStats = document.getElementById('stats');
       let reportDictionary = {};
       for (let stats of report.values()) {
         reportDictionary[stats.id] = stats;
       }
-      showStats.innerHTML = JSON.stringify(reportDictionary, null, 2);
+      statsToShow = JSON.stringify(reportDictionary, null, 2);
       // Check the stats properties.
       assert_not_equals(report, null, 'No report');
       let sessionStat = getStatsRecordByType(report, 'peer-connection');
       assert_not_equals(sessionStat, null, 'Did not find peer-connection stats');
       assert_own_property(sessionStat, 'dataChannelsOpened', 'no dataChannelsOpened stat');
       // Once every 4000 or so tests, the datachannel won't be opened when the getStats
       // function is done, so allow both 0 and 1 datachannels.
       assert_true(sessionStat.dataChannelsOpened == 1 || sessionStat.dataChannelsOpened == 0,
@@ -116,12 +115,19 @@ This test uses data only, and thus does 
       return gFirstConnection.setRemoteDescription(
           gSecondConnection.localDescription);
     })
     .catch(test.step_func(function(e) {
       assert_unreached('Error ' + e.name + ': ' + e.message +
                        ' happened at step ' + atStep);
     }));
   });
+
+  function showStats() {
+    // Show the retrieved stats info
+    var showStats = document.getElementById('stats');
+    showStats.innerHTML = statsToShow;
+  }
+
 </script>
 
 </body>
 </html>