chromium/components/performance_manager/execution_context_priority/max_vote_aggregator_unittest.cc

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

#include "components/performance_manager/execution_context_priority/max_vote_aggregator.h"

#include "base/rand_util.h"
#include "components/performance_manager/test_support/voting.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace performance_manager {
namespace execution_context_priority {

// Expose the VoteData type for testing.
class MaxVoteAggregatorTestAccess {};
VoteData;
StampedVote;

namespace {

DummyVoteObserver;

// Some dummy execution contexts.
const ExecutionContext* kExecutionContext0 =;
const ExecutionContext* kExecutionContext1 =;

static const Vote kLowPriorityVote0(base::TaskPriority::LOWEST, "low reason 0");
static const Vote kLowPriorityVote1(base::TaskPriority::LOWEST, "low reason 1");

static const Vote kMediumPriorityVote0(base::TaskPriority::USER_VISIBLE,
                                       "medium reason 0");
static const Vote kMediumPriorityVote1(base::TaskPriority::USER_VISIBLE,
                                       "medium reason 1");

static const Vote kHighPriorityVote0(base::TaskPriority::HIGHEST,
                                     "high reason 0");
static const Vote kHighPriorityVote1(base::TaskPriority::HIGHEST,
                                     "high reason 1");

}  // namespace

class MaxVoteAggregatorTest : public testing::Test {};

// Tests that in the case of a single voter, the vote is simply propagated
// upwards.
TEST_F(MaxVoteAggregatorTest, SingleVoter) {}

TEST_F(MaxVoteAggregatorTest, TwoVotersOneContext) {}

// A less extensive test than TwoVotersOneContext that sanity checks that votes
// for different contextes are aggregated independently.
TEST_F(MaxVoteAggregatorTest, TwoVotersMultipleContext) {}

// A simple test that ensures MaxVoteAggregator supports an arbitrary number of
// voters.
TEST_F(MaxVoteAggregatorTest, LotsOfVoters) {}

}  // namespace execution_context_priority
}  // namespace performance_manager