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.
8 from measurements import session_restore
9 from measurements import session_restore_with_url
11 from profile_creators import small_profile_creator
12 from telemetry import benchmark
13 from telemetry.page import profile_generator
16 class _SessionRestoreTest(benchmark.Benchmark):
19 def ProcessCommandLineArgs(cls, parser, args):
20 super(_SessionRestoreTest, cls).ProcessCommandLineArgs(parser, args)
21 profile_type = 'small_profile'
22 if not args.browser_options.profile_dir:
23 output_dir = os.path.join(tempfile.gettempdir(), profile_type)
24 profile_dir = os.path.join(output_dir, profile_type)
25 if not os.path.exists(output_dir):
26 os.makedirs(output_dir)
28 # Generate new profiles if profile_dir does not exist. It only exists if
29 # all profiles had been correctly generated in a previous run.
30 if not os.path.exists(profile_dir):
31 new_args = args.Copy()
32 new_args.pageset_repeat = 1
33 new_args.output_dir = output_dir
34 profile_generator.GenerateProfiles(
35 small_profile_creator.SmallProfileCreator, profile_type, new_args)
36 args.browser_options.profile_dir = profile_dir
39 # crbug.com/325479, crbug.com/381990
40 @benchmark.Disabled('android', 'linux', 'reference')
41 class SessionRestoreColdTypical25(_SessionRestoreTest):
43 test = session_restore.SessionRestore
44 page_set = page_sets.Typical25PageSet
45 options = {'cold': True,
49 # crbug.com/325479, crbug.com/381990
50 @benchmark.Disabled('android', 'linux', 'reference')
51 class SessionRestoreWarmTypical25(_SessionRestoreTest):
53 test = session_restore.SessionRestore
54 page_set = page_sets.Typical25PageSet
55 options = {'warm': True,
59 # crbug.com/325479, crbug.com/381990, crbug.com/405386
60 @benchmark.Disabled('android', 'linux', 'reference', 'snowleopard')
61 class SessionRestoreWithUrlCold(_SessionRestoreTest):
62 """Measure Chrome cold session restore with startup URLs."""
64 test = session_restore_with_url.SessionRestoreWithUrl
65 page_set = page_sets.StartupPagesPageSet
66 options = {'cold': True,
70 # crbug.com/325479, crbug.com/381990, crbug.com/405386
71 @benchmark.Disabled('android', 'linux', 'reference', 'snowleopard')
72 class SessionRestoreWithUrlWarm(_SessionRestoreTest):
73 """Measure Chrome warm session restore with startup URLs."""
75 test = session_restore_with_url.SessionRestoreWithUrl
76 page_set = page_sets.StartupPagesPageSet
77 options = {'warm': True,