chromium/media/mojo/services/video_decode_perf_history_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 <map>
#include <memory>
#include <string>

#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/ukm/test_ukm_recorder.h"
#include "media/base/key_systems.h"
#include "media/base/media_switches.h"
#include "media/capabilities/video_decode_stats_db.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "media/mojo/services/test_helpers.h"
#include "media/mojo/services/video_decode_perf_history.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

UkmEntry;
IsNull;
_;

namespace {

// Aliases for readability.
const bool kIsSmooth =;
const bool kIsNotSmooth =;
const bool kIsPowerEfficient =;
const bool kIsNotPowerEfficient =;
const bool kIsTopFrame =;
const uint64_t kPlayerId =;

}  // namespace

namespace media {

class FakeVideoDecodeStatsDB : public VideoDecodeStatsDB {};

class VideoDecodePerfHistoryTest : public testing::Test {};

struct PerfHistoryTestParams {};

// When bool param is true, tests should wait until the end to run
// GetFakeDB()->CompleteInitialize(). Otherwise run PreInitializeDB() at the
// test start.
class VideoDecodePerfHistoryParamTest
    : public testing::WithParamInterface<PerfHistoryTestParams>,
      public VideoDecodePerfHistoryTest {};

TEST_P(VideoDecodePerfHistoryParamTest, GetPerfInfo_Smooth) {}

TEST_P(VideoDecodePerfHistoryParamTest, GetPerfInfo_PowerEfficient) {}

TEST_P(VideoDecodePerfHistoryParamTest, GetPerfInfo_FailedInitialize) {}

TEST_P(VideoDecodePerfHistoryParamTest, AppendAndDestroyStats) {}

TEST_P(VideoDecodePerfHistoryParamTest, GetVideoDecodeStatsDB) {}

TEST_P(VideoDecodePerfHistoryParamTest,
       GetVideoDecodeStatsDB_FailedInitialize) {}

TEST_P(VideoDecodePerfHistoryParamTest, FailedDatabaseGetForAppend) {}

TEST_P(VideoDecodePerfHistoryParamTest, FailedDatabaseAppend) {}

// Tests that the feature parameters are used to override constants for the
// Media Capabilities feature.
// To avoid race conditions when setting the parameter, the test sets it when
// starting and make sure the values recorded to the DB wouldn't be smooth per
// the default value.
TEST_P(VideoDecodePerfHistoryParamTest,
       SmoothThresholdFinchOverride_NoEmeOverride) {}

TEST_P(VideoDecodePerfHistoryParamTest,
       SmoothThresholdFinchOverride_WithEmeOverride) {}

const PerfHistoryTestParams kPerfHistoryTestParams[] =;

INSTANTIATE_TEST_SUITE_P();

//
// The following test are not parameterized. They instead always hard code
// deferred initialization.
//

TEST_F(VideoDecodePerfHistoryTest, ClearHistoryTriggersSuccessfulInitialize) {}

TEST_F(VideoDecodePerfHistoryTest, ClearHistoryTriggersFailedInitialize) {}

}  // namespace media