#ifdef UNSAFE_BUFFERS_BUILD
#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 {
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 = …;
static_assert …;
}
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) { … }
}
}
}
}