blob: a5043a4ee930d2e5f27d5b45b877b177aa701ddb [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing getParameters on a basic video exchange</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script src ="routines.js"></script>
<script>
var firstConnection, secondConnection;
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
var sender, receiver;
var localStream, remoteStream;
return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
localStream = stream;
return new Promise((resolve, reject) => {
createConnections((connection) => {
firstConnection = connection;
sender = firstConnection.addTrack(stream.getVideoTracks()[0], stream);
}, (connection) => {
secondConnection = connection;
receiver = secondConnection.addTransceiver("video").receiver;
secondConnection.ontrack = (trackEvent) => {
remoteStream = trackEvent.streams[0];
resolve();
};
});
setTimeout(() => reject("Test timed out"), 5000);
});
}).then(() => {
assert_true(!!sender, "sender should not be undefined");
assert_true(!!receiver, "receiver should not be undefined");
var senderParameters = sender.getParameters();
var receiverParameters = receiver.getParameters();
assert_true(!!senderParameters, "sender parameters should not be undefined or null");
assert_true(!!receiverParameters, "receiver parameters should not be undefined or null");
assert_array_equals(receiverParameters.codecs, [], "receiver codecs");
assert_array_equals(receiverParameters.headerExtensions, [], "receiver header extensions");
senderParameters.encodings[0].ssrc = 1;
senderParameters.encodings[0].fec.ssrc = 1;
senderParameters.encodings[0].rtx.ssrc = 1;
assert_true(!!senderParameters.transactionId, "sender transaction");
assert_array_equals(senderParameters.codecs, [], "sender codecs");
assert_array_equals(senderParameters.headerExtensions, [], "sender header extensions");
assert_equals(senderParameters.degradationPreference, "balanced", "sender degradation");
});
}, "Sender and receiver parameters");
</script>
</body>
</html>