Fix PeerConnectionInterfaceTest_StartAndStopLoggingAfterPeerConnectionClosed

PeerConnectionInterfaceTest_StartAndStopLoggingAfterPeerConnectionClosed was using an invalid file, then checking that StartRtcEventLog returns false. Such a test might return a false positive, since StartRtcEventLog might fail because it was given an invalid file, rather than because the PC was already closed.


Bug: webrtc:8111
Change-Id: I844eb3b948b1406bb6f5cc63928eb26f0fb7b694
Reviewed-on: https://webrtc-review.googlesource.com/8541
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20253}
This commit is contained in:
Elad Alon 2017-10-11 16:04:13 +02:00 committed by Commit Bot
parent d3d7f44ddf
commit 9e6565b008

View File

@ -43,6 +43,7 @@
#include "rtc_base/stringutils.h"
#include "rtc_base/virtualsocketserver.h"
#include "test/gmock.h"
#include "test/testsupport/fileutils.h"
#ifdef WEBRTC_ANDROID
#include "pc/test/androidtestinitializer.h"
@ -3207,10 +3208,19 @@ TEST_F(PeerConnectionInterfaceTest,
// The RtcEventLog will be reset when the PeerConnection is closed.
pc_->Close();
rtc::PlatformFile file = 0;
int64_t max_size_bytes = 1024;
auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
std::string filename = webrtc::test::OutputPath() +
test_info->test_case_name() + test_info->name();
rtc::PlatformFile file = rtc::CreatePlatformFile(filename);
constexpr int64_t max_size_bytes = 1024;
EXPECT_FALSE(pc_->StartRtcEventLog(file, max_size_bytes));
pc_->StopRtcEventLog();
// Cleanup.
rtc::ClosePlatformFile(file);
rtc::RemoveFile(filename);
}
// Test that generated offers/answers include "ice-option:trickle".