Remove unnecessary overload in RtcEventLogOutput

Bug: webrtc:13579
Change-Id: I3ea4b8ce8d111ae6b9ce7e92f75bd4196bc9656b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268420
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37508}
This commit is contained in:
Ali Tofigh
2022-07-12 16:08:13 +02:00
committed by WebRTC LUCI CQ
parent c8f9c56bc8
commit b7821cea6b
7 changed files with 22 additions and 27 deletions

View File

@ -33,11 +33,6 @@ class RtcEventLogOutput {
// about how much data was written, if any. The output sink becomes inactive
// after the first time `false` is returned. Write() may not be called on
// an inactive output sink.
virtual bool Write(const std::string& output) {
return Write(absl::string_view(output));
}
// TODO(bugs.webrtc.org/13579): Remove the string ref once all classes
// implement the string_view version.
virtual bool Write(absl::string_view output) = 0;
// Indicates that buffers should be written to disk if applicable.

View File

@ -78,9 +78,9 @@ TEST_F(RtcEventLogOutputFileTest, LimitedOutputFileCappedToCapacity) {
auto output_file =
std::make_unique<RtcEventLogOutputFile>(output_file_name_, 2);
output_file->Write(absl::string_view("1"));
output_file->Write(absl::string_view("2"));
output_file->Write(absl::string_view("3"));
output_file->Write("1");
output_file->Write("2");
output_file->Write("3");
// Unsuccessful writes close the file; no need to delete the output to flush.
EXPECT_EQ(GetOutputFileContents(), "12");
@ -108,20 +108,20 @@ TEST_F(RtcEventLogOutputFileTest, DoNotWritePartialLines) {
TEST_F(RtcEventLogOutputFileTest, UnsuccessfulWriteReturnsFalse) {
auto output_file =
std::make_unique<RtcEventLogOutputFile>(output_file_name_, 2);
EXPECT_FALSE(output_file->Write(absl::string_view("abc")));
EXPECT_FALSE(output_file->Write("abc"));
}
TEST_F(RtcEventLogOutputFileTest, SuccessfulWriteReturnsTrue) {
auto output_file =
std::make_unique<RtcEventLogOutputFile>(output_file_name_, 3);
EXPECT_TRUE(output_file->Write(absl::string_view("abc")));
EXPECT_TRUE(output_file->Write("abc"));
}
// Even if capacity is reached, a successful write leaves the output active.
TEST_F(RtcEventLogOutputFileTest, FileStillActiveAfterSuccessfulWrite) {
auto output_file =
std::make_unique<RtcEventLogOutputFile>(output_file_name_, 3);
ASSERT_TRUE(output_file->Write(absl::string_view("abc")));
ASSERT_TRUE(output_file->Write("abc"));
EXPECT_TRUE(output_file->IsActive());
}
@ -130,7 +130,7 @@ TEST_F(RtcEventLogOutputFileTest, FileStillActiveAfterSuccessfulWrite) {
TEST_F(RtcEventLogOutputFileTest, FileInactiveAfterUnsuccessfulWrite) {
auto output_file =
std::make_unique<RtcEventLogOutputFile>(output_file_name_, 2);
ASSERT_FALSE(output_file->Write(absl::string_view("abc")));
ASSERT_FALSE(output_file->Write("abc"));
EXPECT_FALSE(output_file->IsActive());
}
@ -145,9 +145,9 @@ class RtcEventLogOutputFileDeathTest : public RtcEventLogOutputFileTest {};
TEST_F(RtcEventLogOutputFileDeathTest, WritingToInactiveFileForbidden) {
RtcEventLogOutputFile output_file(output_file_name_, 2);
ASSERT_FALSE(output_file.Write(absl::string_view("abc")));
ASSERT_FALSE(output_file.Write("abc"));
ASSERT_FALSE(output_file.IsActive());
EXPECT_DEATH(output_file.Write(absl::string_view("abc")), "");
EXPECT_DEATH(output_file.Write("abc"), "");
}
TEST_F(RtcEventLogOutputFileDeathTest, DisallowUnreasonableFileSizeLimits) {