1 # Copyright 2013 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 measurements
import tab_switching
9 from telemetry
import benchmark
12 @benchmark.Enabled('has tabs')
13 @benchmark.Disabled('android') # http://crbug.com/460084
14 class TabSwitchingTop10(perf_benchmark
.PerfBenchmark
):
15 """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.
17 The histogram is a measure of the time between when a tab was requested to be
18 shown, and when first paint occurred. The script opens 10 pages in different
19 tabs, waits for them to load, and then switches to each tab and records the
20 metric. The pages were chosen from Alexa top ranking sites.
22 test
= tab_switching
.TabSwitching
23 page_set
= page_sets
.Top10PageSet
27 return 'tab_switching.top_10'
30 @benchmark.Enabled('has tabs')
31 @benchmark.Disabled('android') # http://crbug.com/460084
32 class TabSwitchingTypical25(perf_benchmark
.PerfBenchmark
):
33 """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.
35 The histogram is a measure of the time between when a tab was requested to be
36 shown, and when first paint occurred. The script opens 25 pages in different
37 tabs, waits for them to load, and then switches to each tab and records the
38 metric. The pages were chosen from Alexa top ranking sites.
40 test
= tab_switching
.TabSwitching
42 def CreateStorySet(self
, options
):
43 return page_sets
.Typical25PageSet(run_no_page_interactions
=True)
47 return 'tab_switching.typical_25'
50 @benchmark.Disabled('android') # http://crbug.com/460084
51 @benchmark.Enabled('has tabs')
52 class TabSwitchingFiveBlankTabs(perf_benchmark
.PerfBenchmark
):
53 """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.
55 The histogram is a measure of the time between when a tab was requested to be
56 shown, and when first paint occurred. The script opens 5 blank pages in
57 different tabs, waits for them to load, and then switches to each tab and
58 records the metric. Blank pages are use to detect unnecessary idle wakeups.
60 test
= tab_switching
.TabSwitching
61 page_set
= page_sets
.FiveBlankPagesPageSet
62 options
= {'pageset_repeat': 10}
66 return 'tab_switching.five_blank_pages'
69 @benchmark.Enabled('has tabs')
70 # http://crbug.com/460084, http://crbug.com/488067
71 @benchmark.Disabled('android', 'linux')
72 class TabSwitchingToughEnergyCases(perf_benchmark
.PerfBenchmark
):
73 """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.
75 The histogram is a measure of the time between when a tab was requested to be
76 shown, and when first paint occurred. The script opens each page in a
77 different tab, waits for them to load, and then switches to each tab and
78 records the metric. The pages were written by hand to stress energy usage.
80 test
= tab_switching
.TabSwitching
81 page_set
= page_sets
.ToughEnergyCasesPageSet
82 options
= {'pageset_repeat': 10}
86 return 'tab_switching.tough_energy_cases'
89 @benchmark.Enabled('has tabs')
90 @benchmark.Disabled('android', # http://crbug.com/460084
91 'xp') # http://crbug.com/532153
92 class TabSwitchingToughImageCases(perf_benchmark
.PerfBenchmark
):
93 """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.
95 The histogram is a measure of the time between when a tab was requested to be
96 shown, and when first paint occurred. The script opens each page in different
97 tabs, waits for them to load, and then switches to each tab and records the
98 metric. The pages were chosen by hand to stress the image decoding system.
100 test
= tab_switching
.TabSwitching
101 page_set
= page_sets
.ToughImageCasesPageSet
105 return 'tab_switching.tough_image_cases'
109 class TabSwitchingFlashEnergyCases(perf_benchmark
.PerfBenchmark
):
110 test
= tab_switching
.TabSwitching
111 page_set
= page_sets
.FlashEnergyCasesPageSet
112 options
= {'pageset_repeat': 10}
116 return 'tab_switching.flash_energy_cases'
120 class TabSwitchingPluginPowerSaver(perf_benchmark
.PerfBenchmark
):
121 test
= tab_switching
.TabSwitching
122 page_set
= page_sets
.FlashEnergyCasesPageSet
123 options
= {'pageset_repeat': 10}
125 def SetExtraBrowserOptions(self
, options
):
126 options
.AppendExtraBrowserArgs(['--enable-plugin-power-saver'])
130 return 'tab_switching.plugin_power_saver'