diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /third_party/libwebrtc/api/metronome/test | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/api/metronome/test')
3 files changed, 11 insertions, 25 deletions
diff --git a/third_party/libwebrtc/api/metronome/test/BUILD.gn b/third_party/libwebrtc/api/metronome/test/BUILD.gn index f415d98a0b..94ecf9f727 100644 --- a/third_party/libwebrtc/api/metronome/test/BUILD.gn +++ b/third_party/libwebrtc/api/metronome/test/BUILD.gn @@ -16,15 +16,8 @@ rtc_library("fake_metronome") { ] deps = [ "..:metronome", - "../..:priority", - "../..:sequence_checker", - "../../../rtc_base:macromagic", - "../../../rtc_base:rtc_event", - "../../../rtc_base:rtc_task_queue", - "../../../rtc_base/synchronization:mutex", - "../../../rtc_base/task_utils:repeating_task", - "../../../test:test_support", "../../task_queue", "../../units:time_delta", ] + absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ] } diff --git a/third_party/libwebrtc/api/metronome/test/fake_metronome.cc b/third_party/libwebrtc/api/metronome/test/fake_metronome.cc index 025f7ce5a6..bd54d5b0ba 100644 --- a/third_party/libwebrtc/api/metronome/test/fake_metronome.cc +++ b/third_party/libwebrtc/api/metronome/test/fake_metronome.cc @@ -13,13 +13,9 @@ #include <utility> #include <vector> -#include "api/priority.h" -#include "api/sequence_checker.h" +#include "absl/functional/any_invocable.h" #include "api/task_queue/task_queue_base.h" -#include "api/task_queue/task_queue_factory.h" #include "api/units/time_delta.h" -#include "rtc_base/event.h" -#include "rtc_base/task_utils/repeating_task.h" namespace webrtc::test { @@ -49,6 +45,10 @@ void ForcedTickMetronome::Tick() { FakeMetronome::FakeMetronome(TimeDelta tick_period) : tick_period_(tick_period) {} +void FakeMetronome::SetTickPeriod(TimeDelta tick_period) { + tick_period_ = tick_period; +} + void FakeMetronome::RequestCallOnNextTick( absl::AnyInvocable<void() &&> callback) { TaskQueueBase* current = TaskQueueBase::Current(); diff --git a/third_party/libwebrtc/api/metronome/test/fake_metronome.h b/third_party/libwebrtc/api/metronome/test/fake_metronome.h index 73c938e9cd..9702062cf6 100644 --- a/third_party/libwebrtc/api/metronome/test/fake_metronome.h +++ b/third_party/libwebrtc/api/metronome/test/fake_metronome.h @@ -11,18 +11,12 @@ #ifndef API_METRONOME_TEST_FAKE_METRONOME_H_ #define API_METRONOME_TEST_FAKE_METRONOME_H_ -#include <memory> -#include <set> +#include <cstddef> #include <vector> +#include "absl/functional/any_invocable.h" #include "api/metronome/metronome.h" -#include "api/task_queue/task_queue_base.h" -#include "api/task_queue/task_queue_factory.h" #include "api/units/time_delta.h" -#include "rtc_base/synchronization/mutex.h" -#include "rtc_base/task_queue.h" -#include "rtc_base/task_utils/repeating_task.h" -#include "rtc_base/thread_annotations.h" namespace webrtc::test { @@ -48,19 +42,18 @@ class ForcedTickMetronome : public Metronome { // FakeMetronome is a metronome that ticks based on a repeating task at the // `tick_period` provided in the constructor. It is designed for use with // simulated task queues for unit tests. -// -// `Stop()` must be called before destruction, as it cancels the metronome tick -// on the proper task queue. class FakeMetronome : public Metronome { public: explicit FakeMetronome(TimeDelta tick_period); + void SetTickPeriod(TimeDelta tick_period); + // Metronome implementation. void RequestCallOnNextTick(absl::AnyInvocable<void() &&> callback) override; TimeDelta TickPeriod() const override; private: - const TimeDelta tick_period_; + TimeDelta tick_period_; std::vector<absl::AnyInvocable<void() &&>> callbacks_; }; |