Reduce flakyness of timing dependent tests for TestFrameBuffer2.*.

BUG=
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1994623003 .

Cr-Commit-Position: refs/heads/master@{#12814}
This commit is contained in:
philipel
2016-05-19 17:07:44 +02:00
parent 00b9d210c4
commit 6e8224f4ab

View File

@ -185,16 +185,15 @@ class TestFrameBuffer2 : public ::testing::Test {
rtc::CriticalSection crit_;
};
TEST_F(TestFrameBuffer2, ExtractFromEmptyBuffer) {
ExtractFrame();
CheckNoFrame(0);
}
// Following tests are timing dependent. Either the timeouts have to
// be increased by a large margin, which would slow down all trybots,
// or we disable them for the very slow ones, like we do here.
#if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER)
TEST_F(TestFrameBuffer2, WaitForFrame) {
uint16_t pid = Rand();
uint32_t ts = Rand();
ExtractFrame(20);
ExtractFrame(50);
InsertFrame(pid, 0, ts, false);
CheckFrame(0, pid, 0);
}
@ -203,7 +202,7 @@ TEST_F(TestFrameBuffer2, OneSuperFrame) {
uint16_t pid = Rand();
uint32_t ts = Rand();
ExtractFrame(20);
ExtractFrame(50);
InsertFrame(pid, 1, ts, true);
InsertFrame(pid, 0, ts, false);
ExtractFrame();
@ -212,6 +211,31 @@ TEST_F(TestFrameBuffer2, OneSuperFrame) {
CheckFrame(1, pid, 1);
}
TEST_F(TestFrameBuffer2, OneLayerStreamReordered) {
uint16_t pid = Rand();
uint32_t ts = Rand();
InsertFrame(pid, 0, ts, false);
ExtractFrame();
CheckFrame(0, pid, 0);
for (int i = 1; i < 10; i += 2) {
ExtractFrame(50);
InsertFrame(pid + i + 1, 0, ts + (i + 1) * kFps10, false, pid + i);
clock_.AdvanceTimeMilliseconds(kFps10);
InsertFrame(pid + i, 0, ts + i * kFps10, false, pid + i - 1);
clock_.AdvanceTimeMilliseconds(kFps10);
ExtractFrame();
CheckFrame(i, pid + i, 0);
CheckFrame(i + 1, pid + i + 1, 0);
}
}
#endif // Timing dependent tests.
TEST_F(TestFrameBuffer2, ExtractFromEmptyBuffer) {
ExtractFrame();
CheckNoFrame(0);
}
TEST_F(TestFrameBuffer2, OneLayerStream) {
uint16_t pid = Rand();
uint32_t ts = Rand();
@ -227,25 +251,6 @@ TEST_F(TestFrameBuffer2, OneLayerStream) {
}
}
TEST_F(TestFrameBuffer2, OneLayerStreamReordered) {
uint16_t pid = Rand();
uint32_t ts = Rand();
InsertFrame(pid, 0, ts, false);
ExtractFrame();
CheckFrame(0, pid, 0);
for (int i = 1; i < 10; i += 2) {
ExtractFrame(15);
InsertFrame(pid + i + 1, 0, ts + (i + 1) * kFps10, false, pid + i);
clock_.AdvanceTimeMilliseconds(kFps10);
InsertFrame(pid + i, 0, ts + i * kFps10, false, pid + i - 1);
clock_.AdvanceTimeMilliseconds(kFps10);
ExtractFrame();
CheckFrame(i, pid + i, 0);
CheckFrame(i + 1, pid + i + 1, 0);
}
}
TEST_F(TestFrameBuffer2, DropTemporalLayerSlowDecoder) {
uint16_t pid = Rand();
uint32_t ts = Rand();