blob: 789a1b20a3ba24fe81eaf7c505b2b0ef26cdc12b [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing basic video exchange from offerer to receiver</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script src ="routines.js"></script>
<script>
function getOutboundRTPStats(connection)
{
return connection.getStats().then((report) => {
var stats;
report.forEach((statItem) => {
if (statItem.type === "outbound-rtp") {
stats = statItem;
}
});
return stats;
});
}
function checkOutboundBytesSentNotIncreasing(firstConnection, statsFirstConnection, count)
{
return getOutboundRTPStats(firstConnection).then((stats) => {
if (stats.bytesSent > statsFirstConnection.bytesSent)
return Promise.reject("outbound stats bytes sent increasing");
if (++count === 10)
return;
return waitFor(50).then(() => {
return checkOutboundBytesSentNotIncreasing(firstConnection, statsFirstConnection, count);
});
});
}
var track, firstConnection;
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
return navigator.mediaDevices.getUserMedia({ audio: true}).then((stream) => {
track = stream.getAudioTracks()[0];
track.enabled = false;
return new Promise((resolve, reject) => {
createConnections((connection) => {
firstConnection = connection;
firstConnection.addTrack(track, stream);
}, (connection) => {
connection.ontrack = resolve;
});
setTimeout(() => reject("Test timed out"), 5000);
});
}).then(() => {
return getOutboundRTPStats(firstConnection);
}).then((stats) => {
statsFirstConnection = stats;
return checkOutboundBytesSentNotIncreasing(firstConnection, statsFirstConnection, 0);
});
}, "Audio silent data not being sent in case track is muted from the start");
</script>
</body>
</html>