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 metrics import keychain_metric | 5 from metrics import keychain_metric |
6 from metrics import startup_metric | 6 from metrics import startup_metric |
7 from telemetry.page import page_test | 7 from telemetry.page import page_test |
8 | 8 |
9 | 9 |
10 class Startup(page_test.PageTest): | 10 class Startup(page_test.PageTest): |
11 """Performs a measurement of Chromium's startup performance. | 11 """Performs a measurement of Chromium's startup performance. |
12 | 12 |
13 Uses cold start if cold==True, otherwise uses warm start. A cold start means | 13 Uses cold start if cold==True, otherwise uses warm start. A cold start means |
14 none of the Chromium files are in the disk cache. A warm start assumes the OS | 14 none of the Chromium files are in the disk cache. A warm start assumes the OS |
15 has already cached much of Chromium's content. For warm tests, you should | 15 has already cached much of Chromium's content. For warm tests, you should |
16 repeat the page set to ensure it's cached. | 16 repeat the page set to ensure it's cached. |
17 """ | 17 """ |
18 | 18 |
19 def __init__(self, cold=False, action_name_to_run='RunPageInteractions'): | 19 def __init__(self, cold=False, action_name_to_run='RunPageInteractions'): |
20 super(Startup, self).__init__(needs_browser_restart_after_each_page=True, | 20 super(Startup, self).__init__(needs_browser_restart_after_each_page=True, |
21 action_name_to_run=action_name_to_run) | 21 action_name_to_run=action_name_to_run) |
22 self._cold = cold | 22 self._cold = cold |
23 | 23 |
24 def CustomizeBrowserOptions(self, options): | 24 def CustomizeBrowserOptions(self, options): |
25 if self._cold: | 25 if self._cold: |
26 options.clear_sytem_cache_for_browser_and_profile_on_start = True | 26 options.clear_sytem_cache_for_browser_and_profile_on_start = True |
27 else: | |
28 self.discard_first_result = True | |
29 | |
30 options.AppendExtraBrowserArgs([ | 27 options.AppendExtraBrowserArgs([ |
31 '--enable-stats-collection-bindings' | 28 '--enable-stats-collection-bindings' |
32 ]) | 29 ]) |
33 keychain_metric.KeychainMetric.CustomizeBrowserOptions(options) | 30 keychain_metric.KeychainMetric.CustomizeBrowserOptions(options) |
34 | 31 |
35 def RunNavigateSteps(self, page, tab): | 32 def RunNavigateSteps(self, page, tab): |
36 # Overriden so that no page navigation occurs - startup to the NTP. | 33 # Overriden so that no page navigation occurs - startup to the NTP. |
37 pass | 34 pass |
38 | 35 |
39 def ValidateAndMeasurePage(self, page, tab, results): | 36 def ValidateAndMeasurePage(self, page, tab, results): |
40 keychain_metric.KeychainMetric().AddResults(tab, results) | 37 keychain_metric.KeychainMetric().AddResults(tab, results) |
41 startup_metric.StartupMetric().AddResults(tab, results) | 38 startup_metric.StartupMetric().AddResults(tab, results) |
42 | 39 |
43 | 40 |
44 class StartWithUrl(Startup): | 41 class StartWithUrl(Startup): |
45 """Performs a measurement of Chromium's performance starting with a URL. | 42 """Performs a measurement of Chromium's performance starting with a URL. |
46 | 43 |
47 Uses cold start if cold==True, otherwise uses warm start. A cold start means | 44 Uses cold start if cold==True, otherwise uses warm start. A cold start means |
48 none of the Chromium files are in the disk cache. A warm start assumes the OS | 45 none of the Chromium files are in the disk cache. A warm start assumes the OS |
49 has already cached much of Chromium's content. For warm tests, you should | 46 has already cached much of Chromium's content. For warm tests, you should |
50 repeat the page set to ensure it's cached. | 47 repeat the page set to ensure it's cached. |
51 | 48 |
52 The startup URL is taken from the page's startup_url. This | 49 The startup URL is taken from the page's startup_url. This |
53 allows the testing of multiple different URLs in a single benchmark. | 50 allows the testing of multiple different URLs in a single benchmark. |
54 """ | 51 """ |
55 | 52 |
56 def __init__(self, cold=False): | 53 def __init__(self, cold=False): |
57 super(StartWithUrl, self).__init__(cold=cold, | 54 super(StartWithUrl, self).__init__(cold=cold, |
58 action_name_to_run='RunPageInteractions') | 55 action_name_to_run='RunPageInteractions') |
OLD | NEW |