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