зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1478285 [wpt PR 12179] - webrtc wpt: remove generateMediaStreamTrack, add cleanup after getNoiseStream, a=testonly
Automatic update from web-platform-testswebrtc wpt: remove generateMediaStreamTrack, add cleanup after getNoiseStream BUG=836871 Change-Id: I278b34cb305a13a029e84eaaeec57144e2858678 Reviewed-on: https://chromium-review.googlesource.com/1149364 Reviewed-by: Henrik Boström <hbos@chromium.org> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> Cr-Commit-Position: refs/heads/master@{#578611} -- wpt-commits: 36c9fdd4ef36c289f416a16707074157d818ea7c wpt-pr: 12179
This commit is contained in:
Родитель
46e8c589b8
Коммит
88e0508f9f
|
@ -642526,7 +642526,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-addTransceiver.https.html": [
|
||||
"347603cef6e5eaed70077ebc4bbb8abcff7b78d4",
|
||||
"c0c5d782c2fa365052d08d63eb14954a756c8bc0",
|
||||
"testharness"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-canTrickleIceCandidates.html": [
|
||||
|
@ -642578,7 +642578,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-helper.js": [
|
||||
"597170f8c91ca0790b68c32def31a48e529ded6f",
|
||||
"27ff1873790cfc4f71a07e1735ec4389ee330a18",
|
||||
"support"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-iceConnectionState.html": [
|
||||
|
@ -642654,7 +642654,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html": [
|
||||
"91828f962aaf7b6076398da9a0447aef3586e46d",
|
||||
"7179f1ef78ccd5b5b956df6241d0b2b47c7425a4",
|
||||
"testharness"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-setRemoteDescription.html": [
|
||||
|
@ -642802,7 +642802,7 @@
|
|||
"support"
|
||||
],
|
||||
"webrtc/interfaces.https.html": [
|
||||
"0eefc90c210c9c1587978fbc4ae9df7f5a4da080",
|
||||
"a834f895abcc13d31da6a529b0c30d72e01c753c",
|
||||
"testharness"
|
||||
],
|
||||
"webrtc/no-media-call.html": [
|
||||
|
|
|
@ -3,16 +3,12 @@
|
|||
<title>RTCPeerConnection.prototype.addTransceiver</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="RTCPeerConnection-helper.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
// Test is based on the following editor draft:
|
||||
// https://rawgit.com/w3c/webrtc-pc/cc8d80f455b86c8041d63bceb8b457f45c72aa89/webrtc.html
|
||||
|
||||
// The following helper functions are called from RTCPeerConnection-helper.js:
|
||||
// generateMediaStreamTrack()
|
||||
|
||||
/*
|
||||
5.1. RTCPeerConnection Interface Extensions
|
||||
|
||||
|
@ -244,11 +240,13 @@
|
|||
5. If the first argument is a MediaStreamTrack , let it be track and let
|
||||
kind be track.kind.
|
||||
*/
|
||||
test(t => {
|
||||
promise_test(async t => {
|
||||
const pc = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc.close());
|
||||
|
||||
const track = generateMediaStreamTrack('audio');
|
||||
const stream = await navigator.mediaDevices.getUserMedia({audio: true});
|
||||
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
|
||||
const [track] = stream.getTracks();
|
||||
const transceiver = pc.addTransceiver(track);
|
||||
const { sender, receiver } = transceiver;
|
||||
|
||||
|
@ -282,11 +280,13 @@
|
|||
|
||||
}, 'addTransceiver(track) should have result with sender.track be given track');
|
||||
|
||||
test(t => {
|
||||
promise_test(async t => {
|
||||
const pc = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc.close());
|
||||
|
||||
const track = generateMediaStreamTrack('audio');
|
||||
const stream = await navigator.mediaDevices.getUserMedia({audio: true});
|
||||
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
|
||||
const [track] = stream.getTracks();
|
||||
const transceiver1 = pc.addTransceiver(track);
|
||||
const transceiver2 = pc.addTransceiver(track);
|
||||
|
||||
|
|
|
@ -330,30 +330,6 @@ function assert_equals_array_buffer(buffer1, buffer2) {
|
|||
}
|
||||
}
|
||||
|
||||
// Generate a MediaStreamTrack for testing use.
|
||||
// We generate it by creating an anonymous RTCPeerConnection,
|
||||
// call addTransceiver(), and use the remote track
|
||||
// from RTCRtpReceiver. This track is supposed to
|
||||
// receive media from a remote peer and be played locally.
|
||||
// We use this approach instead of getUserMedia()
|
||||
// to bypass the permission dialog and fake media devices,
|
||||
// as well as being able to generate many unique tracks.
|
||||
function generateMediaStreamTrack(kind) {
|
||||
const pc = new RTCPeerConnection();
|
||||
|
||||
assert_idl_attribute(pc, 'addTransceiver',
|
||||
'Expect pc to have addTransceiver() method');
|
||||
|
||||
const transceiver = pc.addTransceiver(kind);
|
||||
const { receiver } = transceiver;
|
||||
const { track } = receiver;
|
||||
|
||||
assert_true(track instanceof MediaStreamTrack,
|
||||
'Expect receiver track to be instance of MediaStreamTrack');
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
// These media tracks will be continually updated with deterministic "noise" in
|
||||
// order to ensure UAs do not cease transmission in response to apparent
|
||||
// silence.
|
||||
|
|
|
@ -85,6 +85,8 @@
|
|||
getNoiseStream({audio: true}),
|
||||
getNoiseStream({audio: true}),
|
||||
]);
|
||||
t.add_cleanup(() => localStreams.forEach((stream) =>
|
||||
stream.getTracks().forEach((track) => track.stop())));
|
||||
caller.addTrack(localStreams[0].getTracks()[0], localStreams[0]);
|
||||
caller.addTrack(localStreams[1].getTracks()[0], localStreams[0]);
|
||||
let ontrackEventsFired = 0;
|
||||
|
@ -129,6 +131,8 @@
|
|||
getNoiseStream({audio: true}),
|
||||
getNoiseStream({audio: true}),
|
||||
]);
|
||||
t.add_cleanup(() => localStreams.forEach((stream) =>
|
||||
stream.getTracks().forEach((track) => track.stop())));
|
||||
caller.addTrack(localStreams[0].getTracks()[0], localStreams[0]);
|
||||
const remoteStreams = [];
|
||||
callee.ontrack = e => {
|
||||
|
@ -161,6 +165,8 @@
|
|||
getNoiseStream({audio: true}),
|
||||
getNoiseStream({audio: true}),
|
||||
]);
|
||||
t.add_cleanup(() => localStreams.forEach((stream) =>
|
||||
stream.getTracks().forEach((track) => track.stop())));
|
||||
caller.addTrack(localStreams[0].getTracks()[0], localStreams[0]);
|
||||
const remoteStreams = [];
|
||||
callee.ontrack = e => {
|
||||
|
@ -190,6 +196,8 @@
|
|||
getNoiseStream({audio: true}),
|
||||
getNoiseStream({audio: true}),
|
||||
]);
|
||||
t.add_cleanup(() => localStreams.forEach((stream) =>
|
||||
stream.getTracks().forEach((track) => track.stop())));
|
||||
caller.addTrack(localStreams[0].getTracks()[0],
|
||||
localStreams[0], localStreams[1]);
|
||||
const ontrackPromise = addEventListenerPromise(t, callee, 'track', e => {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
// The following helper functions are called from RTCPeerConnection-helper.js:
|
||||
// generateAnswer()
|
||||
// generateMediaStreamTrack()
|
||||
// getNoiseStream()
|
||||
|
||||
// Put the global IDL test objects under a parent object.
|
||||
// This allows easier search for the test cases when
|
||||
|
@ -155,10 +155,7 @@
|
|||
|
||||
'RTCIceTransport': ['idlTestObjects.iceTransport'],
|
||||
|
||||
// Test on both MediaStreamTrack from getUserMedia and transceiver
|
||||
'MediaStreamTrack': [
|
||||
`idlTestObjects.mediaStreamTrack`,
|
||||
`generateMediaStreamTrack('audio')`]
|
||||
'MediaStreamTrack': ['idlTestObjects.mediaStreamTrack']
|
||||
});
|
||||
|
||||
idlArray.test();
|
||||
|
|
Загрузка…
Ссылка в новой задаче