incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject svn commit: r1389953 - in /incubator/flex/sdk/branches/develop/mustella/as3/src/mustella: SendResultsToRunner.as UnitTester.as
Date Tue, 25 Sep 2012 16:06:41 GMT
Author: aharui
Date: Tue Sep 25 16:06:40 2012
New Revision: 1389953

URL: http://svn.apache.org/viewvc?rev=1389953&view=rev
Log:
More changes to try to prevent loss of output.  The Runner can kill the process pretty quickly
after ScriptComplete is sent, so wait a few frames to see if all other responses have come
back.  Also, use a dictionary to try to make sure URLLoaders don't accidentally get GC'd.

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=1389953&r1=1389952&r2=1389953&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 Tue
Sep 25 16:06:40 2012
@@ -20,6 +20,7 @@ package {
 
 import flash.display.DisplayObject;
 import flash.net.*;
+import flash.utils.*;
 import flash.events.Event;
 
 
@@ -145,14 +146,19 @@ public class SendResultsToRunner 
 			u.addEventListener("securityError", httpEvents);
 			u.load (new URLRequest (baseURL + midURL + final));
 			UnitTester.pendingOutput++;
+			dict[u] = baseURL + midURL + final;
 		}
 
 		
 
 	}
+	
+	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];
 	}
 
 	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=1389953&r1=1389952&r2=1389953&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 Tue Sep 25
16:06:40 2012
@@ -1172,6 +1172,22 @@ public class UnitTester extends EventDis
 	 */
 	private static function scriptsCompleteHandler(event:Event):void
 	{
+		cleanUpAndExit();
+	}
+	
+	private static function cleanUpAndExit():void
+	{
+		if (pendingOutput > 0)
+		{
+			if (frameWaitCount < 4) // wait about 3 frames to see if results come back
+			{
+				trace("waiting on pending output", pendingOutput);
+				callback = cleanUpAndExit;
+				frameWaitCount++;
+				return;
+			}
+		}
+
 		var allDone:Boolean = true;
 		var n:int = scripts.length;
 		for (var i:int = 0; i < n; i++)
@@ -1207,32 +1223,13 @@ public class UnitTester extends EventDis
 
 		if (exitWhenDone) 
 		{
-			callback = waitForOutput;
+			setTimeout(exit, UnitTester.coverageTimeout);				
 		}
 	}
 	
 	public static var pendingOutput:int = 0;
 	public static var frameWaitCount:int = 0;
 	
-	private static function waitForOutput():void
-	{
-		if (pendingOutput > 0)
-		{
-			if (frameWaitCount > 3) // wait about 3 frames to see if results come back
-			{
-				setTimeout(exit, UnitTester.coverageTimeout);				
-			}
-			else
-			{
-				trace("waiting on pending output", pendingOutput);
-				callback = waitForOutput;
-				frameWaitCount++;
-			}
-		}
-		else
-			setTimeout(exit, UnitTester.coverageTimeout);
-	}
-
 	private static var frameCounter:int = 0;
 
 	/**



Mime
View raw message