| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 import tempfile | 8 import tempfile |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 def _CompoundActionsForPage(self, page): | 53 def _CompoundActionsForPage(self, page): |
| 54 actions = [] | 54 actions = [] |
| 55 for action_name in self._action_names: | 55 for action_name in self._action_names: |
| 56 if not hasattr(page, action_name): | 56 if not hasattr(page, action_name): |
| 57 continue | 57 continue |
| 58 actions.append(page_test.GetCompoundActionFromPage(page, action_name)) | 58 actions.append(page_test.GetCompoundActionFromPage(page, action_name)) |
| 59 return actions | 59 return actions |
| 60 | 60 |
| 61 | 61 |
| 62 def Main(measurement_dir): | 62 def Main(base_dir): |
| 63 measurements = discover.DiscoverClasses(measurement_dir, | 63 measurements = discover.DiscoverClasses(base_dir, base_dir, |
| 64 os.path.join(measurement_dir, '..'), | 64 page_measurement.PageMeasurement) |
| 65 page_measurement.PageMeasurement) | |
| 66 options = browser_options.BrowserOptions() | 65 options = browser_options.BrowserOptions() |
| 67 parser = options.CreateParser('%prog <page_set>') | 66 parser = options.CreateParser('%prog <page_set>') |
| 68 page_runner.AddCommandLineOptions(parser) | 67 page_runner.AddCommandLineOptions(parser) |
| 69 | 68 |
| 70 recorder = RecordPage(measurements) | 69 recorder = RecordPage(measurements) |
| 71 recorder.AddCommandLineOptions(parser) | 70 recorder.AddCommandLineOptions(parser) |
| 72 recorder.AddOutputOptions(parser) | 71 recorder.AddOutputOptions(parser) |
| 73 | 72 |
| 74 _, args = parser.parse_args() | 73 _, args = parser.parse_args() |
| 75 | 74 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 91 | 90 |
| 92 if results.errors or results.failures: | 91 if results.errors or results.failures: |
| 93 logging.warning('Some pages failed. The recording has not been updated for ' | 92 logging.warning('Some pages failed. The recording has not been updated for ' |
| 94 'these pages.') | 93 'these pages.') |
| 95 logging.warning('Failed pages:\n%s', | 94 logging.warning('Failed pages:\n%s', |
| 96 '\n'.join(zip(*results.errors + results.failures)[0])) | 95 '\n'.join(zip(*results.errors + results.failures)[0])) |
| 97 | 96 |
| 98 if results.skipped: | 97 if results.skipped: |
| 99 logging.warning('Some pages were skipped. The recording has not been ' | 98 logging.warning('Some pages were skipped. The recording has not been ' |
| 100 'updated for these pages.') | 99 'updated for these pages.') |
| 101 logging.warning('Skipped pages:\n%s', '\n'.join(results.skipped)) | 100 logging.warning('Skipped pages:\n%s', '\n'.join(zip(*results.skipped)[0])) |
| 102 | 101 |
| 103 if results.successes: | 102 if results.successes: |
| 104 # Update the metadata for the pages which were recorded. | 103 # Update the metadata for the pages which were recorded. |
| 105 ps.wpr_archive_info.AddRecordedPages(results.successes) | 104 ps.wpr_archive_info.AddRecordedPages(results.successes) |
| 106 else: | 105 else: |
| 107 os.remove(temp_target_wpr_file_path) | 106 os.remove(temp_target_wpr_file_path) |
| 108 | 107 |
| 109 return min(255, len(results.failures)) | 108 return min(255, len(results.failures)) |
| OLD | NEW |