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 return True | |
nednguyen
2016/06/24 14:44:50
This will cause a behavior change to all existing
perezju
2016/06/24 15:12:36
ok, sgtm
| |
130 | |
131 @classmethod | |
116 def AddCommandLineArgs(cls, parser): | 132 def AddCommandLineArgs(cls, parser): |
117 group = optparse.OptionGroup(parser, '%s test options' % cls.Name()) | 133 group = optparse.OptionGroup(parser, '%s test options' % cls.Name()) |
118 cls.AddBenchmarkCommandLineArgs(group) | 134 cls.AddBenchmarkCommandLineArgs(group) |
119 | 135 |
120 if cls.HasTraceRerunDebugOption(): | 136 if cls.HasTraceRerunDebugOption(): |
121 group.add_option( | 137 group.add_option( |
122 '--rerun-with-debug-trace', | 138 '--rerun-with-debug-trace', |
123 action='store_true', | 139 action='store_true', |
124 help='Rerun option that enables more extensive tracing.') | 140 help='Rerun option that enables more extensive tracing.') |
125 | 141 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 raise NotImplementedError('This test has no "page_set" attribute.') | 258 raise NotImplementedError('This test has no "page_set" attribute.') |
243 return self.page_set() # pylint: disable=not-callable | 259 return self.page_set() # pylint: disable=not-callable |
244 | 260 |
245 | 261 |
246 def AddCommandLineArgs(parser): | 262 def AddCommandLineArgs(parser): |
247 story_runner.AddCommandLineArgs(parser) | 263 story_runner.AddCommandLineArgs(parser) |
248 | 264 |
249 | 265 |
250 def ProcessCommandLineArgs(parser, args): | 266 def ProcessCommandLineArgs(parser, args): |
251 story_runner.ProcessCommandLineArgs(parser, args) | 267 story_runner.ProcessCommandLineArgs(parser, args) |
OLD | NEW |