Commit eddff228 authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Commit Bot

Added test for generating stats for a track added using addTrack

Also fixes a misspelling of "timestamp" as "timeStamp".

Bug: webrtc:8616
Change-Id: I76304d9235bbb1e4fca1e821a2e10dff0777bb2d
Reviewed-on: https://chromium-review.googlesource.com/824269
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523806}
parent 6aee1571
......@@ -6,9 +6,11 @@ FAIL getStats() with track added via addTrack should succeed promise_test: Unhan
FAIL getStats() with track added via addTransceiver should succeed assert_idl_attribute: Expect pc to have addTransceiver() method property "addTransceiver" not found in prototype chain
FAIL getStats() with track associated with more than one sender should reject with InvalidAccessError promise_test: Unhandled rejection with value: object "TypeError: pc.addTransceiver is not a function"
FAIL getStats() with track associated with both sender and receiver should reject with InvalidAccessError pc.addTransceiver is not a function
FAIL getStats() with no argument should return stats report containing peer-connection stats assert_equals: Expect dictionary.timeStamp to be number expected "number" but got "undefined"
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'getStats' on 'RTCPeerConnection': The callback provided as parameter 1 is not a function."
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats pc.addTransceiver is not a function
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.timeStamp to be number expected "number" but got "undefined" Reached unreachable code
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.issuerCertificateId to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
......@@ -122,7 +122,35 @@
validateStatsReport(statsReport);
assert_stats_report_has_stats(statsReport, ['peer-connection']);
});
}, 'getStats() with no argument should return stats report containing peer-connection stats');
}, 'getStats() with no argument should return stats report containing peer-connection stats on an empty PC');
promise_test(t => {
const pc = new RTCPeerConnection();
return getTrackFromUserMedia('audio')
.then(([track, mediaStream]) => {
pc.addTrack(track, mediaStream);
return pc.getStats();
})
.then(statsReport => {
validateStatsReport(statsReport);
assert_stats_report_has_stats(statsReport, ['peer-connection']);
assert_stats_report_has_stats(statsReport, ['outbound-rtp']);
});
}, 'getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats');
promise_test(t => {
const pc = new RTCPeerConnection();
return getTrackFromUserMedia('audio')
.then(([track, mediaStream]) => {
pc.addTrack(track);
return pc.getStats();
})
.then(statsReport => {
validateStatsReport(statsReport);
assert_stats_report_has_stats(statsReport, ['peer-connection']);
assert_stats_report_has_stats(statsReport, ['outbound-rtp']);
});
}, 'getStats() with no argument should return stats for no-stream tracks');
/*
8.5. The stats selection algorithm
......
......@@ -136,7 +136,7 @@ function validateOptionalIdField(statsReport, stats, field, type) {
};
*/
function validateRtcStats(statsReport, stats) {
assert_number_field(stats, 'timeStamp');
assert_number_field(stats, 'timestamp');
assert_string_field(stats, 'type');
assert_string_field(stats, 'id');
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment