Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 // File name of the ClearKey CDM on different platforms. |
|
Mark Mentovai
2016/06/10 23:39:59
Not a filename. “Different platforms” is extraneou
Lei Zhang
2016/06/13 19:10:07
Done.
| |
| 65 // TODO(xhwang): Consolidate this with external_clear_key_test_helper.cc. | 66 // TODO(xhwang): Consolidate this with external_clear_key_test_helper.cc. |
| 66 const char kClearKeyCdmFileName[] = | 67 const char kClearKeyCdmName[] = "clearkeycdm"; |
|
Mark Mentovai
2016/06/10 23:39:59
Maybe kClearKeyCdmLibraryName. But I see no reason
Lei Zhang
2016/06/13 19:10:06
I renamed the variable, and merged it with the cop
| |
| 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 | 68 |
| 75 void MeasureSizeAndTimeToLoadCdm(const std::string& cdm_base_dir, | 69 void MeasureSizeAndTimeToLoadCdm(const std::string& cdm_base_dir, |
| 76 const std::string& cdm_name) { | 70 const std::string& cdm_name) { |
| 77 MeasureSizeAndTimeToLoadNativeLibrary( | 71 MeasureSizeAndTimeToLoadNativeLibrary( |
| 78 media::GetPlatformSpecificDirectory(cdm_base_dir), | 72 media::GetPlatformSpecificDirectory(cdm_base_dir), |
| 79 base::FilePath::FromUTF8Unsafe(cdm_name)); | 73 base::FilePath::FromUTF8Unsafe(cdm_name)); |
| 80 } | 74 } |
| 81 | 75 |
| 82 #endif // defined(ENABLE_PEPPER_CDMS) | 76 #endif // defined(ENABLE_PEPPER_CDMS) |
| 83 | 77 |
| 84 } // namespace | 78 } // namespace |
| 85 | 79 |
| 86 #if defined(ENABLE_PEPPER_CDMS) | 80 #if defined(ENABLE_PEPPER_CDMS) |
| 87 #if defined(WIDEVINE_CDM_AVAILABLE) | 81 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 88 TEST(LoadCDMPerfTest, Widevine) { | 82 TEST(LoadCDMPerfTest, Widevine) { |
| 89 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory, kWidevineCdmFileName); | 83 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory, |
| 84 base::GetNativeLibraryName(kWidevineCdmName)); | |
| 90 } | 85 } |
| 91 | 86 |
| 92 TEST(LoadCDMPerfTest, WidevineAdapter) { | 87 TEST(LoadCDMPerfTest, WidevineAdapter) { |
| 93 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory, | 88 MeasureSizeAndTimeToLoadCdm(kWidevineCdmBaseDirectory, |
| 94 kWidevineCdmAdapterFileName); | 89 kWidevineCdmAdapterFileName); |
| 95 } | 90 } |
| 96 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 91 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 97 | 92 |
| 98 TEST(LoadCDMPerfTest, ExternalClearKey) { | 93 TEST(LoadCDMPerfTest, ExternalClearKey) { |
| 99 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory, kClearKeyCdmFileName); | 94 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory, |
| 95 base::GetNativeLibraryName(kClearKeyCdmName)); | |
| 100 } | 96 } |
| 101 | 97 |
| 102 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) { | 98 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) { |
| 103 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory, | 99 MeasureSizeAndTimeToLoadCdm(kClearKeyCdmBaseDirectory, |
| 104 kClearKeyCdmAdapterFileName); | 100 kClearKeyCdmAdapterFileName); |
| 105 } | 101 } |
| 106 #endif // defined(ENABLE_PEPPER_CDMS) | 102 #endif // defined(ENABLE_PEPPER_CDMS) |
| OLD | NEW |