OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 optparse | 5 import optparse |
6 | 6 |
7 from telemetry import decorators | 7 from telemetry import decorators |
8 from telemetry.internal import story_runner | 8 from telemetry.internal import story_runner |
9 from telemetry.internal.util import command_line | 9 from telemetry.internal.util import command_line |
10 from telemetry.page import legacy_page_test | 10 from telemetry.page import legacy_page_test |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 @property | 93 @property |
94 def max_failures(self): | 94 def max_failures(self): |
95 return self._max_failures | 95 return self._max_failures |
96 | 96 |
97 @classmethod | 97 @classmethod |
98 def Name(cls): | 98 def Name(cls): |
99 return '%s.%s' % (cls.__module__.split('.')[-1], cls.__name__) | 99 return '%s.%s' % (cls.__module__.split('.')[-1], cls.__name__) |
100 | 100 |
101 @classmethod | 101 @classmethod |
102 def ShouldTearDownStateAfterEachStoryRun(cls): | 102 def ShouldTearDownStateAfterEachStoryRun(cls): |
103 """Override this method to tear down state after each story run. | 103 """Override to specify whether to tear down state after each story run. |
104 | 104 |
105 Tearing down all states after each story run, e.g., clearing profiles, | 105 Tearing down all states after each story run, e.g., clearing profiles, |
106 stopping the browser, stopping local server, etc. So the browser will not be | 106 stopping the browser, stopping local server, etc. So the browser will not be |
107 reused among multiple stories. This is particularly useful to get the | 107 reused among multiple stories. This is particularly useful to get the |
108 startup part of launching the browser in each story. | 108 startup part of launching the browser in each story. |
109 | 109 |
110 This should only be used by TimelineBasedMeasurement (TBM) benchmarks, but | 110 This should only be used by TimelineBasedMeasurement (TBM) benchmarks, but |
111 not by PageTest based benchmarks. | 111 not by PageTest based benchmarks. |
112 """ | 112 """ |
113 return False | 113 return False |
114 | 114 |
115 @classmethod | 115 @classmethod |
116 def ShouldTearDownStateAfterEachStorySetRun(cls): | |
117 """Override to specify whether to tear down state after each story set run. | |
118 | |
119 Defaults to True in order to reset the state and make individual story set | |
120 repeats more independent of each other. The intended effect is to average | |
121 out noise in measurements between repeats. | |
122 | |
123 Long running benchmarks willing to stess test the browser and have it run | |
124 for long periods of time may switch this value to False. | |
125 | |
126 This should only be used by TimelineBasedMeasurement (TBM) benchmarks, but | |
127 not by PageTest based benchmarks. | |
128 """ | |
129 # TODO(perezju): Switch default value after any benchmarks requiring the | |
130 # old behaviour are updated accordingly. | |
131 # https://github.com/catapult-project/catapult/issues/2294#issuecomment-2283 06977 | |
nednguyen
2016/06/24 16:11:55
this may cause a lint check failure. Feel free to
| |
132 return False | |
133 | |
134 @classmethod | |
116 def AddCommandLineArgs(cls, parser): | 135 def AddCommandLineArgs(cls, parser): |
117 group = optparse.OptionGroup(parser, '%s test options' % cls.Name()) | 136 group = optparse.OptionGroup(parser, '%s test options' % cls.Name()) |
118 cls.AddBenchmarkCommandLineArgs(group) | 137 cls.AddBenchmarkCommandLineArgs(group) |
119 | 138 |
120 if cls.HasTraceRerunDebugOption(): | 139 if cls.HasTraceRerunDebugOption(): |
121 group.add_option( | 140 group.add_option( |
122 '--rerun-with-debug-trace', | 141 '--rerun-with-debug-trace', |
123 action='store_true', | 142 action='store_true', |
124 help='Rerun option that enables more extensive tracing.') | 143 help='Rerun option that enables more extensive tracing.') |
125 | 144 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 raise NotImplementedError('This test has no "page_set" attribute.') | 261 raise NotImplementedError('This test has no "page_set" attribute.') |
243 return self.page_set() # pylint: disable=not-callable | 262 return self.page_set() # pylint: disable=not-callable |
244 | 263 |
245 | 264 |
246 def AddCommandLineArgs(parser): | 265 def AddCommandLineArgs(parser): |
247 story_runner.AddCommandLineArgs(parser) | 266 story_runner.AddCommandLineArgs(parser) |
248 | 267 |
249 | 268 |
250 def ProcessCommandLineArgs(parser, args): | 269 def ProcessCommandLineArgs(parser, args): |
251 story_runner.ProcessCommandLineArgs(parser, args) | 270 story_runner.ProcessCommandLineArgs(parser, args) |
OLD | NEW |