| 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 time | 4 import time |
| 5 | 5 |
| 6 from telemetry import page_action | 6 from telemetry import page_action |
| 7 from telemetry import util | 7 from telemetry import util |
| 8 | 8 |
| 9 class WaitAction(page_action.PageAction): | 9 class WaitAction(page_action.PageAction): |
| 10 DEFAULT_TIMEOUT = 60 | 10 DEFAULT_TIMEOUT = 60 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 tab, self.text, callback_code), self.DEFAULT_TIMEOUT) | 50 tab, self.text, callback_code), self.DEFAULT_TIMEOUT) |
| 51 elif self.selector: | 51 elif self.selector: |
| 52 util.WaitFor(lambda: tab.EvaluateJavaScript( | 52 util.WaitFor(lambda: tab.EvaluateJavaScript( |
| 53 'document.querySelector("%s") != null' % self.selector), | 53 'document.querySelector("%s") != null' % self.selector), |
| 54 self.DEFAULT_TIMEOUT) | 54 self.DEFAULT_TIMEOUT) |
| 55 | 55 |
| 56 elif self.condition == 'javascript': | 56 elif self.condition == 'javascript': |
| 57 assert hasattr(self, 'javascript') | 57 assert hasattr(self, 'javascript') |
| 58 util.WaitFor(lambda: tab.EvaluateJavaScript(self.javascript), | 58 util.WaitFor(lambda: tab.EvaluateJavaScript(self.javascript), |
| 59 self.DEFAULT_TIMEOUT) | 59 self.DEFAULT_TIMEOUT) |
| OLD | NEW |