mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision fc33be9acfbf8e883fd9683c527aab22d842542b
This commit is contained in:
parent
d232705106
commit
09b1413275
32 changed files with 1112 additions and 577 deletions
|
@ -424,6 +424,52 @@
|
|||
'senderReport should contain remote-candidate stats');
|
||||
}, 'RTCRtpSender.getStats() contains only outbound-rtp and related stats');
|
||||
|
||||
promise_test(async function() {
|
||||
const caller = new RTCPeerConnection();
|
||||
const callee = new RTCPeerConnection();
|
||||
let [tracks, streams] = await getUserMediaTracksAndStreams(2);
|
||||
let sender = caller.addTrack(tracks[0], streams[0]);
|
||||
callee.addTrack(tracks[1], streams[1]);
|
||||
exchangeIceCandidates(caller, callee);
|
||||
await doSignalingHandshake(caller, callee);
|
||||
await onIceConnectionStateCompleted(caller);
|
||||
let receiver = caller.getReceivers()[0];
|
||||
|
||||
// Obtain inbound and outbound RTP stream stats on a full stats report.
|
||||
let fullReport = await caller.getStats();
|
||||
let outboundTrackStats = findStatsByTypeAndId(
|
||||
fullReport, 'track', sender.track.id);
|
||||
let outboundStats = findStatsByTypeAndMember(
|
||||
fullReport, 'outbound-rtp', 'trackId', outboundTrackStats.id);
|
||||
assert_true(outboundStats != null, 'Has stats for outbound RTP stream');
|
||||
let inboundTrackStats = findStatsByTypeAndId(
|
||||
fullReport, 'track', receiver.track.id);
|
||||
let inboundStats = findStatsByTypeAndMember(
|
||||
fullReport, 'inbound-rtp', 'trackId', inboundTrackStats.id);
|
||||
assert_true(inboundStats != null, 'Has stats for inbound RTP stream');
|
||||
|
||||
// Perform stats selection algorithm with receiver selector. The result
|
||||
// should contain the inbound-rtp but not the outbound-rtp.
|
||||
let receiverReport = await receiver.getStats();
|
||||
assert_true(receiverReport.has(inboundStats.id));
|
||||
assert_false(receiverReport.has(outboundStats.id));
|
||||
|
||||
// Validate the stats graph, ensuring all stats objects are reachable and
|
||||
// valid from the outbound-rtp stats.
|
||||
validateStatsGraph(receiverReport, receiverReport.get(inboundStats.id));
|
||||
// Ensure that the stats graph contains some expected dictionaries.
|
||||
assert_equals(findStatsOfType(receiverReport, 'track').length, 1,
|
||||
'receiverReport should contain track stats');
|
||||
assert_equals(findStatsOfType(receiverReport, 'transport').length, 1,
|
||||
'receiverReport should contain transport stats');
|
||||
assert_equals(findStatsOfType(receiverReport, 'candidate-pair').length, 1,
|
||||
'receiverReport should contain candidate-pair stats');
|
||||
assert_equals(findStatsOfType(receiverReport, 'local-candidate').length, 1,
|
||||
'receiverReport should contain local-candidate stats');
|
||||
assert_equals(findStatsOfType(receiverReport, 'remote-candidate').length, 1,
|
||||
'receiverReport should contain remote-candidate stats');
|
||||
}, 'RTCRtpReceiver.getStats() contains only inbound-rtp and related stats');
|
||||
|
||||
// Helpers.
|
||||
|
||||
function findStatsByTypeAndId(report, type, identifier) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<title>RTCRtpReceiver.prototype.getStats</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="RTCPeerConnection-helper.js"></script>
|
||||
<script src="dictionary-helper.js"></script>
|
||||
<script src="RTCStats-helper.js"></script>
|
||||
<script>
|
||||
|
@ -12,6 +13,9 @@
|
|||
// https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
|
||||
// https://w3c.github.io/webrtc-stats/archives/20170614/webrtc-stats.html
|
||||
|
||||
// The following helper functions are called from RTCPeerConnection-helper.js:
|
||||
// doSignalingHandshake
|
||||
|
||||
// The following helper function is called from RTCStats-helper.js
|
||||
// validateStatsReport
|
||||
// assert_stats_report_has_stats
|
||||
|
@ -40,15 +44,29 @@
|
|||
added.
|
||||
*/
|
||||
|
||||
promise_test(() => {
|
||||
const pc = new RTCPeerConnection();
|
||||
const { receiver } = pc.addTransceiver('audio');
|
||||
promise_test(async () => {
|
||||
const caller = new RTCPeerConnection();
|
||||
const callee = new RTCPeerConnection();
|
||||
const { receiver } = caller.addTransceiver('audio');
|
||||
|
||||
return receiver.getStats()
|
||||
.then(statsReport => {
|
||||
validateStatsReport(statsReport);
|
||||
assert_stats_report_has_stats(statsReport, ['inbound-rtp']);
|
||||
});
|
||||
}, 'receiver.getStats() should return stats report containing inbound-rtp stats');
|
||||
await doSignalingHandshake(caller, callee);
|
||||
const statsReport = await receiver.getStats();
|
||||
validateStatsReport(statsReport);
|
||||
assert_stats_report_has_stats(statsReport, ['inbound-rtp']);
|
||||
}, 'receiver.getStats() via addTransceiver should return stats report containing inbound-rtp stats');
|
||||
|
||||
promise_test(async () => {
|
||||
const caller = new RTCPeerConnection();
|
||||
const callee = new RTCPeerConnection();
|
||||
const stream = await navigator.mediaDevices.getUserMedia({audio:true});
|
||||
const [track] = stream.getTracks();
|
||||
caller.addTrack(track, stream);
|
||||
|
||||
await doSignalingHandshake(caller, callee);
|
||||
const receiver = callee.getReceivers()[0];
|
||||
const statsReport = await receiver.getStats();
|
||||
validateStatsReport(statsReport);
|
||||
assert_stats_report_has_stats(statsReport, ['inbound-rtp']);
|
||||
}, 'receiver.getStats() via addTrack should return stats report containing inbound-rtp stats');
|
||||
|
||||
</script>
|
|
@ -107,13 +107,20 @@
|
|||
}));
|
||||
}
|
||||
|
||||
// Main function to do the IDL test, using fetched IDL text
|
||||
function doIdlTest(idlText) {
|
||||
promise_test(async t => {
|
||||
await asyncInit();
|
||||
|
||||
const idlArray = new IdlArray();
|
||||
|
||||
let webrtcIdl = fetch('/interfaces/webrtc-pc.idl').then(r => r.text());
|
||||
let mediacaptureMainIdl = fetch('/interfaces/mediacapture-main.idl').then(r => r.text());
|
||||
|
||||
idlArray.add_untested_idls(mediacaptureMainIdl, { only: ['MediaStreamConstraints'] });
|
||||
idlArray.add_idls(webrtcIdl);
|
||||
|
||||
idlArray.add_untested_idls('interface EventHandler {};');
|
||||
idlArray.add_idls('interface EventTarget {};');
|
||||
idlArray.add_idls('interface MediaStreamTrack : EventTarget {};');
|
||||
idlArray.add_idls(idlText);
|
||||
|
||||
idlArray.add_objects({
|
||||
'RTCPeerConnection': [`new RTCPeerConnection()`],
|
||||
|
@ -159,13 +166,6 @@
|
|||
});
|
||||
|
||||
idlArray.test();
|
||||
}
|
||||
|
||||
promise_test(t => {
|
||||
return asyncInit()
|
||||
.then(() => fetch('/interfaces/webrtc-pc.idl'))
|
||||
.then(response => response.text())
|
||||
.then(doIdlTest);
|
||||
}, 'Main test driver');
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue