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 profile_creators import small_profile_creator |
6 from telemetry import test | 10 from telemetry import test |
| 11 from telemetry.page import profile_generator |
| 12 |
| 13 |
| 14 class _SessionRestoreTest(test.Test): |
| 15 |
| 16 @classmethod |
| 17 def ProcessCommandLineArgs(cls, parser, args): |
| 18 super(_SessionRestoreTest, cls).ProcessCommandLineArgs(parser, args) |
| 19 |
| 20 profile_type = 'small_profile' |
| 21 |
| 22 if not args.browser_options.profile_dir: |
| 23 profile_dir = os.path.join(tempfile.gettempdir(), profile_type) |
| 24 args.browser_options.profile_dir = profile_dir |
| 25 |
| 26 if not os.path.exists(profile_dir): |
| 27 os.makedirs(profile_dir) |
| 28 args = args.Copy() |
| 29 args.pageset_repeat = 1 |
| 30 args.output_dir = tempfile.gettempdir() |
| 31 profile_generator.GenerateProfiles( |
| 32 small_profile_creator.SmallProfileCreator, profile_type, args) |
7 | 33 |
8 | 34 |
9 # crbug.com/325479: Disabling this test for now since it never ran before. | 35 # crbug.com/325479: Disabling this test for now since it never ran before. |
10 @test.Disabled('android', 'linux') | 36 @test.Disabled('android', 'linux') |
11 class SessionRestoreColdTypical25(test.Test): | 37 class SessionRestoreColdTypical25(_SessionRestoreTest): |
12 tag = 'cold' | 38 tag = 'cold' |
13 test = session_restore.SessionRestore | 39 test = session_restore.SessionRestore |
14 page_set = 'page_sets/typical_25.py' | 40 page_set = 'page_sets/typical_25.py' |
15 options = {'cold': True, | 41 options = {'cold': True, |
16 'pageset_repeat': 5} | 42 'pageset_repeat': 5} |
17 | 43 |
18 | 44 |
19 class SessionRestoreWarmTypical25(test.Test): | 45 class SessionRestoreWarmTypical25(_SessionRestoreTest): |
20 tag = 'warm' | 46 tag = 'warm' |
21 test = session_restore.SessionRestore | 47 test = session_restore.SessionRestore |
22 page_set = 'page_sets/typical_25.py' | 48 page_set = 'page_sets/typical_25.py' |
23 options = {'warm': True, | 49 options = {'warm': True, |
24 'pageset_repeat': 20} | 50 'pageset_repeat': 20} |
OLD | NEW |