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 import collections | 5 import collections |
6 | 6 |
7 from measurements import startup | 7 from measurements import startup |
8 from metrics import cpu | 8 from metrics import cpu |
9 from metrics import startup_metric | 9 from metrics import startup_metric |
10 from telemetry.core import util | 10 from telemetry.core import util |
11 from telemetry.value import histogram_util | 11 from telemetry.value import histogram_util |
12 | 12 |
13 | 13 |
14 class SessionRestore(startup.Startup): | 14 class SessionRestore(startup.Startup): |
15 """Performs a measurement of Chromium's Session restore performance. | 15 """Performs a measurement of Chromium's Session restore performance. |
16 | 16 |
17 This test is meant to be run against a generated profile. | 17 This test is meant to be run against a generated profile. |
18 This test inherits support for the 'cold' option - | 18 This test inherits support for the 'cold' option - |
19 see startup.py for details. | 19 see startup.py for details. |
20 """ | 20 """ |
21 | 21 |
22 def __init__(self, cold=False, action_name_to_run = ''): | 22 def __init__(self, cold=False, action_name_to_run='RunPageInteractions'): |
23 super(SessionRestore, self).__init__(cold=cold, | 23 super(SessionRestore, self).__init__(cold=cold, |
24 action_name_to_run=action_name_to_run) | 24 action_name_to_run=action_name_to_run) |
25 self.close_tabs_before_run = False | 25 self.close_tabs_before_run = False |
26 self._cpu_metric = None | 26 self._cpu_metric = None |
27 | 27 |
28 def CustomizeBrowserOptions(self, options): | 28 def CustomizeBrowserOptions(self, options): |
29 super(SessionRestore, self).CustomizeBrowserOptions(options) | 29 super(SessionRestore, self).CustomizeBrowserOptions(options) |
30 histogram_util.CustomizeBrowserOptions(options) | 30 histogram_util.CustomizeBrowserOptions(options) |
31 options.AppendExtraBrowserArgs([ | 31 options.AppendExtraBrowserArgs([ |
32 '--restore-last-session' | 32 '--restore-last-session' |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 def ValidateAndMeasurePage(self, page, tab, results): | 71 def ValidateAndMeasurePage(self, page, tab, results): |
72 tab.WaitForDocumentReadyStateToBeComplete() | 72 tab.WaitForDocumentReadyStateToBeComplete() |
73 | 73 |
74 # Record CPU usage from browser start to when the foreground page is loaded. | 74 # Record CPU usage from browser start to when the foreground page is loaded. |
75 self._cpu_metric.Stop(None, None) | 75 self._cpu_metric.Stop(None, None) |
76 self._cpu_metric.AddResults(tab, results, 'cpu_utilization') | 76 self._cpu_metric.AddResults(tab, results, 'cpu_utilization') |
77 | 77 |
78 startup_metric.StartupMetric().AddResults(tab, results) | 78 startup_metric.StartupMetric().AddResults(tab, results) |
79 | 79 |
80 # TODO(jeremy): Measure time to load - first, last and frontmost tab here. | 80 # TODO(jeremy): Measure time to load - first, last and frontmost tab here. |
OLD | NEW |