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 metrics
import startup_metric
6 from telemetry
.page
import page_test
9 class Startup(page_test
.PageTest
):
10 """Performs a measurement of Chromium's startup performance.
12 Uses cold start if cold==True, otherwise uses warm start. A cold start means
13 none of the Chromium files are in the disk cache. A warm start assumes the OS
14 has already cached much of Chromium's content. For warm tests, you should
15 repeat the page set to ensure it's cached.
18 def __init__(self
, cold
=False, action_name_to_run
=''):
19 super(Startup
, self
).__init
__(needs_browser_restart_after_each_page
=True,
20 action_name_to_run
=action_name_to_run
)
23 def CustomizeBrowserOptions(self
, options
):
25 options
.clear_sytem_cache_for_browser_and_profile_on_start
= True
27 self
.discard_first_result
= True
29 options
.AppendExtraBrowserArgs([
30 '--enable-stats-collection-bindings'
33 def RunNavigateSteps(self
, page
, tab
):
34 # Overriden so that no page navigation occurs - startup to the NTP.
37 def ValidateAndMeasurePage(self
, page
, 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.
53 def __init__(self
, cold
=False):
54 super(StartWithUrl
, self
).__init
__(cold
=cold
,
55 action_name_to_run
='RunNavigateSteps')