OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import logging | 4 import logging |
5 | 5 |
6 from telemetry.core import util | 6 from telemetry.core import util |
7 from telemetry.page import gtest_test_results | 7 from telemetry.page import gtest_test_results |
8 from telemetry.page import page_test_results | 8 from telemetry.page import page_test_results |
9 from telemetry.page.actions import all_page_actions | 9 from telemetry.page.actions import all_page_actions |
10 from telemetry.page.actions import page_action | 10 from telemetry.page.actions import page_action |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 choices=self.output_format_choices, | 140 choices=self.output_format_choices, |
141 help='Output format. Defaults to "%%default". ' | 141 help='Output format. Defaults to "%%default". ' |
142 'Can be %s.' % ', '.join(self.output_format_choices)) | 142 'Can be %s.' % ', '.join(self.output_format_choices)) |
143 | 143 |
144 @property | 144 @property |
145 def output_format_choices(self): | 145 def output_format_choices(self): |
146 """Allowed output formats. The default is the first item in the list.""" | 146 """Allowed output formats. The default is the first item in the list.""" |
147 return ['gtest', 'none'] | 147 return ['gtest', 'none'] |
148 | 148 |
149 def PrepareResults(self, options): | 149 def PrepareResults(self, options): |
| 150 if not hasattr(options, 'output_format'): |
| 151 options.output_format = self.output_format_choices[0] |
| 152 |
150 if options.output_format == 'gtest': | 153 if options.output_format == 'gtest': |
151 return gtest_test_results.GTestTestResults() | 154 return gtest_test_results.GTestTestResults() |
152 elif options.output_format == 'none': | 155 elif options.output_format == 'none': |
153 return page_test_results.PageTestResults() | 156 return page_test_results.PageTestResults() |
154 else: | 157 else: |
155 # Should never be reached. The parser enforces the choices. | 158 # Should never be reached. The parser enforces the choices. |
156 raise Exception('Invalid --output-format "%s". Valid choices are: %s' | 159 raise Exception('Invalid --output-format "%s". Valid choices are: %s' |
157 % (options.output_format, | 160 % (options.output_format, |
158 ', '.join(self.output_format_choices))) | 161 ', '.join(self.output_format_choices))) |
159 | 162 |
(...skipping 24 matching lines...) Expand all Loading... |
184 finally: | 187 finally: |
185 self.DidRunAction(page, tab, action) | 188 self.DidRunAction(page, tab, action) |
186 | 189 |
187 # Closing the connections periodically is needed; otherwise we won't be | 190 # Closing the connections periodically is needed; otherwise we won't be |
188 # able to open enough sockets, and the pages will time out. | 191 # able to open enough sockets, and the pages will time out. |
189 util.CloseConnections(tab) | 192 util.CloseConnections(tab) |
190 | 193 |
191 @property | 194 @property |
192 def action_name_to_run(self): | 195 def action_name_to_run(self): |
193 return self._action_name_to_run | 196 return self._action_name_to_run |
OLD | NEW |