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( | |
xhwang
2014/02/08 05:29:38
Can you merge line 17 and 18?
shadi1
2014/02/10 20:22:28
Done.
| |
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); | |
xhwang
2014/02/08 05:29:38
Merge line 16 into this line?
shadi1
2014/02/10 20:22:28
Done.
| |
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"); | |
xhwang
2014/02/08 05:29:38
How about using kWidevineCdmFileName in widevine_c
shadi1
2014/02/10 20:22:28
The reason is because kWidevineCdmFileName already
| |
40 } | |
41 | |
42 TEST(LoadCDMPerfTest, WidevineAdapter) { | |
43 MeasureTimeToLoad("widevinecdmadapter"); | |
xhwang
2014/02/08 05:29:38
Ditto about using kWidevineCdmAdapterFileName.
| |
44 } | |
45 #endif // defined(WIDEVINE_CDM_AVAILABLE) | |
46 | |
47 TEST(LoadCDMPerfTest, ExternalClearKey) { | |
48 MeasureTimeToLoad("clearkeycdm"); | |
49 } | |
50 | |
51 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) { | |
52 MeasureTimeToLoad("clearkeycdmadapter"); | |
53 } | |
54 #endif // defined(ENABLE_PEPPER_CDMS) | |
OLD | NEW |