OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/files/file_path.h" | |
6 #include "base/path_service.h" | |
7 #include "base/scoped_native_library.h" | |
8 #include "base/strings/utf_string_conversions.h" | |
9 #include "base/time/time.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | |
11 #include "testing/perf/perf_test.h" | |
12 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
13 | |
14 | |
15 void MeasureTimeToLoad(const std::string& library_name) { | |
16 base::NativeLibrary native_library; | |
17 base::FilePath library_full_name; | |
18 library_full_name = base::FilePath::FromUTF16Unsafe( | |
19 base::GetNativeLibraryName(base::ASCIIToUTF16(library_name))); | |
20 base::FilePath output_dir; | |
21 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &output_dir)); | |
22 base::FilePath library_path = output_dir.Append(library_full_name); | |
23 std::string error; | |
24 base::TimeTicks start = base::TimeTicks::HighResNow(); | |
25 native_library = base::LoadNativeLibrary(library_path, &error); | |
26 double delta = (base::TimeTicks::HighResNow() - start).InMillisecondsF(); | |
27 EXPECT_TRUE(native_library) << "Error loading library:\n" << error; | |
28 perf_test::PrintResult("time_to_load_library", | |
29 "", | |
30 library_full_name.value(), | |
31 delta, | |
32 "ms", | |
33 true); | |
34 } | |
35 | |
36 #if defined(ENABLE_PEPPER_CDMS) | |
37 #if defined(WIDEVINE_CDM_AVAILABLE) | |
38 TEST(LoadCDMPerfTest, Widevine) { | |
39 MeasureTimeToLoad("widevinecdm"); | |
ddorwin
2014/02/08 01:26:59
Should we load the ...adapter? It's the whole pack
| |
40 } | |
41 #endif // defined(WIDEVINE_CDM_AVAILABLE) | |
42 | |
43 TEST(LoadCDMPerfTest, ExternalClearKey) { | |
44 MeasureTimeToLoad("clearkeycdm"); | |
45 } | |
46 #endif // defined(ENABLE_PEPPER_CDMS) | |
OLD | NEW |