Index: chrome/browser/media/load_cdm_benchmark_test.cc |
diff --git a/chrome/browser/media/load_cdm_benchmark_test.cc b/chrome/browser/media/load_cdm_benchmark_test.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..af5be06ece7517dd0e9e0a02e2a5de973fd3290a |
--- /dev/null |
+++ b/chrome/browser/media/load_cdm_benchmark_test.cc |
@@ -0,0 +1,39 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/files/file_path.h" |
+#include "base/path_service.h" |
+#include "base/scoped_native_library.h" |
+#include "base/strings/utf_string_conversions.h" |
+#include "base/time/time.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+#include "testing/perf/perf_test.h" |
+ |
+ |
+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.
|
+ |
+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.
|
+ base::NativeLibrary native_library; |
+ base::FilePath adapter_full_name; |
+ adapter_full_name = base::FilePath::FromUTF16Unsafe( |
+ 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
|
+ base::FilePath output_dir; |
+ EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &output_dir)); |
+ base::FilePath adapter_path = output_dir.Append(adapter_full_name); |
+ std::string error; |
+ base::TimeTicks start = base::TimeTicks::HighResNow(); |
+ native_library = base::LoadNativeLibrary(adapter_path, &error); |
+ double delta = (base::TimeTicks::HighResNow() - start).InMillisecondsF(); |
+ EXPECT_TRUE(native_library); |
+ 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.
|
+ std::cout << "Error loading apadter:\n" << error; |
+ } else { |
+ 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
|
+ "", |
+ kWidevineAdapterName, |
+ delta, |
+ "ms", |
+ true); |
+ } |
+} |