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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | chrome/chrome_tests.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 MeasureLoadTime(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",
ddorwin 2014/02/07 23:59:12 Just to be safe (in case libraries don't include "
29 "",
30 library_name,
31 delta,
32 "ms",
33 true);
34 }
35
ddorwin 2014/02/07 23:59:12 #if defined(ENABLE_PEPPER_CDMS) around 36-44
36 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
37 TEST(CDMLoadPerfTest, Widevine) {
38 MeasureLoadTime("widevinecdm");
39 }
40 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
41
42 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
43 MeasureLoadTime("clearkeycdm");
44 }
OLDNEW
« 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