gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ./ChangeLog testsuite/actionscript.all/Ne...


From: Rob Savoye
Subject: [Gnash-commit] gnash ./ChangeLog testsuite/actionscript.all/Ne...
Date: Sat, 04 Feb 2006 21:24:07 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         
Changes by:     Rob Savoye <address@hidden>     06/02/04 21:24:07

Modified files:
        .              : ChangeLog 
        testsuite/actionscript.all: NetConnection.as 
        server         : Makefile.am NetConnection.h NetConnection.cpp 
Added files:
        server         : network.h network.cpp 

Log message:
        * server/network.{h,cpp}: New files to hold base networking class
        for use by other ActionScript objects. This base class contains
        the code for custom methods that implement accessors to the data
        to enable unit testing derived classes like NetConnection and
        LocalConnection.
        * server/NetConnection.h: Move all testing code to network.h.
        * server/NetConnection.cpp: Move all testing code to
        network.cpp. Setup callbacks for our custom methods using the
        Network, instead of NetConnection class.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.88&tr2=1.89&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/testsuite/actionscript.all/NetConnection.as.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Makefile.am.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/network.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/network.cpp?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/NetConnection.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/NetConnection.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.88 gnash/ChangeLog:1.89
--- gnash/ChangeLog:1.88        Sat Feb  4 19:57:37 2006
+++ gnash/ChangeLog     Sat Feb  4 21:24:07 2006
@@ -1,5 +1,15 @@
 2006-02-04  Rob Savoye  <address@hidden>
 
+       * server/network.{h,cpp}: New files to hold base networking class
+       for use by other ActionScript objects. This base class contains
+       the code for custom methods that implement accessors to the data
+       to enable unit testing derived classes like NetConnection and
+       LocalConnection. 
+       * server/NetConnection.h: Move all testing code to network.h.
+       * server/NetConnection.cpp: Move all testing code to
+       network.cpp. Setup callbacks for our custom methods using the
+       Network, instead of NetConnection class.
+
        * Makefile.am: Rearrange variable definitions so the diit and
        distcheck Makefile targets actually work. Add DIST directories so
        everything makes it into the tarball.
Index: gnash/server/Makefile.am
diff -u gnash/server/Makefile.am:1.16 gnash/server/Makefile.am:1.17
--- gnash/server/Makefile.am:1.16       Fri Feb  3 20:50:27 2006
+++ gnash/server/Makefile.am    Sat Feb  4 21:24:07 2006
@@ -23,6 +23,7 @@
 
 # noinst_LTLIBRARIES = libserver.la libasobjs.la
 lib_LTLIBRARIES = libgnashserver.la libgnashasobjs.la
+# noinst_SCRIPTS = gen-files.sh
 
 # Only enable if we're configured with --enable-mp3
 INCLUDES = -I.. \
@@ -104,6 +105,7 @@
         impl.cpp         \
         log.cpp          \
         morph2.cpp       \
+       network.cpp      \
        Movie.cpp        \
         render.cpp       \
         shape.cpp        \
@@ -116,7 +118,7 @@
         array.cpp        \
         types.cpp $(MP3_HANDLER)
 
-noinst_HEADERS = $(as_incls)
+noinst_HEADERS = $(as_incls) \
        action.h        \
        array.h         \
        button.h        \
@@ -128,6 +130,7 @@
        log.h           \
        morph2.h        \
        morph.h         \
+       network.h       \
        Movie.h         \
        MovieClipLoader.h       \
        render.h        \
@@ -137,6 +140,7 @@
        gstring.h       \
        Sprite.h        \
        styles.h        \
+       swf.h           \
        tesselate.h     \
        text.h          \
        textformat.h    \
Index: gnash/server/NetConnection.cpp
diff -u gnash/server/NetConnection.cpp:1.2 gnash/server/NetConnection.cpp:1.3
--- gnash/server/NetConnection.cpp:1.2  Sat Feb  4 07:12:56 2006
+++ gnash/server/NetConnection.cpp      Sat Feb  4 21:24:07 2006
@@ -83,18 +83,18 @@
         _protocol = _url.substr(0, first_colon);
         if (second_colon != string::npos) {
             _host = _url.substr(double_slash, second_colon - double_slash);
-            _port = _url.substr(second_colon + 1, single_slash - second_colon 
- 1);
+            _portstr = _url.substr(second_colon + 1, single_slash - 
second_colon - 1);
         } else {
             _host = _url.substr(double_slash, single_slash - double_slash);
         }
         _path = _url.substr(single_slash, _url.size());
 
-        if (_port.size() == 0) {
+        if (_portstr.size() == 0) {
             log_msg("Loading FLV file from: %s://%s%s\n",
                     _protocol.c_str(), _host.c_str(), _path.c_str());
         } else {
             log_msg("Loading FLV file from: %s://%s:%s%s\n",
-                    _protocol.c_str(), _host.c_str(), _port.c_str(), 
_path.c_str());
+                    _protocol.c_str(), _host.c_str(), _portstr.c_str(), 
_path.c_str());
         }
     } else {
         log_msg("Connecting to localhost\n");
@@ -118,11 +118,11 @@
 
     netconnection_obj->set_member("connect", &netconnection_connect);
 #ifdef ENABLE_TESTING
-    netconnection_obj->set_member("geturl",  &netconnection_geturl);
-    netconnection_obj->set_member("gethost", &netconnection_gethost);
-    netconnection_obj->set_member("getprotocol",  &netconnection_getprotocol);
-    netconnection_obj->set_member("getport", &netconnection_getport);
-    netconnection_obj->set_member("getpath", &netconnection_getpath);
+    netconnection_obj->set_member("geturl",  &network_geturl);
+    netconnection_obj->set_member("getprotocol",  &network_getprotocol);
+    netconnection_obj->set_member("gethost", &network_gethost);
+    netconnection_obj->set_member("getport", &network_getport);
+    netconnection_obj->set_member("getpath", &network_getpath);
 #endif
     fn.result->set_as_object_interface(netconnection_obj);
 }
@@ -142,42 +142,8 @@
         ptr->obj.connect(0);
     }
     
-    log_msg("%s:unimplemented %d\n", __FUNCTION__);
+    log_msg("%s: partially implemented\n", __FUNCTION__);
 }
 
-#ifdef ENABLE_TESTING
-void netconnection_geturl(const fn_call& fn)
-{
-    netconnection_as_object *ptr = (netconnection_as_object*)fn.this_ptr;
-    assert(ptr);
-    fn.result->set_tu_string(ptr->obj.getURL().c_str());
-}
-void
-netconnection_getprotocol(const fn_call& fn){
-    netconnection_as_object *ptr = (netconnection_as_object*)fn.this_ptr;
-    assert(ptr);
-
-    fn.result->set_tu_string(ptr->obj.getProtocol().c_str());
-}
-void
-netconnection_gethost(const fn_call& fn){
-    netconnection_as_object *ptr = (netconnection_as_object*)fn.this_ptr;
-    assert(ptr);
-    fn.result->set_tu_string(ptr->obj.getHost().c_str());
-}
-void
-netconnection_getport(const fn_call& fn){
-    netconnection_as_object *ptr = (netconnection_as_object*)fn.this_ptr;
-    assert(ptr);
-    fn.result->set_tu_string(ptr->obj.getPort().c_str());
-}
-void
-netconnection_getpath(const fn_call& fn){
-    netconnection_as_object *ptr = (netconnection_as_object*)fn.this_ptr;
-    assert(ptr);
-    fn.result->set_tu_string(ptr->obj.getPath().c_str());
-}
-
-#endif
-} // end of gnaash namespace
+} // end of gnash namespace
 
Index: gnash/server/NetConnection.h
diff -u gnash/server/NetConnection.h:1.2 gnash/server/NetConnection.h:1.3
--- gnash/server/NetConnection.h:1.2    Sat Feb  4 07:12:56 2006
+++ gnash/server/NetConnection.h        Sat Feb  4 21:24:07 2006
@@ -27,6 +27,7 @@
 
 #include "impl.h"
 #include "log.h"
+#include "network.h"
 
 namespace gnash {
 
@@ -34,52 +35,21 @@
 const int RTMP = 1935;
 const int RTMPT = 80;
 
-class NetConnection {
+class NetConnection : public Network {
 public:
     NetConnection();
     ~NetConnection();
     void connect(const char *arg);
-
-    // Accessors for testing, not supported by Flash
-    bool connected() { return _connected; }
-    bool connected(bool state) { _connected = state; }
-
-#ifdef ENABLE_TESTING
-    std::string getURL()        { return _url; }
-    std::string getProtocol()   { return _protocol; }
-    std::string getHost()       { return _host; }
-    std::string getPort()       { return _port; }
-    std::string getPath()       { return _path; }
-    
-    void setURL(std::string url) { _url = url; };
-    void setProtocol(std::string proto) { _protocol = proto; };
-    void setHost(std::string host) { _host = host; };
-    void setPort(std::string port) { _port = port; };
-    void setPath(std::string path) { _path = path; };
-#endif
-private:
-    bool        _connected;
-    std::string _url;
-    std::string _protocol;
-    std::string _host;
-    std::string _port;
-    std::string _path;
 };
 
 struct netconnection_as_object : public as_object
 {
     NetConnection obj;
 };
+
 void netconnection_new(const fn_call& fn);
 void netconnection_connect(const fn_call& fn);
 
-#ifdef ENABLE_TESTING
-void netconnection_geturl(const fn_call& fn);
-void netconnection_getprotocol(const fn_call& fn);
-void netconnection_gethost(const fn_call& fn);
-void netconnection_getport(const fn_call& fn);
-void netconnection_getpath(const fn_call& fn);
-#endif
 } // end of gnash namespace
 
 // __NETCONNECTION_H__
Index: gnash/testsuite/actionscript.all/NetConnection.as
diff -u gnash/testsuite/actionscript.all/NetConnection.as:1.2 
gnash/testsuite/actionscript.all/NetConnection.as:1.3
--- gnash/testsuite/actionscript.all/NetConnection.as:1.2       Sat Feb  4 
07:12:56 2006
+++ gnash/testsuite/actionscript.all/NetConnection.as   Sat Feb  4 21:24:07 2006
@@ -40,7 +40,13 @@
 
 // test the NetConnection::connect method
 tmp.connect();
-tmp.connect("rmtp://www.mediacollege.com/flash/media-player/testclip-4sec.flv");
+tmp.connect("rtmp://www.mediacollege.com/flash/media-player/testclip-4sec.flv");
+
+if (tmp.geturl) {
+       trace("PASSED: NetConnection::getURL() exists");
+} else {
+       trace("FAILED: NetConnection::getURL() doesn't exist");
+}
 
 // Check the see if the URL got parsed right
 var url = tmp.geturl();
@@ -48,8 +54,8 @@
 var host = tmp.gethost();
 var port = tmp.getport();
 var path = tmp.getpath();
-if (url == "rmtp://www.mediacollege.com/flash/media-player/testclip-4sec.flv"
-        && protocol == "rmtp"
+if (url == "rtmp://www.mediacollege.com/flash/media-player/testclip-4sec.flv"
+        && protocol == "rtmp"
         && host == "www.mediacollege.com"
         && path == "/flash/media-player/testclip-4sec.flv") {
        trace("PASSED: NetConnection::connect() initialized correctly");




reply via email to

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