chromium/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_impl_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {
// To avoid symbol collisions in jumbo builds.
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 {};

}  // namespace

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.") {}

// Confirms that the feature usage in a dedicated worker is uploaded to
// somewhere (the browser side in the actual implementation) via a delegate.
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) {}

}  // namespace worker_scheduler_unittest
}  // namespace scheduler
}  // namespace blink