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 from measurements import startup | 5 from measurements import startup |
6 from metrics import cpu | 6 from metrics import cpu |
7 from metrics import startup_metric | 7 from metrics import startup_metric |
8 | 8 |
9 | 9 |
10 class SessionRestore(startup.Startup): | 10 class SessionRestore(startup.Startup): |
11 """Performs a measurement of Chromium's Session restore performance. | 11 """Performs a measurement of Chromium's Session restore performance. |
12 | 12 |
13 This test is meant to be run against a generated profile. | 13 This test is meant to be run against a generated profile. |
14 This test inherits support for the --warm or --cold command line options - | 14 This test inherits support for the --warm or --cold command line options - |
15 see startup.py for details. | 15 see startup.py for details. |
16 """ | 16 """ |
17 | 17 |
18 def __init__(self): | 18 def __init__(self, action_name_to_run = ''): |
19 super(SessionRestore, self).__init__() | 19 super(SessionRestore, self).__init__(action_name_to_run=action_name_to_run) |
20 self.close_tabs_before_run = False | 20 self.close_tabs_before_run = False |
21 self._cpu_metric = None | 21 self._cpu_metric = None |
22 | 22 |
23 def CustomizeBrowserOptions(self, options): | 23 def CustomizeBrowserOptions(self, options): |
24 super(SessionRestore, self).CustomizeBrowserOptions(options) | 24 super(SessionRestore, self).CustomizeBrowserOptions(options) |
25 options.AppendExtraBrowserArgs([ | 25 options.AppendExtraBrowserArgs([ |
26 '--restore-last-session' | 26 '--restore-last-session' |
27 ]) | 27 ]) |
28 | 28 |
29 def CanRunForPage(self, page): | 29 def CanRunForPage(self, page): |
(...skipping 25 matching lines...) Expand all Loading... |
55 t = tab.browser.tabs[i] | 55 t = tab.browser.tabs[i] |
56 t.WaitForDocumentReadyStateToBeComplete() | 56 t.WaitForDocumentReadyStateToBeComplete() |
57 | 57 |
58 # Record CPU usage from browser start to when all pages have loaded. | 58 # Record CPU usage from browser start to when all pages have loaded. |
59 self._cpu_metric.Stop(None, None) | 59 self._cpu_metric.Stop(None, None) |
60 self._cpu_metric.AddResults(tab, results, 'cpu_utilization') | 60 self._cpu_metric.AddResults(tab, results, 'cpu_utilization') |
61 | 61 |
62 startup_metric.StartupMetric().AddResults(tab, results) | 62 startup_metric.StartupMetric().AddResults(tab, results) |
63 | 63 |
64 # TODO(jeremy): Measure time to load - first, last and frontmost tab here. | 64 # TODO(jeremy): Measure time to load - first, last and frontmost tab here. |
OLD | NEW |