Index: tools/telemetry/telemetry/page/actions/wait.py |
diff --git a/tools/telemetry/telemetry/page/actions/wait.py b/tools/telemetry/telemetry/page/actions/wait.py |
index 4cb8742f267be96fd298c2d7a62128d489acc596..22afba28433125b4fc66a3440ebc534f2a725e06 100644 |
--- a/tools/telemetry/telemetry/page/actions/wait.py |
+++ b/tools/telemetry/telemetry/page/actions/wait.py |
@@ -14,36 +14,19 @@ class WaitAction(page_action.PageAction): |
super(WaitAction, self).__init__(attributes) |
self._SetTimelineMarkerBaseName('WaitAction::RunAction') |
- def RunsPreviousAction(self): |
+ def _RunsPreviousAction(self): |
return (getattr(self, 'condition', None) == 'navigate' or |
getattr(self, 'condition', None) == 'href_change') |
- def RunAction(self, page, tab, previous_action): |
+ def RunAction(self, page, tab): |
+ assert not self._RunsPreviousAction(), \ |
+ ('"navigate" and "href_change" support for wait is deprecated, use ' |
+ 'wait_until instead') |
tab.ExecuteJavaScript( |
'console.time("' + self._GetUniqueTimelineMarkerName() + '")') |
if hasattr(self, 'seconds'): |
time.sleep(self.seconds) |
- |
- elif getattr(self, 'condition', None) == 'navigate': |
- if not previous_action: |
- raise page_action.PageActionFailed('You need to perform an action ' |
- 'before waiting for navigate.') |
- previous_action.WillRunAction(page, tab) |
- action_to_perform = lambda: previous_action.RunAction(page, tab, None) |
- tab.PerformActionAndWaitForNavigate(action_to_perform, self.timeout) |
- tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() |
- |
- elif getattr(self, 'condition', None) == 'href_change': |
- if not previous_action: |
- raise page_action.PageActionFailed('You need to perform an action ' |
- 'before waiting for a href change.') |
- previous_action.WillRunAction(page, tab) |
- old_url = tab.EvaluateJavaScript('document.location.href') |
- previous_action.RunAction(page, tab, None) |
- tab.WaitForJavaScriptExpression( |
- 'document.location.href != "%s"' % old_url, self.timeout) |
- |
elif getattr(self, 'condition', None) == 'element': |
if hasattr(self, 'text'): |
callback_code = 'function(element) { return element != null; }' |