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 import os |
| 6 import tempfile |
| 7 |
5 from measurements import session_restore | 8 from measurements import session_restore |
| 9 from measurements import session_restore_with_url |
| 10 from profile_creators import small_profile_creator |
6 from telemetry import test | 11 from telemetry import test |
| 12 from telemetry.page import profile_generator |
| 13 |
| 14 |
| 15 class _SessionRestoreTest(test.Test): |
| 16 |
| 17 @classmethod |
| 18 def ProcessCommandLineArgs(cls, parser, args): |
| 19 super(_SessionRestoreTest, cls).ProcessCommandLineArgs(parser, args) |
| 20 profile_type = 'small_profile' |
| 21 if not args.browser_options.profile_dir: |
| 22 profile_dir = os.path.join(tempfile.gettempdir(), profile_type) |
| 23 if not os.path.exists(profile_dir): |
| 24 new_args = args.Copy() |
| 25 new_args.pageset_repeat = 1 |
| 26 new_args.output_dir = profile_dir |
| 27 profile_generator.GenerateProfiles( |
| 28 small_profile_creator.SmallProfileCreator, profile_type, new_args) |
| 29 args.browser_options.profile_dir = os.path.join(profile_dir, profile_type) |
7 | 30 |
8 | 31 |
9 @test.Disabled('android') # crbug.com/325479 | 32 @test.Disabled('android') # crbug.com/325479 |
10 class SessionRestoreColdTypical25(test.Test): | 33 class SessionRestoreColdTypical25(_SessionRestoreTest): |
11 tag = 'cold' | 34 tag = 'cold' |
12 test = session_restore.SessionRestore | 35 test = session_restore.SessionRestore |
13 page_set = 'page_sets/typical_25.py' | 36 page_set = 'page_sets/typical_25.py' |
14 options = {'cold': True, | 37 options = {'cold': True, |
15 'pageset_repeat': 5} | 38 'pageset_repeat': 5} |
16 | 39 |
17 | 40 |
18 class SessionRestoreWarmTypical25(test.Test): | 41 class SessionRestoreWarmTypical25(_SessionRestoreTest): |
19 tag = 'warm' | 42 tag = 'warm' |
20 test = session_restore.SessionRestore | 43 test = session_restore.SessionRestore |
21 page_set = 'page_sets/typical_25.py' | 44 page_set = 'page_sets/typical_25.py' |
22 options = {'warm': True, | 45 options = {'warm': True, |
23 'pageset_repeat': 20} | 46 'pageset_repeat': 20} |
| 47 |
| 48 |
| 49 class SessionRestoreWithUrlCold(_SessionRestoreTest): |
| 50 """Measure Chrome cold session restore with startup URLs.""" |
| 51 tag = 'cold' |
| 52 test = session_restore_with_url.SessionRestoreWithUrl |
| 53 page_set = 'page_sets/startup_pages.py' |
| 54 options = {'cold': True, |
| 55 'pageset_repeat': 5} |
| 56 |
| 57 |
| 58 class SessionRestoreWithUrlWarm(_SessionRestoreTest): |
| 59 """Measure Chrome warm session restore with startup URLs.""" |
| 60 tag = 'warm' |
| 61 test = session_restore_with_url.SessionRestoreWithUrl |
| 62 page_set = 'page_sets/startup_pages.py' |
| 63 options = {'warm': True, |
| 64 'pageset_repeat': 10} |
OLD | NEW |