Fixed REMB unit test on Windows.
TBR=pwestin Review URL: http://webrtc-codereview.appspot.com/330022 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1289 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f4d3b9d5a1
commit
51faeed6be
@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "modules/rtp_rtcp/interface/rtp_rtcp.h"
|
#include "modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||||
#include "modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
|
#include "modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
|
||||||
@ -31,6 +34,14 @@ class ViERembTest : public ::testing::Test {
|
|||||||
vie_remb_.reset(new VieRemb(1234));
|
vie_remb_.reset(new VieRemb(1234));
|
||||||
}
|
}
|
||||||
scoped_ptr<VieRemb> vie_remb_;
|
scoped_ptr<VieRemb> vie_remb_;
|
||||||
|
|
||||||
|
void TestSleep(unsigned int time_ms) {
|
||||||
|
#if defined(_WIN32)
|
||||||
|
::Sleep(time_ms);
|
||||||
|
#else
|
||||||
|
usleep(time_ms * 1000);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ViERembTest, OneModuleTestForSendingRemb)
|
TEST_F(ViERembTest, OneModuleTestForSendingRemb)
|
||||||
@ -49,7 +60,7 @@ TEST_F(ViERembTest, OneModuleTestForSendingRemb)
|
|||||||
.WillRepeatedly(Return(ssrc[0]));
|
.WillRepeatedly(Return(ssrc[0]));
|
||||||
|
|
||||||
// TODO(mflodman) Add fake clock and remove the lowered bitrate below.
|
// TODO(mflodman) Add fake clock and remove the lowered bitrate below.
|
||||||
usleep(1010000);
|
TestSleep(1010);
|
||||||
EXPECT_CALL(rtp, SetREMBData(bitrate_estimate, 1, _))
|
EXPECT_CALL(rtp, SetREMBData(bitrate_estimate, 1, _))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
vie_remb_->Process();
|
vie_remb_->Process();
|
||||||
@ -150,7 +161,7 @@ TEST_F(ViERembTest, NoRembForIncreasedBitrate)
|
|||||||
|
|
||||||
// Trigger a first call to have a running state.
|
// Trigger a first call to have a running state.
|
||||||
// TODO(mflodman) Add fake clock.
|
// TODO(mflodman) Add fake clock.
|
||||||
usleep(1010000);
|
TestSleep(1010);
|
||||||
EXPECT_CALL(rtp_0,
|
EXPECT_CALL(rtp_0,
|
||||||
SetREMBData(bitrate_estimate[0] + bitrate_estimate[1], 2, _))
|
SetREMBData(bitrate_estimate[0] + bitrate_estimate[1], 2, _))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
@ -258,7 +269,7 @@ TEST_F(ViERembTest, NoOnReceivedBitrateChangedCall)
|
|||||||
|
|
||||||
vie_remb_->AddReceiveChannel(&rtp);
|
vie_remb_->AddReceiveChannel(&rtp);
|
||||||
// TODO(mflodman) Add fake clock.
|
// TODO(mflodman) Add fake clock.
|
||||||
usleep(1010000);
|
TestSleep(1010);
|
||||||
// No bitrate estimate given, no callback expected.
|
// No bitrate estimate given, no callback expected.
|
||||||
EXPECT_CALL(rtp, SetREMBData(_, _, _))
|
EXPECT_CALL(rtp, SetREMBData(_, _, _))
|
||||||
.Times(0);
|
.Times(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user