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

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

Issue 346923003: Add ActionRunner wrapper for the remaining less used actions (try 2): (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update unit test to skip test if touch is not supported. Created 6 years, 5 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/repaint_continuously.py
diff --git a/tools/telemetry/telemetry/page/actions/repaint_continuously.py b/tools/telemetry/telemetry/page/actions/repaint_continuously.py
index 646907ef32807529611acef083b1c3d9a9330805..da5c4bfdfc0645d313c1d1555fec11466d7b32f0 100644
--- a/tools/telemetry/telemetry/page/actions/repaint_continuously.py
+++ b/tools/telemetry/telemetry/page/actions/repaint_continuously.py
@@ -11,11 +11,11 @@ class RepaintContinuouslyAction(page_action.PageAction):
until self.seconds have elapsed AND at least three RAFs have been fired. Times
out after max(60, self.seconds), if less than three RAFs were fired.
"""
- def __init__(self, attributes=None):
- super(RepaintContinuouslyAction, self).__init__(attributes)
+ def __init__(self, seconds):
+ super(RepaintContinuouslyAction, self).__init__()
+ self._seconds = seconds
def RunAction(self, tab):
- assert(hasattr(self, 'seconds'))
start_time = time.time()
tab.ExecuteJavaScript(
'window.__rafCount = 0;'
@@ -25,16 +25,17 @@ class RepaintContinuouslyAction(page_action.PageAction):
'};'
'window.webkitRequestAnimationFrame(window.__rafFunction);')
- time_out = max(60, self.seconds)
+ time_out = max(60, self._seconds)
min_rafs = 3
- # Wait until al leat self.seconds have elapsed AND min_rafs have been fired.
- # Use a hard time-out after 60 seconds (or self.seconds).
+ # Wait until at least self.seconds have elapsed AND min_rafs have
+ # been fired. Use a hard time-out after 60 seconds (or
+ # self.seconds).
while True:
raf_count = tab.EvaluateJavaScript('window.__rafCount;')
elapsed_time = time.time() - start_time
if elapsed_time > time_out:
break
- elif elapsed_time > self.seconds and raf_count > min_rafs:
+ elif elapsed_time > self._seconds and raf_count > min_rafs:
break
time.sleep(1)
« no previous file with comments | « tools/telemetry/telemetry/page/actions/reload.py ('k') | tools/telemetry/telemetry/page/actions/scroll_bounce.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698