Bug 1657394: Test for cases where we have a fallback bundle transport. r=mjf

Differential Revision: https://phabricator.services.mozilla.com/D87955
This commit is contained in:
Byron Campen [:bwc] 2020-08-24 22:01:23 +00:00
Родитель b3d5a69b29
Коммит 2f24591f91
1 изменённых файлов: 25 добавлений и 6 удалений

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

@ -2557,21 +2557,40 @@ TEST_P(JsepSessionTest, RenegotiationAnswererDisablesBundleTransport) {
ASSERT_EQ(0U, ot0->mTransport.mComponents);
ASSERT_EQ(0U, at0->mTransport.mComponents);
// With bundle-policy "balanced", this ends up being somewhat complicated.
// The first m-section of each type is _not_ marked bundle-only,
// but subsequent m-sections of that type are. This means that if there is
// more than one type, there is more than one transport, which means there's
// a fallback when the bundle-tag is disabled (the first such transport). We
// should be using that fallback when it exists.
Maybe<size_t> fallbackTransport;
for (size_t level = 1; level != types.size(); ++level) {
if (types[level] != types[0]) {
fallbackTransport = Some(level);
break;
}
}
for (size_t i = 1; i < newOffererTransceivers.size(); ++i) {
JsepTransceiver* ot = GetTransceiverByLevel(newOffererTransceivers, i);
JsepTransceiver* at = GetTransceiverByLevel(newAnswererTransceivers, i);
JsepTransceiver* ot1 = GetTransceiverByLevel(newOffererTransceivers, 1);
JsepTransceiver* at1 = GetTransceiverByLevel(newAnswererTransceivers, 1);
// If there is no fallback, the bundle level will be left pointing at the
// dead transport at index 0.
size_t expectedBundleLevel = fallbackTransport.valueOr(0);
JsepTransceiver* otWithTransport =
GetTransceiverByLevel(newOffererTransceivers, expectedBundleLevel);
JsepTransceiver* atWithTransport =
GetTransceiverByLevel(newAnswererTransceivers, expectedBundleLevel);
ASSERT_TRUE(ot->HasBundleLevel());
ASSERT_TRUE(at->HasBundleLevel());
ASSERT_EQ(1U, ot->BundleLevel());
ASSERT_EQ(1U, at->BundleLevel());
ASSERT_EQ(expectedBundleLevel, ot->BundleLevel());
ASSERT_EQ(expectedBundleLevel, at->BundleLevel());
// TODO: When creating an answer where we have rejected the bundle
// transport, we do not do a good job of creating a sensible SDP. Mainly,
// when we remove the rejected mid from the bundle group, we can leave a
// bundle-only mid as the first one when others are available.
ASSERT_TRUE(Equals(ot1->mTransport, ot->mTransport));
ASSERT_TRUE(Equals(at1->mTransport, at->mTransport));
ASSERT_TRUE(Equals(otWithTransport->mTransport, ot->mTransport));
ASSERT_TRUE(Equals(atWithTransport->mTransport, at->mTransport));
}
}