Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/browser/load_library_perf_test.cc

Issue 2409423002: Move ENABLE_PEPPER_CDMS to a buildflag header. (Closed)
Patch Set: Fix and format Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/native_library.h" 10 #include "base/native_library.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/scoped_native_library.h" 12 #include "base/scoped_native_library.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "ppapi/features/features.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "testing/perf/perf_test.h" 18 #include "testing/perf/perf_test.h"
18 19
19 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 20 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
20 21
21 #if defined(ENABLE_PEPPER_CDMS) 22 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
22 #include "chrome/browser/media/pepper_cdm_test_constants.h" 23 #include "chrome/browser/media/pepper_cdm_test_constants.h"
23 #include "media/cdm/cdm_paths.h" 24 #include "media/cdm/cdm_paths.h"
24 #endif 25 #endif
25 26
26 namespace { 27 namespace {
27 28
28 // Measures the size (bytes) and time to load (sec) of a native library. 29 // Measures the size (bytes) and time to load (sec) of a native library.
29 // |library_relative_dir| is the relative path based on DIR_MODULE. 30 // |library_relative_dir| is the relative path based on DIR_MODULE.
30 void MeasureSizeAndTimeToLoadNativeLibrary( 31 void MeasureSizeAndTimeToLoadNativeLibrary(
31 const base::FilePath& library_relative_dir, 32 const base::FilePath& library_relative_dir,
(...skipping 21 matching lines...) Expand all
53 ASSERT_TRUE(native_library) << "Error loading library: " << error.ToString(); 54 ASSERT_TRUE(native_library) << "Error loading library: " << error.ToString();
54 base::UnloadNativeLibrary(native_library); 55 base::UnloadNativeLibrary(native_library);
55 perf_test::PrintResult("time_to_load_library", 56 perf_test::PrintResult("time_to_load_library",
56 "", 57 "",
57 library_name.AsUTF8Unsafe(), 58 library_name.AsUTF8Unsafe(),
58 delta, 59 delta,
59 "ms", 60 "ms",
60 true); 61 true);
61 } 62 }
62 63
63 #if defined(ENABLE_PEPPER_CDMS) 64 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
64 65
65 void MeasureSizeAndTimeToLoadCdm(const std::string& cdm_base_dir, 66 void MeasureSizeAndTimeToLoadCdm(const std::string& cdm_base_dir,
66 const std::string& cdm_name) { 67 const std::string& cdm_name) {
67 MeasureSizeAndTimeToLoadNativeLibrary( 68 MeasureSizeAndTimeToLoadNativeLibrary(
68 media::GetPlatformSpecificDirectory(cdm_base_dir), 69 media::GetPlatformSpecificDirectory(cdm_base_dir),
69 base::FilePath::FromUTF8Unsafe(cdm_name)); 70 base::FilePath::FromUTF8Unsafe(cdm_name));
70 } 71 }
71 72
72 #endif // defined(ENABLE_PEPPER_CDMS) 73 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
73 74
74 } // namespace 75 } // namespace
75 76
76 #if defined(ENABLE_PEPPER_CDMS) 77 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
77 #if defined(WIDEVINE_CDM_AVAILABLE) 78 #if defined(WIDEVINE_CDM_AVAILABLE)
78 TEST(LoadCDMPerfTest, Widevine) { 79 TEST(LoadCDMPerfTest, Widevine) {
79 MeasureSizeAndTimeToLoadCdm( 80 MeasureSizeAndTimeToLoadCdm(
80 kWidevineCdmBaseDirectory, 81 kWidevineCdmBaseDirectory,
81 base::GetNativeLibraryName(kWidevineCdmLibraryName)); 82 base::GetNativeLibraryName(kWidevineCdmLibraryName));
82 } 83 }
83 84
84 TEST(LoadCDMPerfTest, WidevineAdapter) { 85 TEST(LoadCDMPerfTest, WidevineAdapter) {
85 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory, 86 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory,
86 kWidevineCdmAdapterFileName); 87 kWidevineCdmAdapterFileName);
87 } 88 }
88 #endif // defined(WIDEVINE_CDM_AVAILABLE) 89 #endif // defined(WIDEVINE_CDM_AVAILABLE)
89 90
90 TEST(LoadCDMPerfTest, ExternalClearKey) { 91 TEST(LoadCDMPerfTest, ExternalClearKey) {
91 MeasureSizeAndTimeToLoadCdm( 92 MeasureSizeAndTimeToLoadCdm(
92 kClearKeyCdmBaseDirectory, 93 kClearKeyCdmBaseDirectory,
93 base::GetNativeLibraryName(media::kClearKeyCdmLibraryName)); 94 base::GetNativeLibraryName(media::kClearKeyCdmLibraryName));
94 } 95 }
95 96
96 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) { 97 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) {
97 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory, 98 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory,
98 kClearKeyCdmAdapterFileName); 99 kClearKeyCdmAdapterFileName);
99 } 100 }
100 #endif // defined(ENABLE_PEPPER_CDMS) 101 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/content_settings_browsertest.cc ('k') | chrome/browser/media/encrypted_media_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698