Sha256: c636a76417fbf9248ebd8b6490f4d820ff99da78e15c8a6a78f548f76d6717c5

Contents?: true

Size: 1.71 KB

Versions: 28

Compression:

Stored size: 1.71 KB

Contents

package asunit.framework {
	import flash.net.URLRequest;
	import flash.net.URLLoader;
	import flash.events.*;
	import flash.errors.IllegalOperationError;

	/**
	 * Extend this class if you have a TestCase that requires the
	 * asynchronous load of external data.
	 */
	public class AsynchronousTestCase extends TestCase {
		
		public function AsynchronousTestCase(testMethod:String = null) {
			super(testMethod);
		}

		protected function configureListeners(loader:URLLoader):void {
			loader.addEventListener(Event.COMPLETE, completeHandler);
			loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
			loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
			loader.addEventListener(Event.OPEN, openHandler);
			loader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
			loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
		}

		// override this method and implement your own completeHandler
		// you should be sure to call super.run() from the body of
		// this override.
		protected function completeHandler(event:Event):void {
		}

		// TODO: add support for failing status events...
		protected function httpStatusHandler(event:HTTPStatusEvent):void {
		}

		protected function ioErrorHandler(event:IOErrorEvent):void {
			result.addError(this, new IllegalOperationError(event.toString()));
			isComplete = true;
		}

		protected function openHandler(event:Event):void {
		}

		protected function progressHandler(event:ProgressEvent):void {
		}

		protected function securityErrorHandler(event:SecurityErrorEvent):void {
			result.addError(this, new IllegalOperationError(event.toString()));
			isComplete = true;
		}
	}
}

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
asproject-0.1.21 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.27 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.28 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.29 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.30 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.31 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.34 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.36 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.37 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.32 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.33 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.35 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.41 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.44 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.43 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.42 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.38 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.40 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.68 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as
asproject-0.1.60 templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as