#include "third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_impl.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/sequence_manager/test/sequence_manager_for_test.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/time/time.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/platform/scheduler/common/task_priority.h"
#include "third_party/blink/renderer/platform/scheduler/common/throttling/cpu_time_budget_pool.h"
#include "third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_or_worker_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/web_scheduling_priority.h"
#include "third_party/blink/renderer/platform/scheduler/public/web_scheduling_queue_type.h"
#include "third_party/blink/renderer/platform/scheduler/public/web_scheduling_task_queue.h"
#include "third_party/blink/renderer/platform/scheduler/test/web_scheduling_test_helper.h"
#include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
ElementsAre;
ElementsAreArray;
namespace blink {
namespace scheduler {
namespace worker_scheduler_unittest {
namespace {
void AppendToVectorTestTask(Vector<String>* vector, String value) { … }
void RunChainedTask(scoped_refptr<NonMainThreadTaskQueue> task_queue,
int count,
base::TimeDelta duration,
scoped_refptr<base::TestMockTimeTaskRunner> environment,
Vector<base::TimeTicks>* tasks) { … }
void IncrementCounter(int* counter) { … }
class TestObject { … };
}
class WorkerThreadSchedulerForTest : public WorkerThreadScheduler { … };
class WorkerSchedulerForTest : public WorkerSchedulerImpl { … };
class WorkerSchedulerImplTest : public testing::Test { … };
TEST_F(WorkerSchedulerImplTest, TestPostTasks) { … }
TEST_F(WorkerSchedulerImplTest, RegisterWorkerSchedulers) { … }
TEST_F(WorkerSchedulerImplTest, ThrottleWorkerScheduler) { … }
TEST_F(WorkerSchedulerImplTest, ThrottleWorkerScheduler_CreateThrottled) { … }
TEST_F(WorkerSchedulerImplTest, ThrottleWorkerScheduler_RunThrottledTasks) { … }
TEST_F(WorkerSchedulerImplTest,
ThrottleWorkerScheduler_RunThrottledTasks_CPUBudget) { … }
TEST_F(WorkerSchedulerImplTest, PausableTasks) { … }
TEST_F(WorkerSchedulerImplTest, NestedPauseHandlesTasks) { … }
class WorkerSchedulerDelegateForTesting : public WorkerScheduler::Delegate { … };
MATCHER(BlockingDetailsHasCCNS, "Compares two blocking details.") { … }
TEST_F(WorkerSchedulerImplTest, FeatureUpload) { … }
class NonMainThreadWebSchedulingTaskQueueTest
: public WorkerSchedulerImplTest,
public WebSchedulingTestHelper::Delegate { … };
TEST_F(NonMainThreadWebSchedulingTaskQueueTest, TasksRunInPriorityOrder) { … }
TEST_F(NonMainThreadWebSchedulingTaskQueueTest, DynamicTaskPriorityOrder) { … }
TEST_F(NonMainThreadWebSchedulingTaskQueueTest, TasksAndContinuations) { … }
TEST_F(NonMainThreadWebSchedulingTaskQueueTest, DynamicPriorityContinuations) { … }
TEST_F(NonMainThreadWebSchedulingTaskQueueTest,
WebScheduingAndNonWebScheduingTasks) { … }
enum class DeleterTaskRunnerEnabled { … };
TEST_F(WorkerSchedulerImplTest, DeleteSoonAfterDispose) { … }
}
}
}