chromium/chrome/browser/load_library_perf_test.cc

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

#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) {}

// Measures the size (bytes) and time to load (sec) of a native library.
// |library_relative_dir| is the relative path based on DIR_MODULE.
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  // BUILDFLAG(ENABLE_LIBRARY_CDMS)

}  // namespace

#if BUILDFLAG(ENABLE_LIBRARY_CDMS)

#if BUILDFLAG(ENABLE_WIDEVINE)
TEST(LoadCDMPerfTest, Widevine) {
  MeasureSizeAndTimeToLoadCdm(
      kWidevineCdmBaseDirectory,
      base::GetNativeLibraryName(kWidevineCdmLibraryName));
}
#endif  // BUILDFLAG(ENABLE_WIDEVINE)

TEST(LoadCDMPerfTest, ExternalClearKey) {}

#endif  // BUILDFLAG(ENABLE_LIBRARY_CDMS)