summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2018-11-04 13:13:23 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2018-11-04 13:13:23 +0000
commiteb87192ddcaaed47dd54f95716674502862b3a1d (patch)
tree0c425879c25e8694684768f15070123d34bbb085
parente12e50efaaa2944a7291c4b021aa2891ef80af17 (diff)
downloadnetsurf-eb87192ddcaaed47dd54f95716674502862b3a1d.tar.gz
netsurf-eb87192ddcaaed47dd54f95716674502862b3a1d.tar.bz2
Test: Monkey driver: Split out conds_met function.
-rwxr-xr-xtest/monkey-driver.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/monkey-driver.py b/test/monkey-driver.py
index dc8e19061..4b8da8254 100755
--- a/test/monkey-driver.py
+++ b/test/monkey-driver.py
@@ -52,7 +52,22 @@ def print_test_plan_info(ctx, plan):
def assert_browser(ctx):
assert(ctx['browser'].started)
assert(not ctx['browser'].stopped)
-
+
+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.throbbing:
+ return False
+ else:
+ win = ctx['windows'][window]
+ if win.throbbing:
+ return False
+ return True
+
def run_test_step_action_launch(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
assert(ctx.get('browser') is None)
@@ -95,23 +110,8 @@ def run_test_step_action_block(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
conds = step['conditions']
assert_browser(ctx)
-
- def conds_met():
- 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.throbbing:
- return False
- else:
- win = ctx['windows'][window]
- if win.throbbing:
- return False
- return True
- while not conds_met():
+ while not conds_met(ctx, conds):
ctx['browser'].farmer.loop(once=True)
def run_test_step_action_repeat(ctx, step):