[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / tools / perf / measurements / startup.py
blob6acf9d2c65b4da9147d5bf604933b70a9538df97
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
3 # found in the LICENSE file.
5 from telemetry.page import page_test
7 from metrics import keychain_metric
8 from metrics import startup_metric
11 class Startup(page_test.PageTest):
12 """Performs a measurement of Chromium's startup performance.
14 Uses cold start if cold==True, otherwise uses warm start. A cold start means
15 none of the Chromium files are in the disk cache. A warm start assumes the OS
16 has already cached much of Chromium's content. For warm tests, you should
17 repeat the page set to ensure it's cached.
18 """
20 def __init__(self, cold=False):
21 super(Startup, self).__init__(needs_browser_restart_after_each_page=True)
22 self._cold = cold
24 def CustomizeBrowserOptions(self, options):
25 if self._cold:
26 options.clear_sytem_cache_for_browser_and_profile_on_start = True
27 options.AppendExtraBrowserArgs([
28 '--enable-stats-collection-bindings'
30 keychain_metric.KeychainMetric.CustomizeBrowserOptions(options)
32 def RunNavigateSteps(self, page, tab):
33 # Overriden so that no page navigation occurs - startup to the NTP.
34 pass
36 def ValidateAndMeasurePage(self, page, tab, results):
37 keychain_metric.KeychainMetric().AddResults(tab, results)
38 startup_metric.StartupMetric().AddResults(tab, results)
41 class StartWithUrl(Startup):
42 """Performs a measurement of Chromium's performance starting with a URL.
44 Uses cold start if cold==True, otherwise uses warm start. A cold start means
45 none of the Chromium files are in the disk cache. A warm start assumes the OS
46 has already cached much of Chromium's content. For warm tests, you should
47 repeat the page set to ensure it's cached.
49 The startup URL is taken from the page's startup_url. This
50 allows the testing of multiple different URLs in a single benchmark.
51 """
53 def __init__(self, cold=False):
54 super(StartWithUrl, self).__init__(cold=cold)