function verifyStatsGeneratedPromise() {
  peerConnection_().getStats()
    .then(function(report) {
      if (report == null || report.size == 0)
        throw new failTest('report is null or empty.');
      let statsTypes = new Set();
      let ids = new Set();
      for (let stats of report.values()) {
        verifyStatsIsWhitelisted_(stats);
        statsTypes.add(stats.type);
        if (ids.has(stats.id))
          throw failTest('stats.id is not a unique identifier.');
        ids.add(stats.id);
      }
      returnToTest('ok-' + JSON.stringify(Array.from(statsTypes.values())));
    },
    function(e) {
      throw failTest('Promise was rejected: ' + e);
    });
}
/**
 * Verifies that the promise-based |RTCPeerConnection.getStats| returns stats,
 * makes sure that all returned stats have the base RTCStats-members and that
 * all stats are allowed by the whitelist.
 *
 * Returns "ok-" followed by JSON-stringified array of "RTCStats.type" values
 * to the test, these being the different types of stats that was returned by
 * this call to getStats.
 */
Verifies that the promise-based |RTCPeerConnection.getStats| returns stats,
makes sure that all returned stats have the base RTCStats-members and that
all stats are allowed by the whitelist.

Returns "ok-" followed by JSON-stringified array of "RTCStats.type" values
to the test, these being the different types of stats that was returned by
this call to getStats.
Verifies that the promise - based |RTCPeerConnection . getStats| returns stats makes sure that all returned stats have the base RTCStats - members and that all stats are allowed by the whitelist . Returns " ok - " followed by JSON - stringified array of " RTCStats . type " values to the test these being the different types of stats that was returned by this call to getStats .
function verifyStatsGeneratedPromise() {
  peerConnection_().getStats()
    .then(function(report) {
      if (report == null || report.size == 0)
        throw new failTest('report is null or empty.');
      let statsTypes = new Set();
      let ids = new Set();
      for (let stats of report.values()) {
        verifyStatsIsWhitelisted_(stats);
        statsTypes.add(stats.type);
        if (ids.has(stats.id))
          throw failTest('stats.id is not a unique identifier.');
        ids.add(stats.id);
      }
      returnToTest('ok-' + JSON.stringify(Array.from(statsTypes.values())));
    },
    function(e) {
      throw failTest('Promise was rejected: ' + e);
    });
}
function verifyStatsGeneratedPromise ( ) { peerConnection_ ( ) . getStats ( ) . then ( function ( report ) { if ( report == null || report . size == 0 ) throw new failTest ( 'report is null or empty.' ) ; let statsTypes = new Set ( ) ; let ids = new Set ( ) ; for ( let stats of report . values ( ) ) { verifyStatsIsWhitelisted_ ( stats ) ; statsTypes . add ( stats . type ) ; if ( ids . has ( stats . id ) ) throw failTest ( 'stats.id is not a unique identifier.' ) ; ids . add ( stats . id ) ; } returnToTest ( 'ok-' + JSON . stringify ( Array . from ( statsTypes . values ( ) ) ) ) ; } , function ( e ) { throw failTest ( 'Promise was rejected: ' + e ) ; } ) ; }
Verifies that the promise-based |RTCPeerConnection.getStats| returns stats,
 makes sure that all returned stats have the base RTCStats-members and that
 all stats are allowed by the whitelist.
Verifies that the promise - based |RTCPeerConnection . getStats| returns stats makes sure that all returned stats have the base RTCStats - members and that all stats are allowed by the whitelist .