incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject svn commit: r1397677 - in /incubator/flex/sdk/branches/develop/mustella/as3/src/mustella: SendResultsToRunner.as UnitTester.as
Date Fri, 12 Oct 2012 18:40:13 GMT
Author: aharui
Date: Fri Oct 12 18:40:13 2012
New Revision: 1397677

URL: http://svn.apache.org/viewvc?rev=1397677&view=rev
Log:
Serialize the output to the Runner, wait for output to finish before closing test SWFs

Modified:
    incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/SendResultsToRunner.as
    incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/UnitTester.as

Modified: incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/SendResultsToRunner.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/SendResultsToRunner.as?rev=1397677&r1=1397676&r2=1397677&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/SendResultsToRunner.as (original)
+++ incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/SendResultsToRunner.as Fri
Oct 12 18:40:13 2012
@@ -49,8 +49,10 @@ public class SendResultsToRunner 
 
 	public static var regExp5:RegExp = /%3D/g;
 
+	public static var msgQueue:Array = [];
 
-
+	public static var u:URLLoader;
+	
 	/**
   	 * the way out for the result data
 	 */
@@ -126,39 +128,52 @@ public class SendResultsToRunner 
 		 * about the response, but for now, for debugging, using it
 		 */
 		if (!noSend) { 
-			trace ("sending: " + baseURL + midURL + final + " at: " + new Date());
 			// var u:String= baseURL + midURL + final;
-			var u:URLLoader = new URLLoader (new URLRequest (baseURL + midURL + final));
-
-			/*	
-			var sock:Socket = new Socket ("localhost",  UnitTester.runnerPort);
-			sock.writeUTFBytes(u);
-			sock.flush();
-			sock.flush();
-			*/
-		
-			u.addEventListener("complete", completeHandler);
-			u.addEventListener("complete", httpEvents);
-			u.addEventListener("ioError", httpEvents);
-			u.addEventListener("open", httpEvents);
-			u.addEventListener("progress", httpEvents);
-			u.addEventListener("httpStatus", httpEvents);
-			u.addEventListener("securityError", httpEvents);
-			u.load (new URLRequest (baseURL + midURL + final));
+			if (!u)
+			{
+				u = new URLLoader ();
+
+				/*	
+				var sock:Socket = new Socket ("localhost",  UnitTester.runnerPort);
+				sock.writeUTFBytes(u);
+				sock.flush();
+				sock.flush();
+				*/
+			
+				u.addEventListener("complete", completeHandler);
+				u.addEventListener("complete", httpEvents);
+				u.addEventListener("ioError", httpEvents);
+				u.addEventListener("open", httpEvents);
+				u.addEventListener("progress", httpEvents);
+				u.addEventListener("httpStatus", httpEvents);
+				u.addEventListener("securityError", httpEvents);
+			}
+			queueMsg(baseURL + midURL + final);
 			UnitTester.pendingOutput++;
-			dict[u] = baseURL + midURL + final;
 		}
+	}
 
-		
-
+	public static function queueMsg(s:String):void
+	{
+		msgQueue.push(s);
+		if (msgQueue.length == 1)
+		{
+			trace ("sending: " + s + " at: " + new Date());
+			u.load (new URLRequest (s));
+		}
+		else
+			trace ("queuing: " + s + " at: " + new Date());
 	}
 	
-	public static var dict:Dictionary = new Dictionary();
-
 	public static function completeHandler (e:Event):void  {
 		UnitTester.pendingOutput--;
-		//trace("received complete for", dict[e.target]);
-		delete dict[e.target];
+		msgQueue.shift();
+		if (msgQueue.length > 0)
+		{
+			var s:String = msgQueue[0];
+			u.load (new URLRequest (s));
+			trace ("sending: " + s + " at: " + new Date());
+		}
 	}
 
 	public static function httpEvents (e:Event):void  {

Modified: incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/UnitTester.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/UnitTester.as?rev=1397677&r1=1397676&r2=1397677&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/UnitTester.as (original)
+++ incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/UnitTester.as Fri Oct 12
18:40:13 2012
@@ -1179,11 +1179,23 @@ public class UnitTester extends EventDis
 	{
 		if (pendingOutput > 0)
 		{
-			if (frameWaitCount < 4) // wait about 3 frames to see if results come back
+			if (lastPendingOutput == 0)
+				lastPendingOutput = pendingOutput;
+			if (pendingOutput == lastPendingOutput)
+			{
+				if (frameWaitCount < 4) // wait about 3 frames to see if results come back
+				{
+					trace("waiting on pending output", pendingOutput);
+					frameWaitCount++;
+					callback = cleanUpAndExit;
+					return;
+				}
+			}
+			else
 			{
-				trace("waiting on pending output", pendingOutput);
+				lastPendingOutput = pendingOutput;
+				frameWaitCount = 0;
 				callback = cleanUpAndExit;
-				frameWaitCount++;
 				return;
 			}
 		}
@@ -1228,6 +1240,7 @@ public class UnitTester extends EventDis
 	}
 	
 	public static var pendingOutput:int = 0;
+	public static var lastPendingOutput:int = 0;
 	public static var frameWaitCount:int = 0;
 	
 	private static var frameCounter:int = 0;



Mime
View raw message