Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/c74c8332acc3e323565281f3f2774bf088a6a882
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/c74c8332acc3e323565281f3f2774bf088a6a882
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/c74c8332acc3e323565281f3f2774bf088a6a882

The branch, master has been updated
       via  c74c8332acc3e323565281f3f2774bf088a6a882 (commit)
       via  eeeca4b712cd99290348a37f143535c3c33fb116 (commit)
       via  4be18fcf473b5bff57daa1b57e3de961134a546a (commit)
       via  f2000ae60efaf8f296dd4e2719417224cd99ac59 (commit)
      from  64ee8e1b00438ea87ba10ea6dd34e6d3000c28ce (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=c74c8332acc3e323565281f3f2774bf088a6a882
commit c74c8332acc3e323565281f3f2774bf088a6a882
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    allow monkey tests to stop navigation

diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index 3057094..16f286a 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -235,6 +235,14 @@ def run_test_step_action_navigate(ctx, step):
     assert(win is not None)
     win.go(step['url'])
 
+def run_test_step_action_stop(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+    assert_browser(ctx)
+    tag = step['window']
+    win = ctx['windows'].get(tag)
+    assert(win is not None)
+    win.stop()
+
 def run_test_step_action_sleep_ms(ctx, step):
     print(get_indent(ctx) + "Action: " + step["action"])
     conds = step['conditions']
@@ -438,6 +446,7 @@ step_handlers = {
     "window-new":   run_test_step_action_window_new,
     "window-close": run_test_step_action_window_close,
     "navigate":     run_test_step_action_navigate,
+    "stop":         run_test_step_action_stop,
     "sleep-ms":     run_test_step_action_sleep_ms,
     "block":        run_test_step_action_block,
     "repeat":       run_test_step_action_repeat,
diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py
index 539fab5..08465f8 100644
--- a/test/monkeyfarmer.py
+++ b/test/monkeyfarmer.py
@@ -359,6 +359,9 @@ class BrowserWindow:
                 self.winid, url, referer))
         self.wait_start_loading()
 
+    def stop(self):
+        self.browser.farmer.tell_monkey("WINDOW STOP %s" % (self.winid))
+
     def reload(self):
         self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
 


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=eeeca4b712cd99290348a37f143535c3c33fb116
commit eeeca4b712cd99290348a37f143535c3c33fb116
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    add ability to stop a navigation in monkey frontend

diff --git a/docs/using-monkey.md b/docs/using-monkey.md
index 5e543d6..f4fff43 100644
--- a/docs/using-monkey.md
+++ b/docs/using-monkey.md
@@ -112,6 +112,11 @@ Commands
     Cause the given browser window to visit the given URL.
     Optionally you can give a referrer URL to also use (simulating
     a click in the browser on a link).
+    Minimally you can expect throbber stop response.
+
+*   `WINDOW STOP` _%id%_
+
+    Cause a browser window to stop any in progress navigatoipn.
     Minimally you can expect throbber, url etc responses.
 
 *   `WINDOW REDRAW` _%id%_ [_%num% %num% %num% %num%_]
@@ -125,7 +130,7 @@ Commands
     Minimally you can expect redraw start/stop messages and you
     can likely expect some number of `PLOT` results.
 
-*   `WINDOW RELOAD` _%id%_
+*   `WINDOW RELOAD` _%id%_ [all]
 
     Cause a browser window to reload its current content.
     Expect responses similar to a GO command.
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c
index b7aea92..232f33e 100644
--- a/frontends/monkey/browser.c
+++ b/frontends/monkey/browser.c
@@ -494,6 +494,28 @@ monkey_window_handle_go(int argc, char **argv)
        }
 }
 
+/**
+ * handle WINDOW STOP command
+ */
+static void
+monkey_window_handle_stop(int argc, char **argv)
+{
+       struct gui_window *gw;
+       if (argc != 3) {
+               moutf(MOUT_ERROR, "WINDOW STOP ARGS BAD\n");
+               return;
+       }
+
+       gw = monkey_find_window_by_num(atoi(argv[2]));
+
+       if (gw == NULL) {
+               moutf(MOUT_ERROR, "WINDOW NUM BAD");
+       } else {
+               browser_window_stop(gw->bw);
+       }
+}
+
+
 static void
 monkey_window_handle_redraw(int argc, char **argv)
 {
@@ -541,6 +563,7 @@ monkey_window_handle_reload(int argc, char **argv)
        struct gui_window *gw;
        if (argc != 3 && argc != 4) {
                moutf(MOUT_ERROR, "WINDOW RELOAD ARGS BAD\n");
+               return;
        }
 
        gw = monkey_find_window_by_num(atoi(argv[2]));
@@ -598,6 +621,8 @@ monkey_window_handle_command(int argc, char **argv)
                monkey_window_handle_destroy(argc, argv);
        } else if (strcmp(argv[1], "GO") == 0) {
                monkey_window_handle_go(argc, argv);
+       } else if (strcmp(argv[1], "STOP") == 0) {
+               monkey_window_handle_stop(argc, argv);
        } else if (strcmp(argv[1], "REDRAW") == 0) {
                monkey_window_handle_redraw(argc, argv);
        } else if (strcmp(argv[1], "RELOAD") == 0) {


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=4be18fcf473b5bff57daa1b57e3de961134a546a
commit 4be18fcf473b5bff57daa1b57e3de961134a546a
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    detect monkey exit rather than waiting forever for a defunct process

diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py
index cbd979c..539fab5 100644
--- a/test/monkeyfarmer.py
+++ b/test/monkeyfarmer.py
@@ -55,7 +55,17 @@ class MonkeyFarmer(asyncore.dispatcher):
 
     def handle_connect(self):
         pass
+
+    def handle_close(self):
+        # the pipe to the monkey process has closed
+        #  ensure the child process is finished and report the exit
+        self.close()
+        if self.monkey.poll() is None:
+            self.monkey.terminate()
+            self.monkey.wait()
+        self.lines.insert(0, "GENERIC EXIT 
{}".format(self.monkey.returncode).encode('utf-8'))
         
+
     def handle_read(self):
         got = self.recv(8192)
         if not got:
@@ -162,6 +172,10 @@ class Browser:
             self.stopped = True
         elif what == 'LAUNCH':
             self.launchurl = args[1]
+        elif what == 'EXIT':
+            if not self.stopped:
+                print("Unexpected exit of monkey process with code 
{}".format(args[0]))
+            assert(self.stopped)
         else:
             # TODO: Nothing for now?
             pass


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=f2000ae60efaf8f296dd4e2719417224cd99ac59
commit f2000ae60efaf8f296dd4e2719417224cd99ac59
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    improve stdout print formatting

diff --git a/test/monkey-see-monkey-do b/test/monkey-see-monkey-do
index 68c75a3..8de29fa 100755
--- a/test/monkey-see-monkey-do
+++ b/test/monkey-see-monkey-do
@@ -33,15 +33,15 @@ def child_run_test(parts):
         sys.stdout = oldout
         sys.stderr = olderr
         print("FAIL:")
-        print("STDOUT:\n{}\n", outcapture.getvalue())
-        print("STDERR:\n{}\n", errcapture.getvalue())
+        print("STDOUT:\n{}\n".format(outcapture.getvalue()))
+        print("STDERR:\n{}\n".format(errcapture.getvalue()))
         print("RERAISE:")
         raise
     else:
         sys.stdout = oldout
         sys.stderr = olderr
         if verbose == True:
-            print("STDOUT:\n{}\n", outcapture.getvalue())
+            print("STDOUT:\n{}\n".format(outcapture.getvalue()))
 
 def run_test(parts):
     p = mp.Process(target=child_run_test, args=(parts, ))


-----------------------------------------------------------------------

Summary of changes:
 docs/using-monkey.md       |    7 ++++++-
 frontends/monkey/browser.c |   25 +++++++++++++++++++++++++
 test/monkey-see-monkey-do  |    6 +++---
 test/monkey_driver.py      |    9 +++++++++
 test/monkeyfarmer.py       |   17 +++++++++++++++++
 5 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/docs/using-monkey.md b/docs/using-monkey.md
index 5e543d6..f4fff43 100644
--- a/docs/using-monkey.md
+++ b/docs/using-monkey.md
@@ -112,6 +112,11 @@ Commands
     Cause the given browser window to visit the given URL.
     Optionally you can give a referrer URL to also use (simulating
     a click in the browser on a link).
+    Minimally you can expect throbber stop response.
+
+*   `WINDOW STOP` _%id%_
+
+    Cause a browser window to stop any in progress navigatoipn.
     Minimally you can expect throbber, url etc responses.
 
 *   `WINDOW REDRAW` _%id%_ [_%num% %num% %num% %num%_]
@@ -125,7 +130,7 @@ Commands
     Minimally you can expect redraw start/stop messages and you
     can likely expect some number of `PLOT` results.
 
-*   `WINDOW RELOAD` _%id%_
+*   `WINDOW RELOAD` _%id%_ [all]
 
     Cause a browser window to reload its current content.
     Expect responses similar to a GO command.
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c
index b7aea92..232f33e 100644
--- a/frontends/monkey/browser.c
+++ b/frontends/monkey/browser.c
@@ -494,6 +494,28 @@ monkey_window_handle_go(int argc, char **argv)
        }
 }
 
+/**
+ * handle WINDOW STOP command
+ */
+static void
+monkey_window_handle_stop(int argc, char **argv)
+{
+       struct gui_window *gw;
+       if (argc != 3) {
+               moutf(MOUT_ERROR, "WINDOW STOP ARGS BAD\n");
+               return;
+       }
+
+       gw = monkey_find_window_by_num(atoi(argv[2]));
+
+       if (gw == NULL) {
+               moutf(MOUT_ERROR, "WINDOW NUM BAD");
+       } else {
+               browser_window_stop(gw->bw);
+       }
+}
+
+
 static void
 monkey_window_handle_redraw(int argc, char **argv)
 {
@@ -541,6 +563,7 @@ monkey_window_handle_reload(int argc, char **argv)
        struct gui_window *gw;
        if (argc != 3 && argc != 4) {
                moutf(MOUT_ERROR, "WINDOW RELOAD ARGS BAD\n");
+               return;
        }
 
        gw = monkey_find_window_by_num(atoi(argv[2]));
@@ -598,6 +621,8 @@ monkey_window_handle_command(int argc, char **argv)
                monkey_window_handle_destroy(argc, argv);
        } else if (strcmp(argv[1], "GO") == 0) {
                monkey_window_handle_go(argc, argv);
+       } else if (strcmp(argv[1], "STOP") == 0) {
+               monkey_window_handle_stop(argc, argv);
        } else if (strcmp(argv[1], "REDRAW") == 0) {
                monkey_window_handle_redraw(argc, argv);
        } else if (strcmp(argv[1], "RELOAD") == 0) {
diff --git a/test/monkey-see-monkey-do b/test/monkey-see-monkey-do
index 68c75a3..8de29fa 100755
--- a/test/monkey-see-monkey-do
+++ b/test/monkey-see-monkey-do
@@ -33,15 +33,15 @@ def child_run_test(parts):
         sys.stdout = oldout
         sys.stderr = olderr
         print("FAIL:")
-        print("STDOUT:\n{}\n", outcapture.getvalue())
-        print("STDERR:\n{}\n", errcapture.getvalue())
+        print("STDOUT:\n{}\n".format(outcapture.getvalue()))
+        print("STDERR:\n{}\n".format(errcapture.getvalue()))
         print("RERAISE:")
         raise
     else:
         sys.stdout = oldout
         sys.stderr = olderr
         if verbose == True:
-            print("STDOUT:\n{}\n", outcapture.getvalue())
+            print("STDOUT:\n{}\n".format(outcapture.getvalue()))
 
 def run_test(parts):
     p = mp.Process(target=child_run_test, args=(parts, ))
diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index 3057094..16f286a 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -235,6 +235,14 @@ def run_test_step_action_navigate(ctx, step):
     assert(win is not None)
     win.go(step['url'])
 
+def run_test_step_action_stop(ctx, step):
+    print(get_indent(ctx) + "Action: " + step["action"])
+    assert_browser(ctx)
+    tag = step['window']
+    win = ctx['windows'].get(tag)
+    assert(win is not None)
+    win.stop()
+
 def run_test_step_action_sleep_ms(ctx, step):
     print(get_indent(ctx) + "Action: " + step["action"])
     conds = step['conditions']
@@ -438,6 +446,7 @@ step_handlers = {
     "window-new":   run_test_step_action_window_new,
     "window-close": run_test_step_action_window_close,
     "navigate":     run_test_step_action_navigate,
+    "stop":         run_test_step_action_stop,
     "sleep-ms":     run_test_step_action_sleep_ms,
     "block":        run_test_step_action_block,
     "repeat":       run_test_step_action_repeat,
diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py
index cbd979c..08465f8 100644
--- a/test/monkeyfarmer.py
+++ b/test/monkeyfarmer.py
@@ -55,7 +55,17 @@ class MonkeyFarmer(asyncore.dispatcher):
 
     def handle_connect(self):
         pass
+
+    def handle_close(self):
+        # the pipe to the monkey process has closed
+        #  ensure the child process is finished and report the exit
+        self.close()
+        if self.monkey.poll() is None:
+            self.monkey.terminate()
+            self.monkey.wait()
+        self.lines.insert(0, "GENERIC EXIT 
{}".format(self.monkey.returncode).encode('utf-8'))
         
+
     def handle_read(self):
         got = self.recv(8192)
         if not got:
@@ -162,6 +172,10 @@ class Browser:
             self.stopped = True
         elif what == 'LAUNCH':
             self.launchurl = args[1]
+        elif what == 'EXIT':
+            if not self.stopped:
+                print("Unexpected exit of monkey process with code 
{}".format(args[0]))
+            assert(self.stopped)
         else:
             # TODO: Nothing for now?
             pass
@@ -345,6 +359,9 @@ class BrowserWindow:
                 self.winid, url, referer))
         self.wait_start_loading()
 
+    def stop(self):
+        self.browser.farmer.tell_monkey("WINDOW STOP %s" % (self.winid))
+
     def reload(self):
         self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
 


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to