| 1 | package { |
|---|
| 2 | import com.longtailvideo.jwplayer.utils.RootReference; |
|---|
| 3 | |
|---|
| 4 | import flash.system.System; |
|---|
| 5 | |
|---|
| 6 | import org.flexunit.flexui.TestRunnerBase; |
|---|
| 7 | import org.flexunit.listeners.UIListener; |
|---|
| 8 | import org.flexunit.runner.FlexUnitCore; |
|---|
| 9 | import org.flexunit.runner.notification.async.XMLListener; |
|---|
| 10 | |
|---|
| 11 | /** |
|---|
| 12 | * The test launcher sets up the FlexUnit enviroment for testing, adds the test suites, and |
|---|
| 13 | * creates the ResultPrinter. |
|---|
| 14 | * |
|---|
| 15 | * @author zach@longtailvideo.com |
|---|
| 16 | * @date 2009-08-18 |
|---|
| 17 | */ |
|---|
| 18 | public class PlayerTestLauncher { |
|---|
| 19 | private var visualRunner:TestRunnerBase; |
|---|
| 20 | private var core:FlexUnitCore; |
|---|
| 21 | |
|---|
| 22 | public function PlayerTestLauncher(visualRunner:TestRunnerBase) { |
|---|
| 23 | try { |
|---|
| 24 | core = new FlexUnitCore(); |
|---|
| 25 | if (visualRunner) { |
|---|
| 26 | this.visualRunner = visualRunner; |
|---|
| 27 | core.addListener(new UIListener(visualRunner)); |
|---|
| 28 | } |
|---|
| 29 | core.addListener(new XMLListener("Astaire")); |
|---|
| 30 | core.addListener(new PlayerTestRunListener(this, new PlayerTestResultPrinter())); |
|---|
| 31 | core.run(PlayerTestSuite); |
|---|
| 32 | } catch (err:Error){ |
|---|
| 33 | trace (err); |
|---|
| 34 | } |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | /** |
|---|
| 38 | * Terminates the Air Debug Launcher, with an appropriate status code, when testing is done. |
|---|
| 39 | * @param status The appropriate exit code. |
|---|
| 40 | */ |
|---|
| 41 | public function complete(status:Number):void { |
|---|
| 42 | if (RootReference.root.loaderInfo.url.indexOf("Windowless.swf") >=0) { |
|---|
| 43 | flash.system.System.exit(status); |
|---|
| 44 | } |
|---|
| 45 | } |
|---|
| 46 | } |
|---|
| 47 | } |
|---|