#include "base/timer/timer.h"
#include <stddef.h>
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
constexpr TimeDelta kTestDelay = …;
constexpr TimeDelta kLongTestDelay = …;
const test::TaskEnvironment::MainThreadType testing_main_threads[] = …;
class Receiver { … };
void RunTest_OneShotTimers(
test::TaskEnvironment::MainThreadType main_thread_type) { … }
void RunTest_OneShotTimers_Cancel(
test::TaskEnvironment::MainThreadType main_thread_type) { … }
void RunTest_OneShotSelfDeletingTimer(
test::TaskEnvironment::MainThreadType main_thread_type) { … }
void RunTest_RepeatingTimer(
test::TaskEnvironment::MainThreadType main_thread_type,
const TimeDelta& delay) { … }
void RunTest_RepeatingTimer_Cancel(
test::TaskEnvironment::MainThreadType main_thread_type,
const TimeDelta& delay) { … }
void RunTest_DelayTimer_NoCall(
test::TaskEnvironment::MainThreadType main_thread_type) { … }
void RunTest_DelayTimer_OneCall(
test::TaskEnvironment::MainThreadType main_thread_type) { … }
void RunTest_DelayTimer_Reset(
test::TaskEnvironment::MainThreadType main_thread_type) { … }
void RunTest_DelayTimer_Deleted(
test::TaskEnvironment::MainThreadType main_thread_type) { … }
}
class TimerTestWithThreadType
: public testing::TestWithParam<test::TaskEnvironment::MainThreadType> { … };
TEST_P(TimerTestWithThreadType, OneShotTimers) { … }
TEST_P(TimerTestWithThreadType, OneShotTimers_Cancel) { … }
TEST_P(TimerTestWithThreadType, OneShotSelfDeletingTimer) { … }
TEST(TimerTest, OneShotTimer_CustomTaskRunner) { … }
TEST(TimerTest, OneShotTimerWithTickClock) { … }
TEST_P(TimerTestWithThreadType, RepeatingTimer) { … }
TEST_P(TimerTestWithThreadType, RepeatingTimer_Cancel) { … }
TEST_P(TimerTestWithThreadType, RepeatingTimerZeroDelay) { … }
TEST_P(TimerTestWithThreadType, RepeatingTimerZeroDelay_Cancel) { … }
TEST(TimerTest, RepeatingTimerWithTickClock) { … }
TEST_P(TimerTestWithThreadType, DelayTimer_NoCall) { … }
TEST_P(TimerTestWithThreadType, DelayTimer_OneCall) { … }
TEST_P(TimerTestWithThreadType, DelayTimer_Reset) { … }
TEST_P(TimerTestWithThreadType, DelayTimer_Deleted) { … }
TEST(TimerTest, DelayTimerWithTickClock) { … }
TEST(TimerTest, TaskEnvironmentShutdown) { … }
TEST(TimerTest, TaskEnvironmentSelfOwningTimer) { … }
TEST(TimerTest, TaskEnvironmentSelfOwningTimerStopped) { … }
TEST(TimerTest, NonRepeatIsRunning) { … }
TEST(TimerTest, NonRepeatTaskEnvironmentDeath) { … }
TEST(TimerTest, RetainRepeatIsRunning) { … }
TEST(TimerTest, RetainNonRepeatIsRunning) { … }
TEST(TimerTest, ContinuationStopStart) { … }
TEST(TimerTest, ContinuationReset) { … }
TEST(TimerTest, AbandonedTaskIsCancelled) { … }
TEST(TimerTest, DeadlineTimer) { … }
TEST(TimerTest, DeadlineTimerCancel) { … }
TEST(TimerTest, DeadlineTimerTaskDestructed) { … }
TEST(TimerTest, DeadlineTimerStartTwice) { … }
TEST(TimerTest, MetronomeTimer) { … }
TEST(TimerTest, MetronomeTimerCustomPhase) { … }
TEST(TimerTest, MetronomeTimerReset) { … }
TEST(TimerTest, MetronomeTimerStartTwice) { … }
TEST(TimerTest, MetronomeTimerMultiple) { … }
TEST(TimerTest, MetronomeTimerCancel) { … }
INSTANTIATE_TEST_SUITE_P(…);
}