Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/ea9bc4e2bef98278e4df2b84666c6419d74d2f52
...commit
http://git.netsurf-browser.org/netsurf.git/commit/ea9bc4e2bef98278e4df2b84666c6419d74d2f52
...tree
http://git.netsurf-browser.org/netsurf.git/tree/ea9bc4e2bef98278e4df2b84666c6419d74d2f52
The branch, master has been updated
via ea9bc4e2bef98278e4df2b84666c6419d74d2f52 (commit)
from cb178b43bebd3217325fcd4de7ee6826ff48e002 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=ea9bc4e2bef98278e4df2b84666c6419d74d2f52
commit ea9bc4e2bef98278e4df2b84666c6419d74d2f52
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
allow block to use elapsed timer as a condition
diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index 61286ff..0cac260 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -108,17 +108,28 @@ def assert_browser(ctx):
def conds_met(ctx, conds):
for cond in conds:
- status = cond['status']
- window = cond['window']
- assert(status == "complete") # TODO: Add more status support?
- if window == "*all*":
- for win in ctx['windows'].items():
- if win[1].throbbing:
+ if 'window' in cond.keys():
+ status = cond['status']
+ window = cond['window']
+ assert(status == "complete") # TODO: Add more status support?
+ if window == "*all*":
+ for win in ctx['windows'].items():
+ if win[1].throbbing:
+ return False
+ else:
+ win = ctx['windows'][window]
+ if win.throbbing:
return False
+ elif 'timer' in cond.keys():
+ timer = cond['timer']
+ elapsed = cond['elapsed']
+ assert_browser(ctx)
+ assert(ctx['timers'].get(timer) is not None)
+ taken = time.time() - ctx['timers'][timer]["start"]
+ assert(taken < elapsed)
else:
- win = ctx['windows'][window]
- if win.throbbing:
- return False
+ raise AssertionError("Unknown condition: {}".format(repr(cond)))
+
return True
def run_test_step_action_launch(ctx, step):
@@ -249,6 +260,13 @@ def run_test_step_action_timer_start(ctx, step):
ctx['timers'][tag] = {}
ctx['timers'][tag]["start"] = time.time()
+def run_test_step_action_timer_restart(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+ timer = step['timer']
+ assert_browser(ctx)
+ assert(ctx['timers'].get(timer) is not None)
+ ctx['timers'][timer]["start"] = time.time()
+
def run_test_step_action_timer_stop(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
timer = step['timer']
@@ -344,6 +362,7 @@ step_handlers = {
"block": run_test_step_action_block,
"repeat": run_test_step_action_repeat,
"timer-start": run_test_step_action_timer_start,
+ "timer-restart":run_test_step_action_timer_restart,
"timer-stop": run_test_step_action_timer_stop,
"timer-check": run_test_step_action_timer_check,
"plot-check": run_test_step_action_plot_check,
-----------------------------------------------------------------------
Summary of changes:
test/monkey_driver.py | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index 61286ff..0cac260 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -108,17 +108,28 @@ def assert_browser(ctx):
def conds_met(ctx, conds):
for cond in conds:
- status = cond['status']
- window = cond['window']
- assert(status == "complete") # TODO: Add more status support?
- if window == "*all*":
- for win in ctx['windows'].items():
- if win[1].throbbing:
+ if 'window' in cond.keys():
+ status = cond['status']
+ window = cond['window']
+ assert(status == "complete") # TODO: Add more status support?
+ if window == "*all*":
+ for win in ctx['windows'].items():
+ if win[1].throbbing:
+ return False
+ else:
+ win = ctx['windows'][window]
+ if win.throbbing:
return False
+ elif 'timer' in cond.keys():
+ timer = cond['timer']
+ elapsed = cond['elapsed']
+ assert_browser(ctx)
+ assert(ctx['timers'].get(timer) is not None)
+ taken = time.time() - ctx['timers'][timer]["start"]
+ assert(taken < elapsed)
else:
- win = ctx['windows'][window]
- if win.throbbing:
- return False
+ raise AssertionError("Unknown condition: {}".format(repr(cond)))
+
return True
def run_test_step_action_launch(ctx, step):
@@ -249,6 +260,13 @@ def run_test_step_action_timer_start(ctx, step):
ctx['timers'][tag] = {}
ctx['timers'][tag]["start"] = time.time()
+def run_test_step_action_timer_restart(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+ timer = step['timer']
+ assert_browser(ctx)
+ assert(ctx['timers'].get(timer) is not None)
+ ctx['timers'][timer]["start"] = time.time()
+
def run_test_step_action_timer_stop(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
timer = step['timer']
@@ -344,6 +362,7 @@ step_handlers = {
"block": run_test_step_action_block,
"repeat": run_test_step_action_repeat,
"timer-start": run_test_step_action_timer_start,
+ "timer-restart":run_test_step_action_timer_restart,
"timer-stop": run_test_step_action_timer_stop,
"timer-check": run_test_step_action_timer_check,
"plot-check": run_test_step_action_plot_check,
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org