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

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

Issue 2048523002: Fix base::GetNativeLibraryName() for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_lib_clean
Patch Set: rebase Created 4 years, 6 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/path_service.h" 11 #include "base/path_service.h"
11 #include "base/scoped_native_library.h" 12 #include "base/scoped_native_library.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/perf/perf_test.h" 17 #include "testing/perf/perf_test.h"
17 18
18 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 19 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
19 20
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 perf_test::PrintResult("time_to_load_library", 55 perf_test::PrintResult("time_to_load_library",
55 "", 56 "",
56 library_name.AsUTF8Unsafe(), 57 library_name.AsUTF8Unsafe(),
57 delta, 58 delta,
58 "ms", 59 "ms",
59 true); 60 true);
60 } 61 }
61 62
62 #if defined(ENABLE_PEPPER_CDMS) 63 #if defined(ENABLE_PEPPER_CDMS)
63 64
64 // File name of the ClearKey CDM on different platforms.
65 // TODO(xhwang): Consolidate this with external_clear_key_test_helper.cc.
66 const char kClearKeyCdmFileName[] =
67 #if defined(OS_MACOSX)
68 "libclearkeycdm.dylib";
69 #elif defined(OS_WIN)
70 "clearkeycdm.dll";
71 #else // OS_LINUX, etc.
72 "libclearkeycdm.so";
73 #endif
74
75 void MeasureSizeAndTimeToLoadCdm(const std::string& cdm_base_dir, 65 void MeasureSizeAndTimeToLoadCdm(const std::string& cdm_base_dir,
76 const std::string& cdm_name) { 66 const std::string& cdm_name) {
77 MeasureSizeAndTimeToLoadNativeLibrary( 67 MeasureSizeAndTimeToLoadNativeLibrary(
78 media::GetPlatformSpecificDirectory(cdm_base_dir), 68 media::GetPlatformSpecificDirectory(cdm_base_dir),
79 base::FilePath::FromUTF8Unsafe(cdm_name)); 69 base::FilePath::FromUTF8Unsafe(cdm_name));
80 } 70 }
81 71
82 #endif // defined(ENABLE_PEPPER_CDMS) 72 #endif // defined(ENABLE_PEPPER_CDMS)
83 73
84 } // namespace 74 } // namespace
85 75
86 #if defined(ENABLE_PEPPER_CDMS) 76 #if defined(ENABLE_PEPPER_CDMS)
87 #if defined(WIDEVINE_CDM_AVAILABLE) 77 #if defined(WIDEVINE_CDM_AVAILABLE)
88 TEST(LoadCDMPerfTest, Widevine) { 78 TEST(LoadCDMPerfTest, Widevine) {
89 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory, kWidevineCdmFileName); 79 MeasureSizeAndTimeToLoadCdm(
80 kWidevineCdmBaseDirectory,
81 base::GetNativeLibraryName(kWidevineCdmLibraryName));
90 } 82 }
91 83
92 TEST(LoadCDMPerfTest, WidevineAdapter) { 84 TEST(LoadCDMPerfTest, WidevineAdapter) {
93 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory, 85 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory,
94 kWidevineCdmAdapterFileName); 86 kWidevineCdmAdapterFileName);
95 } 87 }
96 #endif // defined(WIDEVINE_CDM_AVAILABLE) 88 #endif // defined(WIDEVINE_CDM_AVAILABLE)
97 89
98 TEST(LoadCDMPerfTest, ExternalClearKey) { 90 TEST(LoadCDMPerfTest, ExternalClearKey) {
99 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory, kClearKeyCdmFileName); 91 MeasureSizeAndTimeToLoadCdm(
92 kClearKeyCdmBaseDirectory,
93 base::GetNativeLibraryName(media::kClearKeyCdmLibraryName));
100 } 94 }
101 95
102 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) { 96 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) {
103 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory, 97 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory,
104 kClearKeyCdmAdapterFileName); 98 kClearKeyCdmAdapterFileName);
105 } 99 }
106 #endif // defined(ENABLE_PEPPER_CDMS) 100 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/widevine_cdm_component_installer.cc ('k') | chrome/common/chrome_content_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698