Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / tools / perf / benchmarks / media.py
blob7e50ef641d26b02f256ce9685cf72f86d7308d4b
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 core import perf_benchmark
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
12 from measurements import media
13 import page_sets
16 class _MSEMeasurement(page_test.PageTest):
17 def __init__(self):
18 super(_MSEMeasurement, self).__init__()
20 def ValidateAndMeasurePage(self, page, tab, results):
21 media_metric = tab.EvaluateJavaScript('window.__testMetrics')
22 trace = media_metric['id'] if 'id' in media_metric else None
23 metrics = media_metric['metrics'] if 'metrics' in media_metric else []
24 for m in metrics:
25 trace_name = '%s.%s' % (m, trace)
26 if isinstance(metrics[m], list):
27 results.AddValue(list_of_scalar_values.ListOfScalarValues(
28 results.current_page, trace_name, units='ms',
29 values=[float(v) for v in metrics[m]],
30 important=True))
32 else:
33 results.AddValue(scalar.ScalarValue(
34 results.current_page, trace_name, units='ms',
35 value=float(metrics[m]), important=True))
38 @benchmark.Disabled('android', # See media.android.tough_video_cases below
39 'xp') # crbug.com/475191
40 class Media(perf_benchmark.PerfBenchmark):
41 """Obtains media metrics for key user scenarios."""
42 test = media.Media
43 page_set = page_sets.ToughVideoCasesPageSet
45 @classmethod
46 def Name(cls):
47 return 'media.tough_video_cases'
50 @benchmark.Disabled('android', 'mac', 'xp')
51 class MediaNetworkSimulation(perf_benchmark.PerfBenchmark):
52 """Obtains media metrics under different network simulations."""
53 test = media.Media
54 page_set = page_sets.MediaCnsCasesPageSet
56 @classmethod
57 def Name(cls):
58 return 'media.media_cns_cases'
61 @benchmark.Disabled() # crbug.com/448092
62 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689
63 class MediaAndroid(perf_benchmark.PerfBenchmark):
64 """Obtains media metrics for key user scenarios on Android."""
65 test = media.Media
66 tag = 'android'
67 page_set = page_sets.ToughVideoCasesPageSet
68 # Exclude is_4k and 50 fps media files (garden* & crowd*).
69 options = {'story_label_filter_exclude': 'is_4k,is_50fps'}
71 @classmethod
72 def Name(cls):
73 return 'media.android.tough_video_cases'
76 @benchmark.Enabled('chromeos')
77 class MediaChromeOS4kOnly(perf_benchmark.PerfBenchmark):
78 """Benchmark for media performance on ChromeOS using only is_4k test content.
79 """
80 test = media.Media
81 tag = 'chromeOS4kOnly'
82 page_set = page_sets.ToughVideoCasesPageSet
83 options = {
84 'story_label_filter': 'is_4k',
85 # Exclude is_50fps test files: crbug/331816
86 'story_label_filter_exclude': 'is_50fps'
89 @classmethod
90 def Name(cls):
91 return 'media.chromeOS4kOnly.tough_video_cases'
94 @benchmark.Enabled('chromeos')
95 class MediaChromeOS(perf_benchmark.PerfBenchmark):
96 """Benchmark for media performance on all ChromeOS platforms.
98 This benchmark does not run is_4k content, there's a separate benchmark for
99 that.
101 test = media.Media
102 tag = 'chromeOS'
103 page_set = page_sets.ToughVideoCasesPageSet
104 # Exclude is_50fps test files: crbug/331816
105 options = {'story_label_filter_exclude': 'is_4k,is_50fps'}
107 @classmethod
108 def Name(cls):
109 return 'media.chromeOS.tough_video_cases'
112 @benchmark.Disabled('android-webview') # crbug.com/419689
113 class MediaSourceExtensions(perf_benchmark.PerfBenchmark):
114 """Obtains media metrics for key media source extensions functions."""
115 test = _MSEMeasurement
116 page_set = page_sets.MseCasesPageSet
118 @classmethod
119 def Name(cls):
120 return 'media.mse_cases'
122 def SetExtraBrowserOptions(self, options):
123 # Needed to allow XHR requests to return stream objects.
124 options.AppendExtraBrowserArgs(
125 ['--enable-experimental-web-platform-features',
126 '--disable-gesture-requirement-for-media-playback'])