#include "third_party/blink/renderer/platform/timer.h"
#include <memory>
#include <queue>
#include "base/memory/raw_ptr.h"
#include "base/task/common/lazy_now.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/heap/thread_state_scopes.h"
#include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h"
#include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h"
TaskQueue;
MainThreadTaskQueue;
ElementsAre;
namespace blink {
namespace {
class TimerTest : public testing::Test { … };
class OnHeapTimerOwner final : public GarbageCollected<OnHeapTimerOwner> { … };
TEST_F(TimerTest, StartOneShot_Zero) { … }
TEST_F(TimerTest, StartOneShot_ZeroAndCancel) { … }
TEST_F(TimerTest, StartOneShot_ZeroAndCancelThenRepost) { … }
TEST_F(TimerTest, StartOneShot_Zero_RepostingAfterRunning) { … }
TEST_F(TimerTest, StartOneShot_NonZero) { … }
TEST_F(TimerTest, StartOneShot_NonZeroAndCancel) { … }
TEST_F(TimerTest, StartOneShot_NonZeroAndCancelThenRepost) { … }
TEST_F(TimerTest, StartOneShot_NonZero_RepostingAfterRunning) { … }
TEST_F(TimerTest, PostingTimerTwiceWithSameRunTimeDoesNothing) { … }
TEST_F(TimerTest, PostingTimerTwiceWithNewerRunTimeCancelsOriginalTask) { … }
TEST_F(TimerTest, PostingTimerTwiceWithLaterRunTimeCancelsOriginalTask) { … }
TEST_F(TimerTest, StartRepeatingTask) { … }
TEST_F(TimerTest, StartRepeatingTask_ThenCancel) { … }
TEST_F(TimerTest, StartRepeatingTask_ThenPostOneShot) { … }
TEST_F(TimerTest, IsActive_NeverPosted) { … }
TEST_F(TimerTest, IsActive_AfterPosting_OneShotZero) { … }
TEST_F(TimerTest, IsActive_AfterPosting_OneShotNonZero) { … }
TEST_F(TimerTest, IsActive_AfterPosting_Repeating) { … }
TEST_F(TimerTest, IsActive_AfterRunning_OneShotZero) { … }
TEST_F(TimerTest, IsActive_AfterRunning_OneShotNonZero) { … }
TEST_F(TimerTest, IsActive_AfterRunning_Repeating) { … }
TEST_F(TimerTest, NextFireInterval_OneShotZero) { … }
TEST_F(TimerTest, NextFireInterval_OneShotNonZero) { … }
TEST_F(TimerTest, NextFireInterval_OneShotNonZero_AfterAFewSeconds) { … }
TEST_F(TimerTest, NextFireInterval_Repeating) { … }
TEST_F(TimerTest, RepeatInterval_NeverStarted) { … }
TEST_F(TimerTest, RepeatInterval_OneShotZero) { … }
TEST_F(TimerTest, RepeatInterval_OneShotNonZero) { … }
TEST_F(TimerTest, RepeatInterval_Repeating) { … }
TEST_F(TimerTest, AugmentRepeatInterval) { … }
TEST_F(TimerTest, AugmentRepeatInterval_TimerFireDelayed) { … }
TEST_F(TimerTest, RepeatingTimerDoesNotDrift) { … }
template <typename TimerFiredClass>
class TimerForTest : public TaskRunnerTimer<TimerFiredClass> { … };
TEST_F(TimerTest, UserSuppliedTaskRunner) { … }
TEST_F(TimerTest, RunOnHeapTimer) { … }
TEST_F(TimerTest, DestructOnHeapTimer) { … }
TEST_F(TimerTest, DISABLED_MarkOnHeapTimerAsUnreachable) { … }
namespace {
class TaskObserver : public base::TaskObserver { … };
}
TEST_F(TimerTest, MoveToNewTaskRunnerOneShot) { … }
TEST_F(TimerTest, MoveToNewTaskRunnerRepeating) { … }
TEST_F(TimerTest, MoveToNewTaskRunnerWithoutTasks) { … }
}
}