Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1214)

Unified Diff: tools/telemetry/telemetry/page/actions/wait.py

Issue 186593007: Remove href_change and navigate from wait action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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; }'
« no previous file with comments | « tools/telemetry/telemetry/page/actions/tap.py ('k') | tools/telemetry/telemetry/page/actions/wait_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698