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 sys | 4 import sys |
5 | 5 |
6 class Failure(Exception): | 6 class Failure(Exception): |
7 """Exception that can be thrown from MultiPageBenchmark to indicate an | 7 """Exception that can be thrown from MultiPageBenchmark to indicate an |
8 undesired but designed-for problem.""" | 8 undesired but designed-for problem.""" |
9 pass | 9 pass |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 self.DidRunAction(page, tab, action) | 103 self.DidRunAction(page, tab, action) |
104 try: | 104 try: |
105 self._test_method(page, tab, results) | 105 self._test_method(page, tab, results) |
106 finally: | 106 finally: |
107 self.options = None | 107 self.options = None |
108 | 108 |
109 def GetAction(self, page): | 109 def GetAction(self, page): |
110 if not self._action_name_to_run: | 110 if not self._action_name_to_run: |
111 return None | 111 return None |
112 action_data = getattr(page, self._action_name_to_run) | 112 action_data = getattr(page, self._action_name_to_run) |
113 from telemetry import all_page_actions | 113 from telemetry.page import all_page_actions |
114 cls = all_page_actions.FindClassWithName(action_data['action']) | 114 cls = all_page_actions.FindClassWithName(action_data['action']) |
115 if not cls: | 115 if not cls: |
116 sys.stderr.write('Could not find action named %s\n' % | 116 sys.stderr.write('Could not find action named %s\n' % |
117 action_data['action']) | 117 action_data['action']) |
118 sys.stderr.write('Check the pageset for a typo and check the error log' + | 118 sys.stderr.write('Check the pageset for a typo and check the error log' + |
119 'for possible python loading/compilation errors\n') | 119 'for possible python loading/compilation errors\n') |
120 raise Exception('%s not found' % action_data['action']) | 120 raise Exception('%s not found' % action_data['action']) |
121 assert cls | 121 assert cls |
122 return cls(action_data) | 122 return cls(action_data) |
123 | 123 |
124 @property | 124 @property |
125 def action_name_to_run(self): | 125 def action_name_to_run(self): |
126 return self._action_name_to_run | 126 return self._action_name_to_run |
OLD | NEW |