Parallelize MediaRecorder unittests.

Exchanging static filenames for temporary ones, permitting tests to be
run in parallel without conflicting parallel uses of the same filenames.

TBR=juberti@webrtc.org
BUG=2597
TEST=third_party/gtest-parallel/gtest-parallel -w 64 -r 100 out/Debug/libjingle_p2p_unittest

Review URL: https://webrtc-codereview.appspot.com/34589004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7987 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2015-01-02 09:01:20 +00:00
parent 3a70625caf
commit c62749fb47

View File

@ -51,7 +51,7 @@ class RtpDumpSinkTest : public testing::Test {
public:
virtual void SetUp() {
EXPECT_TRUE(rtc::Filesystem::GetTemporaryFolder(path_, true, NULL));
path_.SetFilename("sink-test.rtpdump");
path_.SetPathname(rtc::Filesystem::TempFilename(path_, "sink-test"));
sink_.reset(new RtpDumpSink(Open(path_.pathname())));
for (int i = 0; i < ARRAY_SIZE(rtp_buf_); ++i) {
@ -185,10 +185,10 @@ void TestMediaRecorder(BaseChannel* channel,
// Add the channel to the recorder.
rtc::Pathname path;
EXPECT_TRUE(rtc::Filesystem::GetTemporaryFolder(path, true, NULL));
path.SetFilename("send.rtpdump");
std::string send_file = path.pathname();
path.SetFilename("recv.rtpdump");
std::string recv_file = path.pathname();
std::string send_file =
rtc::Filesystem::TempFilename(path, "send");
std::string recv_file =
rtc::Filesystem::TempFilename(path, "recv");
if (video_media_channel) {
EXPECT_TRUE(recorder->AddChannel(static_cast<VideoChannel*>(channel),
Open(send_file), Open(recv_file), filter));
@ -260,10 +260,10 @@ void TestRecordHeaderAndMedia(BaseChannel* channel,
rtc::Pathname path;
EXPECT_TRUE(rtc::Filesystem::GetTemporaryFolder(path, true, NULL));
path.SetFilename("send-header.rtpdump");
std::string send_header_file = path.pathname();
path.SetFilename("recv-header.rtpdump");
std::string recv_header_file = path.pathname();
std::string send_header_file =
rtc::Filesystem::TempFilename(path, "send-header");
std::string recv_header_file =
rtc::Filesystem::TempFilename(path, "recv-header");
if (video_media_channel) {
EXPECT_TRUE(header_recorder->AddChannel(
static_cast<VideoChannel*>(channel),
@ -292,10 +292,10 @@ void TestRecordHeaderAndMedia(BaseChannel* channel,
// Create RTP header recorder.
rtc::scoped_ptr<MediaRecorder> recorder(new MediaRecorder);
path.SetFilename("send.rtpdump");
std::string send_file = path.pathname();
path.SetFilename("recv.rtpdump");
std::string recv_file = path.pathname();
std::string send_file =
rtc::Filesystem::TempFilename(path, "send");
std::string recv_file =
rtc::Filesystem::TempFilename(path, "recv");
if (video_media_channel) {
EXPECT_TRUE(recorder->AddChannel(
static_cast<VideoChannel*>(channel),