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 benchmarks
import silk_flags
8 from measurements
import power
10 from telemetry
import benchmark
13 @benchmark.Enabled('android')
14 class PowerAndroidAcceptance(perf_benchmark
.PerfBenchmark
):
15 """Android power acceptance test."""
17 page_set
= page_sets
.AndroidAcceptancePageSet
19 def SetExtraBrowserOptions(self
, options
):
20 options
.full_performance_mode
= False
24 return 'power.android_acceptance'
27 @benchmark.Enabled('android')
28 class PowerTypical10Mobile(perf_benchmark
.PerfBenchmark
):
29 """Android typical 10 mobile power test."""
31 page_set
= page_sets
.Typical10MobilePageSet
33 def SetExtraBrowserOptions(self
, options
):
34 options
.full_performance_mode
= False
38 return 'power.typical_10_mobile'
41 @benchmark.Enabled('android')
43 class PowerTypical10MobileReload(perf_benchmark
.PerfBenchmark
):
44 """Android typical 10 mobile power reload test."""
45 test
= power
.LoadPower
46 page_set
= page_sets
.Typical10MobileReloadPageSet
48 def SetExtraBrowserOptions(self
, options
):
49 options
.full_performance_mode
= False
53 return 'power.typical_10_mobile_reload'
56 @benchmark.Enabled('android')
57 class PowerGpuRasterizationTypical10Mobile(perf_benchmark
.PerfBenchmark
):
58 """Measures power on key mobile sites with GPU rasterization."""
59 tag
= 'gpu_rasterization'
61 page_set
= page_sets
.Typical10MobilePageSet
63 def SetExtraBrowserOptions(self
, options
):
64 silk_flags
.CustomizeBrowserOptionsForGpuRasterization(options
)
65 options
.full_performance_mode
= False
69 return 'power.gpu_rasterization.typical_10_mobile'
71 @benchmark.Enabled('mac')
72 class PowerTop10(perf_benchmark
.PerfBenchmark
):
73 """Top 10 quiescent power test."""
74 test
= power
.QuiescentPower
75 page_set
= page_sets
.Top10PageSet
77 def SetExtraBrowserOptions(self
, options
):
78 options
.full_performance_mode
= False
85 @benchmark.Enabled('mac')
86 class PowerTop25(perf_benchmark
.PerfBenchmark
):
87 """Top 25 quiescent power test."""
88 test
= power
.QuiescentPower
89 page_set
= page_sets
.Top25PageSet
91 def SetExtraBrowserOptions(self
, options
):
92 options
.full_performance_mode
= False
98 def CreateStorySet(self
, _
):
99 # Exclude techcrunch.com. It is not suitable for this benchmark because it
100 # does not consistently become quiescent within 60 seconds.
101 stories
= self
.page_set()
102 found
= next((x
for x
in stories
if 'techcrunch.com' in x
.url
), None)
104 stories
.RemoveStory(found
)
108 @benchmark.Enabled('linux', 'mac', 'win', 'chromeos')
109 class PowerPPSControlDisabled(perf_benchmark
.PerfBenchmark
):
110 """A single page with a small-ish non-essential plugin. In this test, Plugin
111 Power Saver (PPS) is disabled, so the plugin should continue animating and
113 test
= power
.QuiescentPower
114 page_set
= page_sets
.PluginPowerSaverPageSet
115 options
= {'pageset_repeat': 5}
117 def SetExtraBrowserOptions(self
, options
):
118 options
.AppendExtraBrowserArgs(['--disable-plugin-power-saver'])
119 options
.full_performance_mode
= False
123 return 'power.pps_control_disabled'
126 @benchmark.Enabled('linux', 'mac', 'win', 'chromeos')
127 class PowerPPSControlEnabled(perf_benchmark
.PerfBenchmark
):
128 """A single page with a small-ish non-essential plugin. In this test, Plugin
129 Power Saver (PPS) is enabled, so the plugin should be throttled (idle with a
130 "Click to play" button)."""
131 test
= power
.QuiescentPower
132 page_set
= page_sets
.PluginPowerSaverPageSet
133 options
= {'pageset_repeat': 5}
135 def SetExtraBrowserOptions(self
, options
):
136 options
.AppendExtraBrowserArgs(['--enable-plugin-power-saver'])
137 options
.full_performance_mode
= False
141 return 'power.pps_control_enabled'
144 @benchmark.Enabled('linux', 'mac', 'win', 'chromeos')
145 class PowerThrottledPlugins(perf_benchmark
.PerfBenchmark
):
146 """Tests that pages with flash ads take more power without Plugin Power Saver
147 (PPS) throttling them."""
148 test
= power
.QuiescentPower
149 page_set
= page_sets
.ThrottledPluginsPageSet
150 options
= {'pageset_repeat': 5}
152 def SetExtraBrowserOptions(self
, options
):
153 options
.AppendExtraBrowserArgs(['--disable-plugin-power-saver'])
154 options
.full_performance_mode
= False
158 return 'power.throttled_plugins_pps_disabled'
161 @benchmark.Enabled('linux', 'mac', 'win', 'chromeos')
162 class PowerThrottledPluginsPPS(perf_benchmark
.PerfBenchmark
):
163 """Tests that pages with flash ads take less power with Plugin Power Saver
164 (PPS) enabled to throttle them."""
165 test
= power
.QuiescentPower
166 page_set
= page_sets
.ThrottledPluginsPageSet
167 options
= {'pageset_repeat': 5}
169 def SetExtraBrowserOptions(self
, options
):
170 options
.AppendExtraBrowserArgs(['--enable-plugin-power-saver'])
171 options
.full_performance_mode
= False
175 return 'power.throttled_plugins_pps_enabled'