0

I want to test air applications and air libraries using flexmojos 3.9-SNAPSHOT. However, although flexmojos does indeed has support for air, it tries to run the swf generated by the build using flash player, and as I need to use air native libraries I wanted to run the tests using adl (AIR debug launcher).

To do this, I cloned flexmojos in github.com to this repository (http://github.com/mi007/flexmojos). I then created a class that created an -app.xml for the TestRunner.swf file that was generated and ran: adl TestRunner-app.xml

However, before the Test ends, it should call the server in the port 13540 to report something. When that happens, I'm getting the following error:

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: app:/TestRunner.swf cannot load data from 127.0.0.1:13540.
at org.sonatype.flexmojos.unitestingsupport::ControlSocket/connect()[/Users/rafael/p2d/others/flexmojos/flexmojos-testing/flexmojos-unittest-support/src/main/flex/org/sonatype/flexmojos/unitestingsupport/ControlSocket.as:46]
at org.sonatype.flexmojos.unitestingsupport::TestApplication/runTests()[/Users/rafael/p2d/others/flexmojos/flexmojos-testing/flexmojos-unittest-support/src/main/flex/org/sonatype/flexmojos/unitestingsupport/TestApplication.as:52]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:9408]
at mx.core::UIComponent/set initialized()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8733]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8673]

I know that it is calling the server before in port 13539 successfully, because it prints the test results on the console. I also know that it is opening port 13540 because I was able to telnet to it. However, for some reason it is unable to connect from the air application.

Given the circunstances, I have the following questions:

1) Is there any good documentation that I can read to understand how this security framework works? The only documentation that I found was terribly confusing.

2) Does anyone has any ideas or hints about what might be happening?

3) I have read somewhere that flexmojos hacks the security framework so that flex applications can open a socket to localhost without problems during tests. Is there any documentation about how this is done?

Thanks,

razlebe
  • 7,134
  • 6
  • 42
  • 57
Rafael
  • 2,373
  • 4
  • 22
  • 28
  • Ok, found something maybe useful. When flexmojos run a flex applications tests, it puts the TestRunner.swf in the ~/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust so that the application can initiate the socket, and thus everything works. However, when I run the application using adl ~/workspace/project/target/test-classes/something-app.adl it doesn't work anymore. – Rafael Oct 20 '10 at 13:38

1 Answers1

0

You've got very close to the answer in your comment...

You need to add a line to a file in ~/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust yourself, covering the swf you want to run. You can do this by hand directly (all files in that folder will be processed) or by using the Flash Player Settings Manager.

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95