Stop using ScopedFakeClock in rtc_event_log_unittest

Use GlobalSimulatedTimeController instead.

Bug: webrtc:42223992
Change-Id: I021d1f64d8d9e6f8e252090dfb533da76a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/462022
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47359}
diff --git a/logging/rtc_event_log/rtc_event_log_unittest.cc b/logging/rtc_event_log/rtc_event_log_unittest.cc
index 7fde7cf..327f563 100644
--- a/logging/rtc_event_log/rtc_event_log_unittest.cc
+++ b/logging/rtc_event_log/rtc_event_log_unittest.cc
@@ -54,7 +54,6 @@
 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
 #include "modules/rtp_rtcp/source/rtp_dependency_descriptor_extension.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/fake_clock.h"
 #include "rtc_base/random.h"
 #include "rtc_base/time_utils.h"
 #include "system_wrappers/include/clock.h"
@@ -65,6 +64,7 @@
 #include "test/logging/memory_log_writer.h"
 #include "test/near_matcher.h"
 #include "test/testsupport/file_utils.h"
+#include "test/time_controller/simulated_time_controller.h"
 
 namespace webrtc {
 
@@ -138,12 +138,12 @@
         clock_(Timestamp::Micros(prng_.Rand<uint32_t>())),
         gen_(seed_ * 880001UL, &clock_),
         verifier_(encoding_type_),
+        time_controller_(Timestamp::Micros(prng_.Rand<uint32_t>())),
         log_storage_(),
         log_output_factory_(log_storage_.CreateFactory()) {
-    // `clock_` and `utc_clock_` may have arbitrary offset.
-    // UTC clock is only used for logging start event, so doesn't need to
-    // advance.
-    utc_clock_.SetTime(Timestamp::Micros(prng_.Rand<uint32_t>()));
+    // `clock_` and the global clock overridden by `time_controller_` may have
+    // arbitrary offset. The global clock is only used for logging start event,
+    // so doesn't need to advance.
     // Find the name of the current test, in order to use it as a temporary
     // filename.
     auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
@@ -226,7 +226,7 @@
   SimulatedClock clock_;
   test::EventGenerator gen_;
   test::EventVerifier verifier_;
-  ScopedFakeClock utc_clock_;
+  GlobalSimulatedTimeController time_controller_;
   std::string temp_filename_;
   MemoryLogStorage log_storage_;
   std::unique_ptr<LogWriterFactoryInterface> log_output_factory_;
@@ -885,8 +885,7 @@
                           RtcEventLog::EncodingType::NewFormat)));
 
 class RtcEventLogCircularBufferTest
-    : public ::testing::TestWithParam<RtcEventLog::EncodingType> {
-};
+    : public ::testing::TestWithParam<RtcEventLog::EncodingType> {};
 
 TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
   // TODO(terelius): Maybe make a separate RtcEventLogImplTest that can access
@@ -901,10 +900,9 @@
   std::replace(test_name.begin(), test_name.end(), '/', '_');
   const std::string temp_filename = test::OutputPath() + test_name;
 
-  // Use ScopedFakeClock to control result of `TimeUTCMicros` during
-  // `StartLogging`.
-  ScopedFakeClock utc_clock;
-  utc_clock.SetTime(kUtcTime);
+  // Use GlobalSimulatedTimeController to control result of `TimeUTCMicros`
+  // during `StartLogging`.
+  GlobalSimulatedTimeController time_controller(kUtcTime);
   const RtcEventLog::EncodingType encoding_type = GetParam();
   MemoryLogStorage log_storage;
   SimulatedClock clock(Timestamp::Seconds(1));