Bug 1425618 - Part 1: Test-cases for offerToReceiveX: false. r=jib

MozReview-Commit-ID: FGkD1QJ9Us2

--HG--
extra : rebase_source : 6a42d3e352f79e811823b2ff19066bb0a9bc752e
This commit is contained in:
Byron Campen [:bwc] 2017-12-18 11:44:45 -06:00
Родитель 72aaaf526b
Коммит 8775f0efe3
1 изменённых файлов: 39 добавлений и 6 удалений

Просмотреть файл

@ -356,14 +356,18 @@
let checkAddTransceiverWithOfferToReceive = async kinds => { let checkAddTransceiverWithOfferToReceive = async kinds => {
let pc = new RTCPeerConnection(); let pc = new RTCPeerConnection();
let propsToSet = kinds.map(kind => {
if (kind == "audio") {
return "offerToReceiveAudio";
} else if (kind == "video") {
return "offerToReceiveVideo";
}
});
let options = {}; let options = {};
for (let kind of kinds) { for (let prop of propsToSet) {
if (kind == "audio") { options[prop] = true;
options.offerToReceiveAudio = true;
} else if (kind == "video") {
options.offerToReceiveVideo = true;
}
} }
let offer = await pc.createOffer(options); let offer = await pc.createOffer(options);
@ -398,6 +402,35 @@
hasProps(pc.getTransceivers(), expected); hasProps(pc.getTransceivers(), expected);
// Test offerToReceive: false
for (let prop of propsToSet) {
options[prop] = false;
}
// Check that sendrecv goes to sendonly
for (let transceiver of pc.getTransceivers()) {
transceiver.direction = "sendrecv";
}
for (let transceiverCheck of expected) {
transceiverCheck.direction = "sendonly";
}
offer = await pc.createOffer(options);
hasProps(pc.getTransceivers(), expected);
// Check that recvonly goes to inactive
for (let transceiver of pc.getTransceivers()) {
transceiver.direction = "recvonly";
}
for (let transceiverCheck of expected) {
transceiverCheck.direction = "inactive";
}
offer = await pc.createOffer(options);
hasProps(pc.getTransceivers(), expected);
pc.close(); pc.close();
}; };