chromium/cc/raster/categorized_worker_pool_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.

#include "cc/raster/categorized_worker_pool.h"

#include <utility>

#include "base/functional/callback.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "base/test/sequenced_task_runner_test_template.h"
#include "base/test/task_runner_test_template.h"
#include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h"
#include "cc/test/task_graph_runner_test_template.h"

namespace cc {
namespace {

// Number of threads spawned in tests.
const int kNumThreads =;

template <class T>
class CategorizedWorkerPoolTestDelegate {};

template <class T>
class CategorizedWorkerPoolSequencedTestDelegate {};

template <class T, int NumThreads>
class CategorizedWorkerPoolTaskGraphRunnerTestDelegate {};

class CategorizedWorkerPoolTest : public testing::TestWithParam<bool> {};

class ClosureTask : public Task {};

}  // namespace

// Verify that multiple tasks posted with TASK_CATEGORY_BACKGROUND and
// TASK_CATEGORY_BACKGROUND_WITH_NORMAL_THREAD_PRIORITY don't run
// concurrently.
TEST_P(CategorizedWorkerPoolTest, BackgroundTasksDontRunConcurrently) {}

// Verify that a TASK_CATEGORY_BACKGROUND_WITH_NORMAL_THREAD_PRIORITY task
// doesn't run at background thread priority.
TEST_P(CategorizedWorkerPoolTest,
       AcquiresForegroundResourcesNotBackgroundThreadPriority) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace cc

// Test suite instantiation needs to be in the same namespace as test suite
// definition.

namespace base {

INSTANTIATE_TYPED_TEST_SUITE_P();
INSTANTIATE_TYPED_TEST_SUITE_P();

INSTANTIATE_TYPED_TEST_SUITE_P();
INSTANTIATE_TYPED_TEST_SUITE_P();

}  // namespace base

namespace cc {

// Multithreaded tests.
CategorizedWorkerPoolImplTaskGraphRunnerTestDelegate_1_5;

INSTANTIATE_TYPED_TEST_SUITE_P();
CategorizedWorkerPoolJobTaskGraphRunnerTestDelegate_1_5;
INSTANTIATE_TYPED_TEST_SUITE_P();

// Single threaded tests.
CategorizedWorkerPoolImplTaskGraphRunnerTestDelegate;
INSTANTIATE_TYPED_TEST_SUITE_P();
CategorizedWorkerPoolJobTaskGraphRunnerTestDelegate;
INSTANTIATE_TYPED_TEST_SUITE_P();

}  // namespace cc