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/gmock/include/gmock/gmock.h" | |
11 #include "testing/perf/perf_test.h" | |
12 | |
13 | |
14 const char kWidevineAdapterName[] = "widevinecdm"; | |
ddorwin
2014/02/06 19:57:33
This file is specific to WV, but the filename is n
shadi1
2014/02/07 23:37:17
Done.
| |
15 | |
16 TEST(CDMBinLoadPerfTest, Basic) { | |
ddorwin
2014/02/06 19:57:33
Do we need "Bin"? It seems redundant, but if so, s
shadi1
2014/02/07 23:37:17
Done.
| |
17 base::NativeLibrary native_library; | |
18 base::FilePath adapter_full_name; | |
19 adapter_full_name = base::FilePath::FromUTF16Unsafe( | |
20 base::GetNativeLibraryName(base::ASCIIToUTF16(kWidevineAdapterName))); | |
shadi1
2014/02/01 01:50:07
This does the magic of appending "lib", "dll", "pl
ddorwin
2014/02/06 19:57:33
Coo, maybe we should use this instead of having a
| |
21 base::FilePath output_dir; | |
22 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &output_dir)); | |
23 base::FilePath adapter_path = output_dir.Append(adapter_full_name); | |
24 std::string error; | |
25 base::TimeTicks start = base::TimeTicks::HighResNow(); | |
26 native_library = base::LoadNativeLibrary(adapter_path, &error); | |
27 double delta = (base::TimeTicks::HighResNow() - start).InMillisecondsF(); | |
28 EXPECT_TRUE(native_library); | |
29 if (!native_library) { | |
ddorwin
2014/02/06 19:57:33
How about combining these lines?
EXPECT_TRUE(nat
shadi1
2014/02/07 23:37:17
Done.
| |
30 std::cout << "Error loading apadter:\n" << error; | |
31 } else { | |
32 perf_test::PrintResult("time_to_load_adapter", | |
ddorwin
2014/02/06 19:57:33
I'm not sure how unique this needs to be, but we s
shadi1
2014/02/07 23:37:17
True about the other parameter that makes it uniqu
| |
33 "", | |
34 kWidevineAdapterName, | |
35 delta, | |
36 "ms", | |
37 true); | |
38 } | |
39 } | |
OLD | NEW |