#include <stddef.h>
#include <stdint.h>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/native_library.h"
#include "base/path_service.h"
#include "base/scoped_native_library.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"
#include "third_party/widevine/cdm/buildflags.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
#include "media/cdm/cdm_paths.h"
#include "media/cdm/clear_key_cdm_common.h"
#endif
namespace {
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
constexpr char kMetricLibrarySizeBytes[] = …;
constexpr char kMetricTimeToLoadLibraryMs[] = …;
perf_test::PerfResultReporter SetUpReporter(const std::string& story) { … }
void MeasureSizeAndTimeToLoadNativeLibrary(
const base::FilePath& library_relative_dir,
const base::FilePath& library_name) { … }
void MeasureSizeAndTimeToLoadCdm(const std::string& cdm_base_dir,
const std::string& cdm_name) { … }
#endif
}
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
#if BUILDFLAG(ENABLE_WIDEVINE)
TEST(LoadCDMPerfTest, Widevine) {
MeasureSizeAndTimeToLoadCdm(
kWidevineCdmBaseDirectory,
base::GetNativeLibraryName(kWidevineCdmLibraryName));
}
#endif
TEST(LoadCDMPerfTest, ExternalClearKey) { … }
#endif