зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
72aaaf526b
Коммит
8775f0efe3
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче