[Unit test] Add check to prevent segfault on empty vector.

We rather have an unmet expectation than let the test crash.

Bug: webrtc:10827
Change-Id: I9e3d2dfb7cb856976305cd50377a71a2ed2ab4b2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146700
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28651}
This commit is contained in:
Yves Gerey 2019-07-23 19:15:39 +02:00 committed by Commit Bot
parent b9f5989e05
commit f781bb57c3

View File

@ -4863,6 +4863,7 @@ TEST_P(PeerConnectionIntegrationTest, GetSourcesVideo) {
ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_VIDEO); ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_VIDEO);
auto sources = receiver->GetSources(); auto sources = receiver->GetSources();
ASSERT_GT(receiver->GetParameters().encodings.size(), 0u); ASSERT_GT(receiver->GetParameters().encodings.size(), 0u);
ASSERT_GT(sources.size(), 0u);
EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc, EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc,
sources[0].source_id()); sources[0].source_id());
EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type()); EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());