OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """The tab switching measurement. | 5 """The tab switching measurement. |
6 | 6 |
7 This measurement opens pages in different tabs. After all the tabs have opened, | 7 This measurement opens pages in different tabs. After all the tabs have opened, |
8 it cycles through each tab in sequence, and records a histogram of the time | 8 it cycles through each tab in sequence, and records a histogram of the time |
9 between when a tab was first requested to be shown, and when it was painted. | 9 between when a tab was first requested to be shown, and when it was painted. |
10 """ | 10 """ |
11 | 11 |
12 from metrics import histogram_util | 12 from metrics import histogram_util |
13 from telemetry.core import util | 13 from telemetry.core import util |
14 from telemetry.page import page_measurement | 14 from telemetry.page import page_measurement |
| 15 from telemetry.page import result_data_type |
15 from telemetry.page import page_runner | 16 from telemetry.page import page_runner |
16 | 17 |
17 # TODO: Revisit this test once multitab support is finalized. | 18 # TODO: Revisit this test once multitab support is finalized. |
18 | 19 |
19 class TabSwitching(page_measurement.PageMeasurement): | 20 class TabSwitching(page_measurement.PageMeasurement): |
20 def CustomizeBrowserOptions(self, options): | 21 def CustomizeBrowserOptions(self, options): |
21 options.AppendExtraBrowserArg('--enable-stats-collection-bindings') | 22 options.AppendExtraBrowserArg('--enable-stats-collection-bindings') |
22 options.AppendExtraBrowserArg('--dom-automation') | 23 options.AppendExtraBrowserArg('--dom-automation') |
23 | 24 |
24 def CanRunForPage(self, page): | 25 def CanRunForPage(self, page): |
(...skipping 30 matching lines...) Expand all Loading... |
55 util.WaitFor(_IsDone, 30) | 56 util.WaitFor(_IsDone, 30) |
56 prev_histogram = histogram_util.GetHistogramFromDomAutomation( | 57 prev_histogram = histogram_util.GetHistogramFromDomAutomation( |
57 histogram_type, histogram_name, tab) | 58 histogram_type, histogram_name, tab) |
58 | 59 |
59 last_histogram = histogram_util.GetHistogramFromDomAutomation( | 60 last_histogram = histogram_util.GetHistogramFromDomAutomation( |
60 histogram_type, histogram_name, tab) | 61 histogram_type, histogram_name, tab) |
61 diff_histogram = histogram_util.SubtractHistogram(last_histogram, | 62 diff_histogram = histogram_util.SubtractHistogram(last_histogram, |
62 first_histogram) | 63 first_histogram) |
63 | 64 |
64 results.AddSummary(histogram_name, '', diff_histogram, | 65 results.AddSummary(histogram_name, '', diff_histogram, |
65 data_type='unimportant-histogram') | 66 data_type=result_data_type.UNIMPORTANT_HISTOGRAM) |
OLD | NEW |