Files
tubestation/testing/web-platform/tests/webrtc/receiver-track-live.https.html
Dominique Hazael-Massieux 437f332c30 Bug 1744064 [wpt PR 31847] - Use webdriver to set permission on getUserMedia calls , a=testonly
Automatic update from web-platform-tests
Use webdriver to set permission on getUserMedia calls  (#31847)

* Remove fake-ui from chrome wptrunner

Rely instead of SetPermission webdriver hook; this allows testing permission denial.

* Use webdriver to set permission on getUserMedia calls

Rewrite mediacapture-streams using async/await for consistency in the process
Move a couple of manual tests back to automated as a result

* Catch web driver error more specifically when setting permission

per https://github.com/web-platform-tests/wpt/pull/31847#pullrequestreview-824508906

* Rename setPermission in setMediaPermission

per https://github.com/web-platform-tests/wpt/pull/31847#issuecomment-987261583

* Limit media capture permissions to what is strictly needed for the test

per https://github.com/web-platform-tests/wpt/pull/31847#issuecomment-987261583

* Align quoting styles for script loading
--

wpt-commits: 319a0a7580aaee957801545901150a0dabd9e735
wpt-pr: 31847
2021-12-20 11:38:14 +00:00

73 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Remote tracks should not get ended except for stop/close</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src='../mediacapture-streams/permission-helper.js'></script>
<script src="RTCPeerConnection-helper.js"></script>
</head>
<body>
<video id="video" controls autoplay playsinline></video>
<script>
let pc1, pc2;
let localTrack, remoteTrack;
promise_test(async (test) => {
await setMediaPermission("granted", ["microphone"]);
const localStream = await navigator.mediaDevices.getUserMedia({audio: true});
localTrack = localStream.getAudioTracks()[0];
pc1 = new RTCPeerConnection();
pc1.addTrack(localTrack, localStream);
pc2 = new RTCPeerConnection();
let trackPromise = new Promise(resolve => {
pc2.ontrack = e => resolve(e.track);
});
exchangeIceCandidates(pc1, pc2);
await exchangeOfferAnswer(pc1, pc2);
remoteTrack = await trackPromise;
video.srcObject = new MediaStream([remoteTrack]);
await video.play();
}, "Setup audio call");
promise_test(async (test) => {
pc1.getTransceivers()[0].direction = "inactive";
let offer = await pc1.createOffer();
await pc1.setLocalDescription(offer);
// Let's remove ssrc lines
let sdpLines = offer.sdp.split("\r\n");
offer.sdp = sdpLines.filter(line => line && !line.startsWith("a=ssrc")).join("\r\n") + "\r\n";
await pc2.setRemoteDescription(offer);
let answer = await pc2.createAnswer();
await pc2.setLocalDescription(answer);
await pc1.setRemoteDescription(answer);
assert_equals(remoteTrack.readyState, "live");
}, "Inactivate the audio transceiver");
promise_test(async (test) => {
pc1.getTransceivers()[0].direction = "sendonly";
await exchangeOfferAnswer(pc1, pc2);
assert_equals(remoteTrack.readyState, "live");
}, "Reactivate the audio transceiver");
promise_test(async (test) => {
pc1.close();
pc2.close();
localTrack.stop();
}, "Clean-up");
</script>
</body>
</html>