Clean up temporary event log file after test.
Bug: webrtc:12084 Change-Id: If17140b6af8f88faf7808645ca8998a5540aad06 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212963 Commit-Queue: Björn Terelius <terelius@webrtc.org> Reviewed-by: Elad Alon <eladalon@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33564}
This commit is contained in:

committed by
Commit Bot

parent
175b723ce9
commit
c4d3e34d36
@ -899,9 +899,9 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
|
|||||||
|
|
||||||
auto task_queue_factory = CreateDefaultTaskQueueFactory();
|
auto task_queue_factory = CreateDefaultTaskQueueFactory();
|
||||||
RtcEventLogFactory rtc_event_log_factory(task_queue_factory.get());
|
RtcEventLogFactory rtc_event_log_factory(task_queue_factory.get());
|
||||||
// When log_dumper goes out of scope, it causes the log file to be flushed
|
// When `log` goes out of scope, it causes the log file to be flushed
|
||||||
// to disk.
|
// to disk.
|
||||||
std::unique_ptr<RtcEventLog> log_dumper =
|
std::unique_ptr<RtcEventLog> log =
|
||||||
rtc_event_log_factory.CreateRtcEventLog(encoding_type_);
|
rtc_event_log_factory.CreateRtcEventLog(encoding_type_);
|
||||||
|
|
||||||
for (size_t i = 0; i < kNumEvents; i++) {
|
for (size_t i = 0; i < kNumEvents; i++) {
|
||||||
@ -911,18 +911,18 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
|
|||||||
// simplicity.
|
// simplicity.
|
||||||
// We base the various values on the index. We use this for some basic
|
// We base the various values on the index. We use this for some basic
|
||||||
// consistency checks when we read back.
|
// consistency checks when we read back.
|
||||||
log_dumper->Log(std::make_unique<RtcEventProbeResultSuccess>(
|
log->Log(std::make_unique<RtcEventProbeResultSuccess>(
|
||||||
i, kStartBitrate + i * 1000));
|
i, kStartBitrate + i * 1000));
|
||||||
fake_clock->AdvanceTime(TimeDelta::Millis(10));
|
fake_clock->AdvanceTime(TimeDelta::Millis(10));
|
||||||
}
|
}
|
||||||
int64_t start_time_us = rtc::TimeMicros();
|
int64_t start_time_us = rtc::TimeMicros();
|
||||||
int64_t utc_start_time_us = rtc::TimeUTCMicros();
|
int64_t utc_start_time_us = rtc::TimeUTCMicros();
|
||||||
log_dumper->StartLogging(
|
log->StartLogging(
|
||||||
std::make_unique<RtcEventLogOutputFile>(temp_filename, 10000000),
|
std::make_unique<RtcEventLogOutputFile>(temp_filename, 10000000),
|
||||||
RtcEventLog::kImmediateOutput);
|
RtcEventLog::kImmediateOutput);
|
||||||
fake_clock->AdvanceTime(TimeDelta::Millis(10));
|
fake_clock->AdvanceTime(TimeDelta::Millis(10));
|
||||||
int64_t stop_time_us = rtc::TimeMicros();
|
int64_t stop_time_us = rtc::TimeMicros();
|
||||||
log_dumper->StopLogging();
|
log->StopLogging();
|
||||||
|
|
||||||
// Read the generated file from disk.
|
// Read the generated file from disk.
|
||||||
ParsedRtcEventLog parsed_log;
|
ParsedRtcEventLog parsed_log;
|
||||||
@ -960,6 +960,9 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
|
|||||||
RtcEventProbeResultSuccess(first_id + i, first_bitrate_bps + i * 1000),
|
RtcEventProbeResultSuccess(first_id + i, first_bitrate_bps + i * 1000),
|
||||||
probe_success_events[i]);
|
probe_success_events[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up temporary file - can be pretty slow.
|
||||||
|
remove(temp_filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
|
Reference in New Issue
Block a user