From c62749fb471a9bf30b05a270c532c49ebea2f03d Mon Sep 17 00:00:00 2001 From: "pbos@webrtc.org" Date: Fri, 2 Jan 2015 09:01:20 +0000 Subject: [PATCH] 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 --- talk/session/media/mediarecorder_unittest.cc | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/talk/session/media/mediarecorder_unittest.cc b/talk/session/media/mediarecorder_unittest.cc index b71a9845d..1e2d822a0 100644 --- a/talk/session/media/mediarecorder_unittest.cc +++ b/talk/session/media/mediarecorder_unittest.cc @@ -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(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(channel), @@ -292,10 +292,10 @@ void TestRecordHeaderAndMedia(BaseChannel* channel, // Create RTP header recorder. rtc::scoped_ptr 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(channel),