Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/d676c7e5b6166d49497aae851eea84037f94b412
...commit
http://git.netsurf-browser.org/netsurf.git/commit/d676c7e5b6166d49497aae851eea84037f94b412
...tree
http://git.netsurf-browser.org/netsurf.git/tree/d676c7e5b6166d49497aae851eea84037f94b412
The branch, master has been updated
via d676c7e5b6166d49497aae851eea84037f94b412 (commit)
via eb87192ddcaaed47dd54f95716674502862b3a1d (commit)
via e12e50efaaa2944a7291c4b021aa2891ef80af17 (commit)
from a2ffbdfd1c7948d341a316d153896cfc772955ce (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=d676c7e5b6166d49497aae851eea84037f94b412
commit d676c7e5b6166d49497aae851eea84037f94b412
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Test: Monkey driver: Implement sleep-ms and repeat actions.
diff --git a/test/monkey-driver.py b/test/monkey-driver.py
index 4b8da82..226c028 100755
--- a/test/monkey-driver.py
+++ b/test/monkey-driver.py
@@ -105,6 +105,32 @@ def run_test_step_action_navigate(ctx, step):
def run_test_step_action_sleep_ms(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
+ conds = step['conditions']
+ sleep_time = step['time']
+ sleep = 0
+ have_repeat = False
+ if isinstance(sleep_time, str):
+ assert(ctx['repeats'].get(sleep_time) is not None)
+ repeat = ctx['repeats'].get(sleep_time)
+ sleep = repeat["i"] / 1000
+ start = repeat["start"]
+ have_repeat = True
+ else:
+ sleep = time / 1000
+ start = time.time()
+
+ while True:
+ slept = time.time() - start
+ if conds_met(ctx, conds):
+ if have_repeat:
+ ctx['repeats'][sleep_time]["loop"] = False
+ print(get_indent(ctx) + " Condition met after
{}s".format(slept))
+ break
+ elif slept > sleep:
+ print(get_indent(ctx) + " Condition not met after
{}s".format(sleep))
+ break
+ else:
+ ctx['browser'].farmer.loop(once=True)
def run_test_step_action_block(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
@@ -116,10 +142,20 @@ def run_test_step_action_block(ctx, step):
def run_test_step_action_repeat(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
- ctx["depth"] += 1
- for step in step["steps"]:
- run_test_step(ctx, step)
- ctx["depth"] -= 1
+ tag = step['tag']
+ assert(ctx['repeats'].get(tag) is None)
+ ctx['repeats'][tag] = {
+ "i": step["min"],
+ "step": step["step"],
+ "loop": True,
+ }
+ while ctx['repeats'][tag]["loop"]:
+ ctx['repeats'][tag]["start"] = time.time()
+ ctx["depth"] += 1
+ for s in step["steps"]:
+ run_test_step(ctx, s)
+ ctx['repeats'][tag]["i"] += ctx['repeats'][tag]["step"]
+ ctx["depth"] -= 1
def run_test_step_action_plot_check(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
@@ -204,6 +240,7 @@ def run_test_step(ctx, step):
def walk_test_plan(ctx, plan):
ctx["depth"] = 0
ctx["timers"] = dict()
+ ctx['repeats'] = dict()
for step in plan["steps"]:
run_test_step(ctx, step)
diff --git a/test/monkey-tests/quit-mid-fetch.yaml
b/test/monkey-tests/quit-mid-fetch.yaml
index b033f67..cffdae3 100644
--- a/test/monkey-tests/quit-mid-fetch.yaml
+++ b/test/monkey-tests/quit-mid-fetch.yaml
@@ -4,7 +4,7 @@ steps:
- action: repeat
min: 0
step: 50
- name: sleepytimer
+ tag: sleepytimer
steps:
- action: launch
- action: window-new
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=eb87192ddcaaed47dd54f95716674502862b3a1d
commit eb87192ddcaaed47dd54f95716674502862b3a1d
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Test: Monkey driver: Split out conds_met function.
diff --git a/test/monkey-driver.py b/test/monkey-driver.py
index dc8e190..4b8da82 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):
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=e12e50efaaa2944a7291c4b021aa2891ef80af17
commit e12e50efaaa2944a7291c4b021aa2891ef80af17
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Test: Monkey driver: Timers can live outside launches.
diff --git a/test/monkey-driver.py b/test/monkey-driver.py
index 610c3fc..dc8e190 100755
--- a/test/monkey-driver.py
+++ b/test/monkey-driver.py
@@ -60,7 +60,6 @@ def run_test_step_action_launch(ctx, step):
ctx['browser'] = Browser(monkey_cmd=[ctx["monkey"]], quiet=True)
assert_browser(ctx)
ctx['windows'] = dict()
- ctx['timers'] = dict()
def run_test_step_action_window_new(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
@@ -182,7 +181,6 @@ def run_test_step_action_quit(ctx, step):
assert_browser(ctx)
browser = ctx.pop('browser')
windows = ctx.pop('windows')
- timers = ctx.pop('timers')
assert(browser.quit_and_wait())
step_handlers = {
@@ -205,6 +203,7 @@ def run_test_step(ctx, step):
def walk_test_plan(ctx, plan):
ctx["depth"] = 0
+ ctx["timers"] = dict()
for step in plan["steps"]:
run_test_step(ctx, step)
-----------------------------------------------------------------------
Summary of changes:
test/monkey-driver.py | 82 ++++++++++++++++++++++++---------
test/monkey-tests/quit-mid-fetch.yaml | 2 +-
2 files changed, 60 insertions(+), 24 deletions(-)
diff --git a/test/monkey-driver.py b/test/monkey-driver.py
index 610c3fc..226c028 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)
@@ -60,7 +75,6 @@ def run_test_step_action_launch(ctx, step):
ctx['browser'] = Browser(monkey_cmd=[ctx["monkey"]], quiet=True)
assert_browser(ctx)
ctx['windows'] = dict()
- ctx['timers'] = dict()
def run_test_step_action_window_new(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
@@ -91,36 +105,57 @@ def run_test_step_action_navigate(ctx, step):
def run_test_step_action_sleep_ms(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
+ conds = step['conditions']
+ sleep_time = step['time']
+ sleep = 0
+ have_repeat = False
+ if isinstance(sleep_time, str):
+ assert(ctx['repeats'].get(sleep_time) is not None)
+ repeat = ctx['repeats'].get(sleep_time)
+ sleep = repeat["i"] / 1000
+ start = repeat["start"]
+ have_repeat = True
+ else:
+ sleep = time / 1000
+ start = time.time()
+
+ while True:
+ slept = time.time() - start
+ if conds_met(ctx, conds):
+ if have_repeat:
+ ctx['repeats'][sleep_time]["loop"] = False
+ print(get_indent(ctx) + " Condition met after
{}s".format(slept))
+ break
+ elif slept > sleep:
+ print(get_indent(ctx) + " Condition not met after
{}s".format(sleep))
+ break
+ else:
+ ctx['browser'].farmer.loop(once=True)
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):
print(get_indent(ctx) + "Action: " + step["action"])
- ctx["depth"] += 1
- for step in step["steps"]:
- run_test_step(ctx, step)
- ctx["depth"] -= 1
+ tag = step['tag']
+ assert(ctx['repeats'].get(tag) is None)
+ ctx['repeats'][tag] = {
+ "i": step["min"],
+ "step": step["step"],
+ "loop": True,
+ }
+ while ctx['repeats'][tag]["loop"]:
+ ctx['repeats'][tag]["start"] = time.time()
+ ctx["depth"] += 1
+ for s in step["steps"]:
+ run_test_step(ctx, s)
+ ctx['repeats'][tag]["i"] += ctx['repeats'][tag]["step"]
+ ctx["depth"] -= 1
def run_test_step_action_plot_check(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
@@ -182,7 +217,6 @@ def run_test_step_action_quit(ctx, step):
assert_browser(ctx)
browser = ctx.pop('browser')
windows = ctx.pop('windows')
- timers = ctx.pop('timers')
assert(browser.quit_and_wait())
step_handlers = {
@@ -205,6 +239,8 @@ def run_test_step(ctx, step):
def walk_test_plan(ctx, plan):
ctx["depth"] = 0
+ ctx["timers"] = dict()
+ ctx['repeats'] = dict()
for step in plan["steps"]:
run_test_step(ctx, step)
diff --git a/test/monkey-tests/quit-mid-fetch.yaml
b/test/monkey-tests/quit-mid-fetch.yaml
index b033f67..cffdae3 100644
--- a/test/monkey-tests/quit-mid-fetch.yaml
+++ b/test/monkey-tests/quit-mid-fetch.yaml
@@ -4,7 +4,7 @@ steps:
- action: repeat
min: 0
step: 50
- name: sleepytimer
+ tag: sleepytimer
steps:
- action: launch
- action: window-new
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org