chromium/media/mojo/services/webrtc_video_perf_history_unittest.cc

// Copyright 2022 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 "media/base/media_switches.h"
#include "media/capabilities/webrtc_video_stats_db.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "media/mojo/services/webrtc_video_perf_history.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
IsNull;

namespace media {
namespace {

// Aliases for readability.
constexpr bool kIsDecode =;
constexpr bool kIsEncode =;
constexpr bool kHardware =;
constexpr bool kSoftware =;
constexpr bool kIsSmooth =;
constexpr bool kIsNotSmooth =;
constexpr VideoCodecProfile kKnownProfile =;
constexpr int32_t kPixelsHd =;
constexpr int32_t kPixelsFullHd =;
constexpr int32_t kPixels4K =;
constexpr int kFramesProcessed =;
constexpr int kKeyFramesProcessed =;

}  // namespace

class FakeWebrtcVideoStatsDB : public WebrtcVideoStatsDB {};

class WebrtcVideoPerfHistoryTest : public testing::Test {};

struct WebrtcPerfHistoryTestParams {};

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

TEST_P(WebrtcVideoPerfHistoryParamTest, GetPerfInfo) {}

// Test to override the smoothness threshold by setting the corresponding field
// trial parameter.
TEST_P(WebrtcVideoPerfHistoryParamTest,
       GetPerfInfoSmoothnessThresholdOverride) {}

// Verify that the combined smoothness prediction is correct in the case that
// the database contains entries with mixed smoothness predicitions.
TEST_P(WebrtcVideoPerfHistoryParamTest, GetPerfInfoCombinedPrediction) {}

// Test to override smooth decision ratio threshold by setting the corresponding
// field trial parameter.
TEST_P(WebrtcVideoPerfHistoryParamTest,
       GetPerfInfoSmoothDecisionRatioThresholdOverride) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, GetPerfInfoFrameRateBucketing) {}

// Only save valid keys and stats.
TEST_P(WebrtcVideoPerfHistoryParamTest, OnlySaveValidKeysAndStats) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, SmoothIsTrueForUntrackedCodecProfiles) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, GetPerfInfoFailedInitialize) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, AppendAndDestroyStats) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, GetWebrtcVideoStatsDB) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, GetWebrtcVideoStatsDBFailedInitialize) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, FailedDatabaseGetForAppend) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, FailedDatabaseAppend) {}

TEST_P(WebrtcVideoPerfHistoryParamTest, GetPerfInfo4KSmoothImpliesHdSmooth) {}

TEST_P(WebrtcVideoPerfHistoryParamTest,
       GetPerfInfoFullHdNotSmoothImplies4KNotSmooth) {}

TEST_P(WebrtcVideoPerfHistoryParamTest,
       GetPerfInfoFullHdSmoothEvenIf4KNotSmooth) {}

const WebrtcPerfHistoryTestParams kWebrtcPerfHistoryTestParams[] =;

INSTANTIATE_TEST_SUITE_P();

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

TEST_F(WebrtcVideoPerfHistoryTest, ClearHistoryTriggersSuccessfulInitialize) {}

TEST_F(WebrtcVideoPerfHistoryTest, ClearHistoryTriggersFailedInitialize) {}

}  // namespace media