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. |
(...skipping 30 matching lines...) Expand all Loading... |
41 ]) | 41 ]) |
42 # Enable background networking so we can test its impact on power usage. | 42 # Enable background networking so we can test its impact on power usage. |
43 options.disable_background_networking = False | 43 options.disable_background_networking = False |
44 power.PowerMetric.CustomizeBrowserOptions(options) | 44 power.PowerMetric.CustomizeBrowserOptions(options) |
45 | 45 |
46 def WillStartBrowser(self, platform): | 46 def WillStartBrowser(self, platform): |
47 self.first_page_in_storyset = True | 47 self.first_page_in_storyset = True |
48 self._power_metric = power.PowerMetric(platform, TabSwitching.SAMPLE_TIME) | 48 self._power_metric = power.PowerMetric(platform, TabSwitching.SAMPLE_TIME) |
49 | 49 |
50 def TabForPage(self, page, browser): | 50 def TabForPage(self, page, browser): |
| 51 del page # unused |
51 if self.first_page_in_storyset: | 52 if self.first_page_in_storyset: |
52 # The initial browser window contains a single tab, navigate that tab | 53 # The initial browser window contains a single tab, navigate that tab |
53 # rather than creating a new one. | 54 # rather than creating a new one. |
54 self.first_page_in_storyset = False | 55 self.first_page_in_storyset = False |
55 return browser.tabs[0] | 56 return browser.tabs[0] |
56 | 57 |
57 return browser.tabs.New() | 58 return browser.tabs.New() |
58 | 59 |
59 def StopBrowserAfterPage(self, browser, page): | 60 def StopBrowserAfterPage(self, browser, page): |
60 # Restart the browser after the last page in the pageset. | 61 # Restart the browser after the last page in the pageset. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 first_histogram) | 102 first_histogram) |
102 | 103 |
103 results.AddSummaryValue( | 104 results.AddSummaryValue( |
104 histogram.HistogramValue(None, display_name, 'ms', | 105 histogram.HistogramValue(None, display_name, 'ms', |
105 raw_value_json=diff_histogram, | 106 raw_value_json=diff_histogram, |
106 important=False)) | 107 important=False)) |
107 | 108 |
108 keychain_metric.KeychainMetric().AddResults(tab, results) | 109 keychain_metric.KeychainMetric().AddResults(tab, results) |
109 | 110 |
110 def DidRunPage(self, platform): | 111 def DidRunPage(self, platform): |
| 112 del platform # unused |
111 self._power_metric.Close() | 113 self._power_metric.Close() |
OLD | NEW |