gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2297-g0b6fb32
Date: Wed, 22 Feb 2017 13:35:55 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  0b6fb32a7e0fdedc76dd5a6d9bbf752b7cca8c45 (commit)
      from  e9eb84e128f7f0ba4558d00cf794027bf9125a7d (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 -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnash.git/commit/?id=0b6fb32a7e0fdedc76dd5a6d9bbf752b7cca8c45


commit 0b6fb32a7e0fdedc76dd5a6d9bbf752b7cca8c45
Author: Nutchanon Wetchasit <address@hidden>
Date:   Wed Feb 22 19:24:59 2017 +0100

    Add automated tests for MovieClip.getURL()-based FSCommand usage.
    
    See bug #46944 <https://savannah.gnu.org/bugs/?46944>

diff --git a/.gitignore b/.gitignore
index 40b6c8d..5ebc15b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -136,6 +136,8 @@ testsuite/misc-ming.all/static_vs_dynamic1
 testsuite/misc-ming.all/static_vs_dynamic2
 testsuite/misc-ming.all/*.swf
 testsuite/misc-ming.all/extgetvariable_testrunner_v*
+testsuite/misc-ming.all/hostcmd_testrunner_v*
+testsuite/misc-ming.all/hostcmd_htmltest_v*.html
 testsuite/misc-ming.all/XMLSocketTester
 testsuite/misc-ming.all/sound/*.swf
 testsuite/misc-mtasc.all/pp_*.as
diff --git a/testsuite/misc-ming.all/Makefile.am 
b/testsuite/misc-ming.all/Makefile.am
index d3e2467..5ef927b 100644
--- a/testsuite/misc-ming.all/Makefile.am
+++ b/testsuite/misc-ming.all/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to generate Makefile.in
 # 
-#   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-#   Free Software Foundation, Inc.
+#   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
+#   2015, 2016, 2017 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -31,7 +31,11 @@ CLEANFILES =  \
 
 DISTCLEANFILES = XMLSocketTester extgetvariable_testrunner_v5 \
                  extgetvariable_testrunner_v6 extgetvariable_testrunner_v7 \
-                 extgetvariable_testrunner_v8
+                 extgetvariable_testrunner_v8 hostcmd_testrunner_v5 \
+                 hostcmd_testrunner_v6 hostcmd_testrunner_v7 \
+                 hostcmd_testrunner_v8 hostcmd_htmltest_v5.html \
+                 hostcmd_htmltest_v6.html hostcmd_htmltest_v7.html \
+                 hostcmd_htmltest_v8.html
 
 SUBDIRS = . loop loading displaylist_depths action_order register_class \
           init_action
@@ -74,7 +78,9 @@ EXTRA_DIST = \
        SharedObjectTest.sol/sol1.sol \
        SharedObjectTest.sol/README \
        XMLSocketTester.sh \
-       extgetvariable_testrunner.sh
+       extgetvariable_testrunner.sh \
+       hostcmd_testrunner.sh \
+       hostcmd_htmltest.sh
 
 AM_CPPFLAGS = \
        -I$(top_srcdir)/libbase \
@@ -232,6 +238,14 @@ check_SCRIPTS = \
        extgetvariable_testrunner_v6 \
        extgetvariable_testrunner_v7 \
        extgetvariable_testrunner_v8 \
+       hostcmd_testrunner_v5 \
+       hostcmd_testrunner_v6 \
+       hostcmd_testrunner_v7 \
+       hostcmd_testrunner_v8 \
+       hostcmd_htmltest_v5.html \
+       hostcmd_htmltest_v6.html \
+       hostcmd_htmltest_v7.html \
+       hostcmd_htmltest_v8.html \
        timeline_var_test-Runner \
        place_object_testrunner \
        place_object_test2runner \
@@ -1333,6 +1347,50 @@ extgetvariable_testrunner_v8: 
extgetvariable_testrunner.sh extgetvariable_v8.swf
                8 extgetvariable_v8.swf > $@
        chmod 755 $@
 
+hostcmd_v5.swf: hostcmd.as
+       $(MAKESWF) $(MAKESWF_FLAGS) -c -1 -r 1 -v 5 -o $@  $(srcdir)/hostcmd.as
+
+hostcmd_v6.swf: hostcmd.as
+       $(MAKESWF) $(MAKESWF_FLAGS) -r 1 -v 6 -o $@  $(srcdir)/hostcmd.as
+
+hostcmd_v7.swf: hostcmd.as
+       $(MAKESWF) $(MAKESWF_FLAGS) -r 1 -v 7 -o $@  $(srcdir)/hostcmd.as
+
+hostcmd_v8.swf: hostcmd.as
+       $(MAKESWF) $(MAKESWF_FLAGS) -r 1 -v 8 -o $@  $(srcdir)/hostcmd.as
+
+hostcmd_testrunner_v5: hostcmd_testrunner.sh hostcmd_v5.swf
+       sh $(srcdir)/hostcmd_testrunner.sh $(top_builddir) $(top_srcdir) \
+               5 hostcmd_v5.swf > $@
+       chmod 755 $@
+
+hostcmd_testrunner_v6: hostcmd_testrunner.sh hostcmd_v6.swf
+       sh $(srcdir)/hostcmd_testrunner.sh $(top_builddir) $(top_srcdir) \
+               6 hostcmd_v6.swf > $@
+       chmod 755 $@
+
+hostcmd_testrunner_v7: hostcmd_testrunner.sh hostcmd_v7.swf
+       sh $(srcdir)/hostcmd_testrunner.sh $(top_builddir) $(top_srcdir) \
+               7 hostcmd_v7.swf > $@
+       chmod 755 $@
+
+hostcmd_testrunner_v8: hostcmd_testrunner.sh hostcmd_v8.swf
+       sh $(srcdir)/hostcmd_testrunner.sh $(top_builddir) $(top_srcdir) \
+               8 hostcmd_v8.swf > $@
+       chmod 755 $@
+
+hostcmd_htmltest_v5.html: hostcmd_htmltest.sh hostcmd_v5.swf
+       sh $(srcdir)/hostcmd_htmltest.sh 5 hostcmd_v5.swf > $@
+
+hostcmd_htmltest_v6.html: hostcmd_htmltest.sh hostcmd_v6.swf
+       sh $(srcdir)/hostcmd_htmltest.sh 6 hostcmd_v6.swf > $@
+
+hostcmd_htmltest_v7.html: hostcmd_htmltest.sh hostcmd_v7.swf
+       sh $(srcdir)/hostcmd_htmltest.sh 7 hostcmd_v7.swf > $@
+
+hostcmd_htmltest_v8.html: hostcmd_htmltest.sh hostcmd_v8.swf
+       sh $(srcdir)/hostcmd_htmltest.sh 8 hostcmd_v8.swf > $@
+
 GradientFillTest.swf: GradientFillTest.as 
        $(MAKESWF) $(MAKESWF_FLAGS) -v 8 -r 1 -o $@  $(srcdir)/empty.as 
$(srcdir)/GradientFillTest.as
 
@@ -1600,6 +1658,10 @@ TEST_CASES = \
        extgetvariable_testrunner_v6 \
        extgetvariable_testrunner_v7 \
        extgetvariable_testrunner_v8 \
+       hostcmd_testrunner_v5 \
+       hostcmd_testrunner_v6 \
+       hostcmd_testrunner_v7 \
+       hostcmd_testrunner_v8 \
        DrawingApiTestRunner \
        TextSnapshotTest-Runner \
        reverse_execute_PlaceObject2_test1runner \
diff --git a/testsuite/misc-ming.all/hostcmd.as 
b/testsuite/misc-ming.all/hostcmd.as
new file mode 100644
index 0000000..1e4689b
--- /dev/null
+++ b/testsuite/misc-ming.all/hostcmd.as
@@ -0,0 +1,59 @@
+// hostcmd.as - Non-predefined FSCommand invocation tests
+//
+//   Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+//
+// Note:
+//     This SWF file does not run any test by itself as this is a test on
+//     plugin's host interface.
+//
+//     To run this test against proprietary player, use HTML-based
+//     test runners "hostcmd_htmltest_v*.html".
+//
+// Original author: Nutchanon Wetchasit <address@hidden>
+//
+
+// Once this Flash movie is run, it will issue non-predefined FSCommand
+// via MovieClip.getURL() in mulitple combination of command and arguments;
+// which will be forwarded to a handling function in host container-side
+// scripting language; most likely `*_DoFSCommand(cmd,arg)` function
+// in JavaScript (where "*" is the value of `name` attribute on `<object>`
+// or `<embed>` tag which the SWF is playing).
+
+var object_customstringarg;
+
+trace("STARTOFTEST");
+this.getURL("FSCommand:");
+this.getURL("FSCommand:", "This is a string for empty call");
+this.getURL("FSCommand:noarg");
+this.getURL("FSCommand:stringarg", "This is a string");
+this.getURL("FSCommand:weirdstringarg", 
"address@hidden&*()_+-={}|[]\\:\";\'<>?,./~`");
+this.getURL("FSCommand:integerarg", 9876);
+this.getURL("FSCommand:floatarg", 9876.5432);
+this.getURL("FSCommand:infinitearg", Infinity);
+this.getURL("FSCommand:neginfinitearg", -Infinity);
+this.getURL("FSCommand:nanarg", NaN);
+this.getURL("FSCommand:booleanarg", true);
+this.getURL("FSCommand:nullarg", null);
+this.getURL("FSCommand:undefinedarg", undefined);
+this.getURL("FSCommand:arrayarg", new Array("The", "quick", "brown", "fox", 
"jumps", "over", "the", "lazy", "dog"));
+this.getURL("FSCommand:objectarg", new Object());
+object_customstringarg = new Object();
+object_customstringarg.toString = function():String {
+       return "This is a custom Object.toString()";
+};
+this.getURL("FSCommand:object_customstringarg", object_customstringarg);
+trace("ENDOFTEST");
diff --git a/testsuite/misc-ming.all/hostcmd_htmltest.sh 
b/testsuite/misc-ming.all/hostcmd_htmltest.sh
new file mode 100644
index 0000000..2e455a2
--- /dev/null
+++ b/testsuite/misc-ming.all/hostcmd_htmltest.sh
@@ -0,0 +1,290 @@
+#!/bin/sh
+
+#
+# hostcmd_htmltest.sh - HTML-based non-predefined FSCommand invocation
+#                       test runner generator
+#
+# Copyright (C) 2017 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+# Original author: Nutchanon Wetchasit <address@hidden>
+#
+# The generated test runner checks Gnash (or proprietary player) for:
+#  * Support of FSCommand call via MovieClip.getURL() (bug #46944)
+#        <https://savannah.gnu.org/bugs/?46944>
+#
+# Usage:
+#     ./hostcmd_htmltest.sh <swfversion> <swf>
+#
+#     The <swf> must be a valid URL name and must not contain '&',
+#     as this test generator does not escape SWF file name.
+#
+# Generated test runner's usage:
+#     Open the generated test HTML file under web browser with JavaScript and
+#     plug-ins enabled, wait few seconds for the test to run. Once finished,
+#     the result will be shown on browser screen, with "There should be NN
+#     tests run" as the last line.
+#
+#     When testing with proprietary player, the test directory might need
+#     to be added as player's trusted location, or tests would fail due to
+#     sandbox violation. Alternative is putting the test directory
+#     on a web server and run the test online.
+#
+# Note:
+#     The generated test runner does not count checks run inside SWF file
+#     (because there aren't any).
+#
+
+# Check for generation parameters
+while getopts "" name
+do
+       case $name in
+               ?)
+                       echo "Usage: $0 <swfversion> <swf>" >&2
+                       exit 1;;
+       esac
+done
+shift $(($OPTIND - 1))
+if [ "$#" -ne 2 ]
+then
+       echo "Usage: $0 <swfversion> <swf>" >&2
+       exit 1
+fi
+
+# Load generation parameters
+swfversion=$1
+shift
+swf=$1
+
+cat << EOF
+<html>
+<head>
+       <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+       <title>Host Communication FSCommand Test</title>
+</head>
+<body>
+<div id="flashstate">
+       <noscript>
+               <strong>ERROR: JavaScript is not enabled, tests will not 
run</strong>
+       </noscript>
+</div>
+<object id="player" name="player" data="${swf}" width="320" height="240" 
type="application/x-shockwave-flash">
+       <param name="movie" value="${swf}">
+       <param name="AllowScriptAccess" value="always">
+       <div>
+               <strong>ERROR: SWF failed to load, tests will not run 
correctly</strong>
+       </div>
+</object>
+<script type="text/javascript">
+<!--
+       var tested = 0;
+       var passed = 0;
+       var failed = 0;
+       var xpassed = 0;
+       var xfailed = 0;
+
+       function check(op, msg) {
+               var flashstatus;
+               var failureline;
+
+               flashstatus=document.getElementById("flashstate");
+               tested++;
+               if(op) {
+                       passed++;
+                       
flashstatus.appendChild(document.createTextNode("PASSED: " + msg));
+               } else {
+                       failed++;
+                       failureline=document.createElement("strong");
+                       
failureline.appendChild(document.createTextNode("FAILED: " + msg));
+                       flashstatus.appendChild(failureline);
+               }
+               flashstatus.appendChild(document.createElement("br"));
+       }
+
+       function check_equals(op1, op2, msg) {
+               var flashstatus;
+               var failureline;
+
+               flashstatus=document.getElementById("flashstate");
+               tested++;
+               if(op1 == op2) {
+                       passed++;
+                       
flashstatus.appendChild(document.createTextNode("PASSED: " + msg));
+               } else {
+                       failed++;
+                       failureline=document.createElement("strong");
+                       
failureline.appendChild(document.createTextNode("FAILED: " + msg + " (\"" + op1 
+ "\" != \"" + op2 + "\")"));
+                       flashstatus.appendChild(failureline);
+               }
+               flashstatus.appendChild(document.createElement("br"));
+       }
+
+       function xcheck_equals(op1, op2, msg) {
+               var flashstatus;
+               var successline;
+
+               flashstatus=document.getElementById("flashstate");
+               tested++;
+               if(op1 == op2) {
+                       xpassed++;
+                       successline=document.createElement("strong");
+                       
successline.appendChild(document.createTextNode("XPASSED: "+msg));
+                       flashstatus.appendChild(successline);
+               } else {
+                       xfailed++;
+                       
flashstatus.appendChild(document.createTextNode("XFAILED: " + msg + " (\"" + 
op1 + "\" != \"" + op2 + "\")"));
+               }
+               flashstatus.appendChild(document.createElement("br"));
+       }
+
+       function check_error(msg) {
+               var flashstatus;
+               var errorline;
+
+               flashstatus=document.getElementById("flashstate");
+               errorline=document.createElement("strong");
+               errorline.appendChild(document.createTextNode("ERROR: " + msg));
+               flashstatus.appendChild(errorline);
+               flashstatus.appendChild(document.createElement("br"));
+       }
+
+       function check_totals(total) {
+               check_equals(tested,total,"There should be "+total+" tests 
run");
+       }
+
+       function xcheck_totals(total) {
+               xcheck_equals(tested,total,"There should be "+total+" tests 
run");
+       }
+
+       var noname_call = 0;
+       var noarg_call = 0;
+       var stringarg_call = 0;
+       var weirdstringarg_call = 0;
+       var integerarg_call = 0;
+       var floatarg_call = 0;
+       var infinitearg_call = 0;
+       var neginfinitearg_call = 0;
+       var nanarg_call = 0;
+       var booleanarg_call = 0;
+       var nullarg_call = 0;
+       var undefinedarg_call = 0;
+       var arrayarg_call = 0;
+       var objectarg_call = 0;
+       var object_customstringarg_call = 0;
+
+       function player_DoFSCommand(cmd, arg) {
+               if("" == cmd) {
+                       noname_call++;
+                       if (noname_call == 1) {
+                               check_equals(typeof(arg), "string", 
"MovieClip-based no-name FSCommand call with no parameter should pass 
string-type parameter");
+                               check_equals(arg, "", "MovieClip-based no-name 
FSCommand call with no-parameter should pass an empty string parameter");
+                       } else if(noname_call == 2) {
+                               check_equals(typeof(arg), "string", 
"MovieClip-based no-name FSCommand call with string parameter should pass 
string-type parameter");
+                               check_equals(arg, "This is a string for empty 
call", "MovieClip-based no-name FSCommand call with string parameter should 
pass a correct string parameter value");
+                       } else {
+                               check_error("Unknown no-name FSCommand issued: 
\"" + cmd + "\" parameter \"" + arg + "\"");
+                       }
+               } else if("noarg" == cmd) {
+                       noarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with no parameter should pass string-type parameter");
+                       check_equals(arg, "", "MovieClip-based FSCommand call 
with no parameter should pass an empty string parameter value");
+               } else if("stringarg" == cmd) {
+                       stringarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with string parameter should pass string-type parameter");
+                       check_equals(arg, "This is a string", "MovieClip-based 
FSCommand call with string parameter should pass a correct string parameter 
value");
+               } else if("weirdstringarg" == cmd) {
+                       // Currently, this FSCommand won't run under 
libgnashplugin,
+                       // due to its internal parameter parsing issue.
+
+                       weirdstringarg_call++;
+                       xcheck_equals(typeof(arg),"string", "MovieClip-based 
FSCommand call with string parameter full of symbols should pass string-type 
parameter");
+                       
xcheck_equals(arg,"address@hidden&*()_+-={}|[]\\\\:\";\'<>?,./~\`", 
"Full-of-symbols string parameter value of MovieClip-based FSCommand call 
should be passed correctly");
+               } else if("integerarg" == cmd) {
+                       integerarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with integer parameter should pass string-type parameter");
+                       check_equals(arg, "9876", "MovieClip-based FSCommand 
call should pass a correct string representation of integer parameter value");
+               } else if("floatarg" == cmd) {
+                       floatarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with floating point parameter should pass string-type 
parameter");
+                       check_equals(arg, "9876.5432", "MovieClip-based 
FSCommand call should pass a correct string representation of floating point 
parameter value");
+               } else if("infinitearg" == cmd) {
+                       infinitearg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with infinity parameter should pass string-type parameter");
+                       check_equals(arg, "Infinity", "MovieClip-based 
FSCommand call should pass a correct string representation of infinity 
parameter");
+               } else if("neginfinitearg" == cmd) {
+                       neginfinitearg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with negative infinity parameter should pass string-type 
parameter");
+                       check_equals(arg, "-Infinity", "MovieClip-based 
FSCommand call should pass a correct string representation of negative infinity 
parameter value");
+               } else if("nanarg" == cmd) {
+                       nanarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with not-a-number parameter should pass string-type parameter");
+                       check_equals(arg, "NaN", "MovieClip-based FSCommand 
call should pass a correct string representation of not-a-number parameter 
value");
+               } else if("booleanarg" == cmd) {
+                       booleanarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with boolean parameter should pass string-type parameter");
+                       check_equals(arg, "true", "MovieClip-based FSCommand 
call should pass a correct string representation of boolean parameter value");
+               } else if("nullarg" == cmd) {
+                       nullarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with null parameter should pass string-type parameter");
+                       check_equals(arg, "null", "MovieClip-based FSCommand 
call should pass a correct string representation of null parameter");
+               } else if("undefinedarg" == cmd) {
+                       undefinedarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with undefined parameter should pass string-type parameter");
+                       xcheck_equals(arg, "", "MovieClip-based FSCommand call 
should pass an empty string as a representation of undefined parameter");
+               } else if("arrayarg" == cmd) {
+                       arrayarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with array parameter should pass string-type parameter");
+                       check_equals(arg, 
"The,quick,brown,fox,jumps,over,the,lazy,dog", "Array parameter value of 
MovieClip-based FSCommand call should be passed correctly as CSV string");
+               } else if("objectarg" == cmd) {
+                       objectarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with object parameter should pass string-type parameter");
+                       check_equals(arg, "[object Object]", "String 
representation of Object parameter of MovieClip-based FSCommand call should be 
correctly passed");
+               } else if("object_customstringarg" == cmd) {
+                       object_customstringarg_call++;
+                       check_equals(typeof(arg), "string", "MovieClip-based 
FSCommand call with object parameter bearing custom toString() should pass 
string-type parameter");
+                       check_equals(arg, "This is a custom Object.toString()", 
"Custom string representation of object parameter of MovieClip-based FSCommand 
call should be correctly passed");
+               } else {
+                       check_error("Unknown FSCommand issued: \"" + cmd + "\" 
parameter \"" + arg + "\"");
+               }
+       }
+
+       function verify_flash() {
+               check_equals(noname_call, 2, "No-name FSCommand should be 
called for 2 times");
+               check_equals(noarg_call, 1, "\"noarg\" FSCommand should be 
called for 1 time");
+               check_equals(stringarg_call, 1, "\"stringarg\" FSCommand should 
be called for 1 time");
+               xcheck_equals(weirdstringarg_call, 1, "\"weirdstringarg\" 
FSCommand should be called for 1 time");
+               check_equals(integerarg_call, 1, "\"integerarg\" FSCommand 
should be called for 1 time");
+               check_equals(floatarg_call, 1, "\"floatarg\" FSCommand should 
be called for 1 time");
+               check_equals(infinitearg_call, 1, "\"infinitearg\" FSCommand 
should be called for 1 time");
+               check_equals(neginfinitearg_call, 1, "\"neginfinitearg\" 
FSCommand should be called for 1 time");
+               check_equals(nanarg_call, 1, "\"nanarg\" FSCommand should be 
called for 1 time");
+               check_equals(booleanarg_call, 1, "\"booleanarg\" FSCommand 
should be called for 1 time");
+               check_equals(nullarg_call, 1, "\"nullarg\" FSCommand should be 
called for 1 time");
+               check_equals(undefinedarg_call, 1, "\"undefinedarg\" FSCommand 
should be called for 1 time");
+               check_equals(arrayarg_call, 1, "\"arrayarg\" FSCommand should 
be called for 1 time");
+               check_equals(objectarg_call, 1, "\"objectarg\" FSCommand should 
be called for 1 time");
+               check_equals(object_customstringarg_call, 1, 
"\"object_customstringarg\" FSCommand should be called for 1 time");
+
+               xcheck_totals(47);
+       }
+
+       setTimeout("verify_flash()",3000);
+//-->
+</script>
+</body>
+</html>
+EOF
diff --git a/testsuite/misc-ming.all/hostcmd_testrunner.sh 
b/testsuite/misc-ming.all/hostcmd_testrunner.sh
new file mode 100644
index 0000000..3b36f2d
--- /dev/null
+++ b/testsuite/misc-ming.all/hostcmd_testrunner.sh
@@ -0,0 +1,264 @@
+#!/bin/sh
+
+#
+# hostcmd_testrunner.sh - container-emulated non-predefined FSCommand
+#                         invocation test runner generator
+#
+# Copyright (C) 2017 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+# Original author: Nutchanon Wetchasit <address@hidden>
+#
+# The generated test runner checks Gnash for:
+#  * Support of FSCommand call via MovieClip.getURL() (bug #46944)
+#        <https://savannah.gnu.org/bugs/?46944>
+#
+# Usage:
+#     ./hostcmd_testrunner.sh <builddir> <srcdir> <swfversion> <swf>
+#
+# Generated test runner's exit codes:
+#     0         if tester ran completely
+#     non-zero  if tester encountered an error
+#
+# Note:
+#     The generated test file requires a filesystem that supports named pipes.
+#
+
+# Check for generation parameters
+while getopts "" name
+do
+       case $name in
+               ?)
+                       echo "Usage: $0 <builddir> <srcdir> <swfversion> <swf>" 
>&2
+                       exit 1;;
+       esac
+done
+shift $(($OPTIND - 1))
+if [ "$#" -ne 4 ]
+then
+       echo "Usage: $0 <builddir> <srcdir> <swfversion> <swf>" >&2
+       exit 1
+fi
+
+# Load generation parameters
+top_builddir=$1
+shift
+top_srcdir=$1
+shift
+swfversion=$1
+shift
+swf=$1
+
+# Generate the test runner
+echo "#!/bin/sh"
+echo
+
+echo "# Environment variables"
+env | grep '^GNASH' | while read reply
+do
+       echo "export \"${reply}\""
+done
+
+cat << EOF
+
+# Filenames and constants
+LOGFILE=${top_builddir}/testoutlog.\$\$
+PIPE2CONTAINER=${top_builddir}/tocontainer.\$\$
+PIPE2PLAYER=${top_builddir}/toplayer.\$\$
+READTIMEOUT=5
+
+# Test counts
+TESTED=0
+FAILED=0
+PASSED=0
+
+# check_equals(\$op1, \$op2, \$msg)
+# Equality checker and counter
+check_equals() {
+       if [ "\$1" = "\$2" ]
+       then
+               echo "PASSED: \$3"
+               PASSED=\`expr "\$PASSED" + 1\`
+       else
+               echo "FAILED: \$3 (\"\$1\" != \"\$2\")"
+               FAILED=\`expr "\$FAILED" + 1\`
+       fi
+       TESTED=\`expr "\$TESTED" + 1\`
+}
+
+# xcheck_equals(\$op1, \$op2, \$msg)
+# Equality checker and counter (for expected failure)
+xcheck_equals() {
+       if [ "\$1" = "\$2" ]
+       then
+               echo "XPASSED: \$3"
+               PASSED=\`expr "\$PASSED" + 1\`
+       else
+               echo "XFAILED: \$3 (\"\$1\" != \"\$2\")"
+               FAILED=\`expr "\$FAILED" + 1\`
+       fi
+       TESTED=\`expr "\$TESTED" + 1\`
+}
+
+# check_totals(\$op, \$msg)
+# Test count checker
+check_totals() {
+       check_equals "\$TESTED" "\$1" "\$2"
+}
+
+# check_error(\$bool, \$msg)
+# Assert \$bool is 0; if not, flag error in the test, and exit
+check_error() {
+       if [ "\$1" -ne 0 ]
+       then
+               echo "ERROR: \$2" >&2
+               exit 1
+       fi
+}
+
+# read_timeout(\$varname, \$timeout)
+# Read one line from standard input, with a specified timeout (in seconds)
+read_timeout() {
+       trap 'trap - USR1; return 142' USR1
+       (sleep "\$2" && kill -USR1 "\$\$" > /dev/null 2>&1) &
+       TIMEOUTPID=\$!
+       read "\$1"
+       READERROR=\$?
+       kill "\$TIMEOUTPID" > /dev/null 2>&1
+       trap - USR1
+       return \$READERROR
+}
+
+# Create required named pipes
+if [ \! -p "\$PIPE2CONTAINER" ]
+then
+       mkfifo "\$PIPE2CONTAINER"
+       check_error "\$?" "Failed to create a named pipe: \$PIPE2CONTAINER"
+fi
+if [ \! -p "\$PIPE2PLAYER" ]
+then
+       mkfifo "\$PIPE2PLAYER"
+       check_error "\$?" "Failed to create a named pipe: \$PIPE2PLAYER"
+fi
+
+# Open player-to-host pipe
+exec 3<> "\$PIPE2CONTAINER"
+check_error \$? "Failed to open a named pipe: \$PIPE2CONTAINER"
+
+# Open host-to-player pipe
+exec 4<> "\$PIPE2PLAYER"
+check_error \$? "Failed to open a named pipe: \$PIPE2PLAYER"
+
+# Start player
+"${top_builddir}/gui/gnash" -r 0 -vv -F 3:4 "${swf}" > "\$LOGFILE" 2>&1 &
+GNASHPID=\$!
+
+# Wait until the SWF code start running, by loop-checking logfile
+STARTCOUNTDOWN=\$READTIMEOUT
+while [ \$STARTCOUNTDOWN -gt 0 ]
+do
+       if grep "TRACE: STARTOFTEST" "\$LOGFILE" 2>&1 > /dev/null
+       then
+               break
+       fi
+       sleep 1
+       STARTCOUNTDOWN=\`expr \$STARTCOUNTDOWN - 1\`
+done
+
+[ \$STARTCOUNTDOWN -ne 0 ]
+check_equals \$? 0 "Gnash-side ActionScript code should be successfully 
started"
+
+# Read for no-name no-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string></string><string></string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based no-name FSCommand call with no 
parameter"
+
+# Read for no-name string-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string></string><string>This is a string for empty 
call</string></arguments></invoke>' "Gnash should correctly pass 
MovieClip-based no-name FSCommand call with string parameter"
+
+# Read for no-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>noarg</string><string></string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with no parameter"
+
+# Read for string-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>stringarg</string><string>This is a 
string</string></arguments></invoke>' "Gnash should correctly pass 
MovieClip-based FSCommand call with string parameter"
+
+# Read for full-of-symbols-string-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+xcheck_equals "\$LINE" "<invoke name=\"fsCommand\" 
returntype=\"xml\"><arguments><string>weirdstringarg</string><string>address@hidden&amp;*()_+-={}|[]:\";'&lt;&gt;?,./~\\\`</string></arguments></invoke>"
 "Gnash should correctly pass MovieClip-based FSCommand call with 
full-of-symbols string parameter"
+
+# Read for integer-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>integerarg</string><string>9876</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with integer 
parameter"
+
+# Read for floating-point-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>floatarg</string><string>9876.5432</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with floating 
point parameter"
+
+# Read for infinity-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>infinitearg</string><string>Infinity</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with infinity 
parameter"
+
+# Read for negative-infinity-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>neginfinitearg</string><string>-Infinity</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with negative 
infinity parameter"
+
+# Read for not-a-number-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>nanarg</string><string>NaN</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with not-a-number 
parameter"
+
+# Read for boolean-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>booleanarg</string><string>true</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with boolean 
parameter"
+
+# Read for null-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>nullarg</string><string>null</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with null 
parameter"
+
+# Read for undefined-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+xcheck_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>undefinedarg</string><string></string></arguments></invoke>'
 "Gnash should pass undefined parameter of MovieClip-based FSCommand call as 
empty string"
+
+# Read for array-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>arrayarg</string><string>The,quick,brown,fox,jumps,over,the,lazy,dog</string></arguments></invoke>'
 "Gnash should correctly pass MovieClip-based FSCommand call with array 
parameter"
+
+# Read for object-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>objectarg</string><string>[object 
Object]</string></arguments></invoke>' "Gnash should correctly pass 
MovieClip-based FSCommand call with object parameter"
+
+# Read for object-with-custom-string-parameter FSCommand statement
+read_timeout LINE \$READTIMEOUT <&3
+check_equals "\$LINE" '<invoke name="fsCommand" 
returntype="xml"><arguments><string>object_customstringarg</string><string>This 
is a custom Object.toString()</string></arguments></invoke>' "Gnash should 
correctly pass MovieClip-based FSCommand call with object parameter bearing 
custom toString()"
+
+# Close pipes
+exec 3<&-
+exec 4<&-
+
+# Force Gnash to exit
+kill \$GNASHPID
+wait \$GNASHPID
+
+# Check for total number of test run
+check_totals "17" "There should be 17 tests run"
+
+# Remove temporary files
+rm "\$LOGFILE"
+rm "\$PIPE2CONTAINER"
+rm "\$PIPE2PLAYER"
+EOF

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

Summary of changes:
 .gitignore                                    |   2 +
 testsuite/misc-ming.all/Makefile.am           |  70 ++++++-
 testsuite/misc-ming.all/hostcmd.as            |  59 ++++++
 testsuite/misc-ming.all/hostcmd_htmltest.sh   | 290 ++++++++++++++++++++++++++
 testsuite/misc-ming.all/hostcmd_testrunner.sh | 264 +++++++++++++++++++++++
 5 files changed, 681 insertions(+), 4 deletions(-)
 create mode 100644 testsuite/misc-ming.all/hostcmd.as
 create mode 100644 testsuite/misc-ming.all/hostcmd_htmltest.sh
 create mode 100644 testsuite/misc-ming.all/hostcmd_testrunner.sh


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]