Mojo C++ bindings: better log message for serialization warnings.
[chromium-blink-merge.git] / tools / perf / benchmarks / media.py
blob09c6b96dc4f48be788e05e8be7cf25b4ae2d6692
1 # Copyright 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.
5 from measurements import media
6 import page_sets
7 from telemetry import benchmark
8 from telemetry.page import page_test
9 from telemetry.value import list_of_scalar_values
10 from telemetry.value import scalar
13 class _MSEMeasurement(page_test.PageTest):
14 def ValidateAndMeasurePage(self, page, tab, results):
15 media_metric = tab.EvaluateJavaScript('window.__testMetrics')
16 trace = media_metric['id'] if 'id' in media_metric else None
17 metrics = media_metric['metrics'] if 'metrics' in media_metric else []
18 for m in metrics:
19 trace_name = '%s.%s' % (m, trace)
20 if isinstance(metrics[m], list):
21 results.AddValue(list_of_scalar_values.ListOfScalarValues(
22 results.current_page, trace_name, units='ms',
23 values=[float(v) for v in metrics[m]],
24 important=True))
26 else:
27 results.AddValue(scalar.ScalarValue(
28 results.current_page, trace_name, units='ms',
29 value=float(metrics[m]), important=True))
32 @benchmark.Disabled('android')
33 class Media(benchmark.Benchmark):
34 """Obtains media metrics for key user scenarios."""
35 test = media.Media
36 page_set = page_sets.ToughVideoCasesPageSet
39 @benchmark.Disabled
40 class MediaNetworkSimulation(benchmark.Benchmark):
41 """Obtains media metrics under different network simulations."""
42 test = media.Media
43 page_set = page_sets.MediaCnsCasesPageSet
46 @benchmark.Enabled('android')
47 @benchmark.Disabled('l')
48 class MediaAndroid(benchmark.Benchmark):
49 """Obtains media metrics for key user scenarios on Android."""
50 test = media.Media
51 tag = 'android'
52 page_set = page_sets.ToughVideoCasesPageSet
53 # Exclude is_4k and 50 fps media files (garden* & crowd*).
54 options = {'page_label_filter_exclude': 'is_4k,is_50fps'}
57 @benchmark.Enabled('chromeos')
58 class MediaChromeOS4kOnly(benchmark.Benchmark):
59 """Benchmark for media performance on ChromeOS using only is_4k test content.
60 """
61 test = media.Media
62 tag = 'chromeOS4kOnly'
63 page_set = page_sets.ToughVideoCasesPageSet
64 options = {
65 'page_label_filter': 'is_4k',
66 # Exclude is_50fps test files: crbug/331816
67 'page_label_filter_exclude': 'is_50fps'
71 @benchmark.Enabled('chromeos')
72 class MediaChromeOS(benchmark.Benchmark):
73 """Benchmark for media performance on all ChromeOS platforms.
75 This benchmark does not run is_4k content, there's a separate benchmark for
76 that.
77 """
78 test = media.Media
79 tag = 'chromeOS'
80 page_set = page_sets.ToughVideoCasesPageSet
81 # Exclude is_50fps test files: crbug/331816
82 options = {'page_label_filter_exclude': 'is_4k,is_50fps'}
85 class MediaSourceExtensions(benchmark.Benchmark):
86 """Obtains media metrics for key media source extensions functions."""
87 test = _MSEMeasurement
88 page_set = page_sets.MseCasesPageSet
90 def CustomizeBrowserOptions(self, options):
91 # Needed to allow XHR requests to return stream objects.
92 options.AppendExtraBrowserArgs(
93 ['--enable-experimental-web-platform-features',
94 '--disable-gesture-requirement-for-media-playback'])