Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1038)

Unified Diff: chrome/browser/media/load_cdm_benchmark_test.cc

Issue 151283003: Perf test to measure loading CDM library. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nit Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | chrome/chrome_tests.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3b60b2dd27c7a0ed835406ff1e3309a4199dbf7b
--- /dev/null
+++ b/chrome/browser/media/load_cdm_benchmark_test.cc
@@ -0,0 +1,44 @@
+// 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/gtest/include/gtest/gtest.h"
+#include "testing/perf/perf_test.h"
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+
+
+void MeasureLoadTime(const std::string& library_name) {
+ base::NativeLibrary native_library;
+ base::FilePath library_full_name;
+ library_full_name = base::FilePath::FromUTF16Unsafe(
+ base::GetNativeLibraryName(base::ASCIIToUTF16(library_name)));
+ base::FilePath output_dir;
+ EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &output_dir));
+ base::FilePath library_path = output_dir.Append(library_full_name);
+ std::string error;
+ base::TimeTicks start = base::TimeTicks::HighResNow();
+ native_library = base::LoadNativeLibrary(library_path, &error);
+ double delta = (base::TimeTicks::HighResNow() - start).InMillisecondsF();
+ EXPECT_TRUE(native_library) << "Error loading library:\n" << error;
+ perf_test::PrintResult("time_to_load",
ddorwin 2014/02/07 23:59:12 Just to be safe (in case libraries don't include "
+ "",
+ library_name,
+ delta,
+ "ms",
+ true);
+}
+
ddorwin 2014/02/07 23:59:12 #if defined(ENABLE_PEPPER_CDMS) around 36-44
+#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
+TEST(CDMLoadPerfTest, Widevine) {
+ MeasureLoadTime("widevinecdm");
+}
+#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
+
+TEST(CDMLoadPerfTest, ClearKey) {
ddorwin 2014/02/07 23:59:12 External...
shadi1 2014/02/08 01:01:22 Done....but the library name does not include exte
+ MeasureLoadTime("clearkeycdm");
+}
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | chrome/chrome_tests.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698