tests: Add avm2/sandbox_type_remote test
Verifies the sandbox type of SWFs loaded through network.
This commit is contained in:
parent
f77dddb6f5
commit
acdb355918
|
@ -0,0 +1,24 @@
|
|||
package {
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Loader;
|
||||
import flash.system.Security;
|
||||
import flash.net.URLRequest;
|
||||
|
||||
// Compile with network enabled
|
||||
public class Test extends MovieClip {
|
||||
public function Test() {
|
||||
trace("Current sandbox type: " + Security.sandboxType);
|
||||
|
||||
var test:Test = this;
|
||||
test.loadSwf("http://localhost:8000/test-network.swf", function():void {
|
||||
test.loadSwf("http://localhost:8000/test-no-network.swf", function():void {});
|
||||
});
|
||||
}
|
||||
|
||||
private function loadSwf(url:String, callback:Function):void {
|
||||
var loader:Loader = new Loader();
|
||||
loader.contentLoaderInfo.addEventListener("complete", callback);
|
||||
loader.load(new URLRequest(url));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package {
|
||||
import flash.display.Sprite;
|
||||
import flash.system.Security;
|
||||
|
||||
// Compile with network enabled as localhost/test-network.swf
|
||||
public class TestNetwork extends Sprite {
|
||||
public function TestNetwork() {
|
||||
trace("[Network] Current sandbox type: " + Security.sandboxType);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package {
|
||||
import flash.display.Sprite;
|
||||
import flash.system.Security;
|
||||
|
||||
// Compile with network disabled as localhost/test-no-network.swf
|
||||
public class TestNoNetwork extends Sprite {
|
||||
public function TestNoNetwork() {
|
||||
trace("[No network] Current sandbox type: " + Security.sandboxType);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Current sandbox type: localWithNetwork
|
||||
[Network] Current sandbox type: remote
|
||||
[No network] Current sandbox type: remote
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_ticks = 2
|
Loading…
Reference in New Issue