| 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 Power usage is also measured. | 10 Power usage is also measured. |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 import time | 13 import time |
| 14 | 14 |
| 15 from telemetry.core import util | 15 from telemetry.core import util |
| 16 from telemetry.page import page_test | 16 from telemetry.page import legacy_page_test |
| 17 from telemetry.value import histogram | 17 from telemetry.value import histogram |
| 18 from telemetry.value import histogram_util | 18 from telemetry.value import histogram_util |
| 19 | 19 |
| 20 from metrics import keychain_metric | 20 from metrics import keychain_metric |
| 21 from metrics import power | 21 from metrics import power |
| 22 | 22 |
| 23 # TODO: Revisit this test once multitab support is finalized. | 23 # TODO: Revisit this test once multitab support is finalized. |
| 24 | 24 |
| 25 | 25 |
| 26 class TabSwitching(page_test.PageTest): | 26 class TabSwitching(legacy_page_test.LegacyPageTest): |
| 27 | 27 |
| 28 # Amount of time to measure, in seconds. | 28 # Amount of time to measure, in seconds. |
| 29 SAMPLE_TIME = 30 | 29 SAMPLE_TIME = 30 |
| 30 | 30 |
| 31 def __init__(self): | 31 def __init__(self): |
| 32 super(TabSwitching, self).__init__() | 32 super(TabSwitching, self).__init__() |
| 33 self.first_page_in_storyset = True | 33 self.first_page_in_storyset = True |
| 34 self._power_metric = None | 34 self._power_metric = None |
| 35 | 35 |
| 36 def CustomizeBrowserOptions(self, options): | 36 def CustomizeBrowserOptions(self, options): |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 results.AddSummaryValue( | 103 results.AddSummaryValue( |
| 104 histogram.HistogramValue(None, display_name, 'ms', | 104 histogram.HistogramValue(None, display_name, 'ms', |
| 105 raw_value_json=diff_histogram, | 105 raw_value_json=diff_histogram, |
| 106 important=False)) | 106 important=False)) |
| 107 | 107 |
| 108 keychain_metric.KeychainMetric().AddResults(tab, results) | 108 keychain_metric.KeychainMetric().AddResults(tab, results) |
| 109 | 109 |
| 110 def DidRunPage(self, platform): | 110 def DidRunPage(self, platform): |
| 111 self._power_metric.Close() | 111 self._power_metric.Close() |
| OLD | NEW |