chromium/base/task/sequence_manager/task_queue_selector_unittest.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "base/task/sequence_manager/task_queue_selector.h"

#include <stddef.h>

#include <map>
#include <memory>
#include <set>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/pending_task.h"
#include "base/task/sequence_manager/enqueue_order_generator.h"
#include "base/task/sequence_manager/task_queue_impl.h"
#include "base/task/sequence_manager/test/mock_time_domain.h"
#include "base/task/sequence_manager/work_queue.h"
#include "base/task/sequence_manager/work_queue_sets.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
ElementsAre;
NotNull;

namespace base {
namespace sequence_manager {
namespace internal {
// To avoid symbol collisions in jumbo builds.
namespace task_queue_selector_unittest {

namespace {
const TaskQueue::QueuePriority kHighestPriority =;
const TaskQueue::QueuePriority kHighPriority =;
const TaskQueue::QueuePriority kDefaultPriority =;
const TaskQueue::QueuePriority kPriorityCount =;
const size_t kTaskQueueCount =;

// Tests assume high priority is higher than default priority, but nothing about
// their values.
static_assert;
}  // namespace

class MockObserver : public TaskQueueSelector::Observer {};

class TaskQueueSelectorForTest : public TaskQueueSelector {};

class TaskQueueSelectorTest : public testing::Test {};

TEST_F(TaskQueueSelectorTest, TestDefaultPriority) {}

TEST_F(TaskQueueSelectorTest, TestPriorities) {}

TEST_F(TaskQueueSelectorTest, TestMultiplePriorities) {}

TEST_F(TaskQueueSelectorTest, TestObserverWorkAvailableOnPushTask) {}

TEST_F(TaskQueueSelectorTest, TestObserverWithEnabledQueue) {}

TEST_F(TaskQueueSelectorTest,
       TestObserverWithSetQueuePriorityAndQueueAlreadyEnabled) {}

TEST_F(TaskQueueSelectorTest, TestDisableEnable) {}

TEST_F(TaskQueueSelectorTest, TestDisableChangePriorityThenEnable) {}

TEST_F(TaskQueueSelectorTest, TestEmptyQueues) {}

TEST_F(TaskQueueSelectorTest, TestAge) {}

class TaskQueueSelectorStarvationTest : public TaskQueueSelectorTest {};

TEST_F(TaskQueueSelectorStarvationTest,
       HigherPriorityWorkStarvesLowerPriorityWork) {}

TEST_F(TaskQueueSelectorStarvationTest,
       NewHigherPriorityTasksStarveOldLowerPriorityTasks) {}

TEST_F(TaskQueueSelectorTest, GetHighestPendingPriority) {}

TEST_F(TaskQueueSelectorTest, ChooseWithPriority_Empty) {}

TEST_F(TaskQueueSelectorTest, ChooseWithPriority_OnlyDelayed) {}

TEST_F(TaskQueueSelectorTest, ChooseWithPriority_OnlyImmediate) {}

TEST_F(TaskQueueSelectorTest,
       SelectWorkQueueToServiceImmediateOnlyWithoutImmediateTask) {}

TEST_F(TaskQueueSelectorTest,
       SelectWorkQueueToServiceImmediateOnlyWithDelayedTasks) {}

TEST_F(TaskQueueSelectorTest,
       SelectWorkQueueToServiceImmediateOnlyWithDisabledQueues) {}

TEST_F(TaskQueueSelectorTest, TestObserverWithOneBlockedQueue) {}

TEST_F(TaskQueueSelectorTest, TestObserverWithTwoBlockedQueues) {}

TEST_F(TaskQueueSelectorTest, CollectSkippedOverLowerPriorityTasks) {}

struct ChooseWithPriorityTestParam {};

static const ChooseWithPriorityTestParam kChooseWithPriorityTestCases[] =;

class ChooseWithPriorityTest
    : public TaskQueueSelectorTest,
      public testing::WithParamInterface<ChooseWithPriorityTestParam> {};

TEST_P(ChooseWithPriorityTest, RoundRobinTest) {}

INSTANTIATE_TEST_SUITE_P();

class ActivePriorityTrackerTest : public testing::Test {};

TEST_F(ActivePriorityTrackerTest, SetPriorityActiveAndInactive) {}

TEST_F(ActivePriorityTrackerTest, HighestActivePriority) {}

}  // namespace task_queue_selector_unittest
}  // namespace internal
}  // namespace sequence_manager
}  // namespace base