#include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/task/sequence_manager/test/fake_task.h"
#include "base/task/sequence_manager/test/sequence_manager_for_test.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/ukm/test_ukm_recorder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/scheduler/common/process_state.h"
#include "third_party/blink/renderer/platform/scheduler/common/task_priority.h"
#include "third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/test/recording_task_time_observer.h"
ElementsAreArray;
namespace blink {
namespace scheduler {
namespace worker_thread_scheduler_unittest {
namespace {
void NopTask() { … }
class ScopedSaveStartTicks { … };
base::TimeTicks ScopedSaveStartTicks::timeline_start_ticks_;
int TimeTicksToIntMs(const base::TimeTicks& time) { … }
void RecordTimelineTask(Vector<String>* timeline,
const base::TickClock* clock) { … }
void AppendToVectorTestTask(Vector<String>* vector, String value) { … }
void AppendToVectorIdleTestTask(Vector<String>* vector,
String value,
base::TimeTicks deadline) { … }
void TimelineIdleTestTask(Vector<String>* timeline, base::TimeTicks deadline) { … }
class WorkerThreadSchedulerForTest : public WorkerThreadScheduler { … };
class WorkerThreadSchedulerTest : public testing::Test { … };
}
TEST_F(WorkerThreadSchedulerTest, TestPostDefaultTask) { … }
TEST_F(WorkerThreadSchedulerTest, TestPostIdleTask) { … }
TEST_F(WorkerThreadSchedulerTest, TestPostDefaultAndIdleTasks) { … }
TEST_F(WorkerThreadSchedulerTest, TestPostDefaultDelayedAndIdleTasks) { … }
TEST_F(WorkerThreadSchedulerTest, TestIdleTaskWhenIsNotQuiescent) { … }
TEST_F(WorkerThreadSchedulerTest, TestIdleDeadlineWithPendingDelayedTask) { … }
TEST_F(WorkerThreadSchedulerTest,
TestIdleDeadlineWithPendingDelayedTaskFarInTheFuture) { … }
TEST_F(WorkerThreadSchedulerTest, TestPostIdleTaskAfterRunningUntilIdle) { … }
void PostIdleTask(Vector<String>* timeline,
const base::TickClock* clock,
SingleThreadIdleTaskRunner* idle_task_runner) { … }
TEST_F(WorkerThreadSchedulerTest, TestLongIdlePeriodTimeline) { … }
TEST_F(WorkerThreadSchedulerTest, TestMicrotaskCheckpointTiming) { … }
namespace {
class FrameSchedulerDelegateWithUkmSourceId : public FrameScheduler::Delegate { … };
}
class WorkerThreadSchedulerWithProxyTest : public testing::Test { … };
TEST_F(WorkerThreadSchedulerWithProxyTest, UkmTaskRecording) { … }
}
}
}