~ubuntu-branches/ubuntu/karmic/gnash/karmic

« back to all changes in this revision

Viewing changes to testsuite/misc-haxe.all/classes.all/system/Security_as.hx

  • Committer: Bazaar Package Importer
  • Author(s): Sindhudweep Narayan Sarkar
  • Date: 2009-10-07 00:06:10 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20091007000610-mj9rwqe774gizn1j
Tags: 0.8.6-0ubuntu1
new upstream release 0.8.6 (LP: #435897)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Security_as3.hx:  ActionScript 3 "Security" class, for Gnash.
 
2
//
 
3
// Generated by gen-as3.sh on: 20090514 by "rob". Remove this
 
4
// after any hand editing loosing changes.
 
5
//
 
6
//   Copyright (C) 2009 Free Software Foundation, Inc.
 
7
//
 
8
// This program is free software; you can redistribute it and/or modify
 
9
// it under the terms of the GNU General Public License as published by
 
10
// the Free Software Foundation; either version 3 of the License, or
 
11
// (at your option) any later version.
 
12
//
 
13
// This program is distributed in the hope that it will be useful,
 
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
// GNU General Public License for more details.
 
17
//
 
18
// You should have received a copy of the GNU General Public License
 
19
// along with this program; if not, write to the Free Software
 
20
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
21
//
 
22
 
 
23
// This test case must be processed by CPP before compiling to include the
 
24
//  DejaGnu.hx header file for the testing framework support.
 
25
 
 
26
#if flash9
 
27
import flash.display.MovieClip;
 
28
#else
 
29
import flash.MovieClip;
 
30
#end
 
31
 
 
32
import flash.Lib;
 
33
import Type;
 
34
 
 
35
//Si: Modified
 
36
import Std;
 
37
import flash.system.Security;
 
38
 
 
39
// import our testing API
 
40
import DejaGnu;
 
41
 
 
42
// Class must be named with the _as3 suffix, as that's the same name as the file.
 
43
class Security_as {
 
44
 
 
45
        static var undef = untyped __global__["undefined"];
 
46
 
 
47
    static function main() {
 
48
 
 
49
        // Make sure we actually get a valid class        
 
50
        if (Type.typeof(Security)==TObject) {
 
51
            DejaGnu.pass("Security class exists");
 
52
        } else {
 
53
            DejaGnu.fail("Security class doesn't exist");
 
54
        }
 
55
// Tests to see if all the properties exist. All these do is test for
 
56
// existance of a property, and don't test the functionality at all. This
 
57
// is primarily useful only to test completeness of the API implementation.
 
58
 
 
59
// Test exactSettings
 
60
// For all versions
 
61
 
 
62
#if flash9
 
63
        if (Type.typeof(Security.exactSettings) == TBool) {
 
64
            DejaGnu.pass("Security.exactSettings property exists");
 
65
        } else {
 
66
            DejaGnu.fail("Security.exactSettings property doesn't exist");
 
67
        }
 
68
#end
 
69
 
 
70
#if flash8
 
71
        // For pp, Security.sandboxType returns a string, hence the xfail 
 
72
        // when run in the pp
 
73
        if (Type.typeof(Security.sandboxType) == ValueType.TNull) {
 
74
            DejaGnu.pass("Security.sandboxType property exists");
 
75
        } else {
 
76
            DejaGnu.xfail("Security.sandboxType property doesn't exist");
 
77
        }
 
78
#end
 
79
 
 
80
#if flash9
 
81
        if (Std.is(Security.sandboxType, String) ) {
 
82
            DejaGnu.pass("Security.sandboxType property exists");
 
83
        } else {
 
84
            DejaGnu.fail("Security.sandboxType property doesn't exist");
 
85
        }
 
86
#end
 
87
 
 
88
// Tests to see if all the methods exist. All these do is test for
 
89
// existance of a method, and don't test the functionality at all. This
 
90
// is primarily useful only to test completeness of the API implementation.
 
91
        
 
92
 
 
93
        if (Type.typeof(Security.allowDomain) == TFunction) {
 
94
            DejaGnu.pass("Security::allowDomain() method exists");
 
95
        } else {
 
96
            DejaGnu.fail("Security::allowDomain() method doesn't exist");
 
97
        }
 
98
    var ret = Security.allowDomain("cnn.com");
 
99
 
 
100
#if !flash6
 
101
        if (Type.typeof(Security.allowInsecureDomain) == TFunction) {
 
102
            DejaGnu.pass("Security::allowInsecureDomain() method exists");
 
103
        } else {
 
104
            DejaGnu.fail("Security::allowInsecureDomain() method doesn't exist");
 
105
        }
 
106
#end
 
107
        if (Type.typeof(Security.loadPolicyFile) == TFunction) {
 
108
            DejaGnu.pass("Security::loadPolicyFile() method exists");
 
109
        } else {
 
110
            DejaGnu.fail("Security::loadPolicyFile() method doesn't exist");
 
111
        }
 
112
 
 
113
#if flash9
 
114
        if (Type.typeof(Security.showSettings)==TFunction) {
 
115
            DejaGnu.pass("Security::showSettings() method exists");
 
116
        } else {
 
117
            DejaGnu.fail("Security::showSettings() method doesn't exist");
 
118
        }
 
119
#end
 
120
 
 
121
// AIR only
 
122
//      if (Security.APPLICATION == null) {
 
123
//          DejaGnu.pass("Security::APPLICATION() method exists");
 
124
//      } else {
 
125
//          DejaGnu.fail("Security::APPLICATION() method doesn't exist");
 
126
//      }
 
127
 
 
128
#if flash9
 
129
        if (Std.is(Security.LOCAL_TRUSTED,String) ) {
 
130
            DejaGnu.pass("Security::LOCAL_TRUSTED() property exists");
 
131
        } else {
 
132
            DejaGnu.fail("Security::LOCAL_TRUSTED() property doesn't exist");
 
133
        }
 
134
        if (Std.is(Security.LOCAL_WITH_FILE,String) ) {
 
135
            DejaGnu.pass("Security::LOCAL_WITH_FILE() property exists");
 
136
        } else {
 
137
            DejaGnu.fail("Security::LOCAL_WITH_FILE() method doesn't exist");
 
138
        }
 
139
        if (Std.is(Security.LOCAL_WITH_NETWORK,String) ) {
 
140
            DejaGnu.pass("Security::LOCAL_WITH_NETWORK() property exists");
 
141
        } else {
 
142
            DejaGnu.fail("Security::LOCAL_WITH_NETWORK() property doesn't exist");
 
143
        }
 
144
        if (Std.is(Security.REMOTE,String)) {
 
145
            DejaGnu.pass("Security::REMOTE() property exists");
 
146
        } else {
 
147
            DejaGnu.fail("Security::REMOTE() property doesn't exist");
 
148
        }
 
149
        if (Type.typeof(Security.disableAVM1Loading) == TBool ){
 
150
            DejaGnu.pass("Security::disableAVM1Loading property xists");
 
151
        } else {
 
152
            DejaGnu.fail("Security::disableAVM1Loading property doesn't exist");
 
153
        }
 
154
#end
 
155
        // Call this after finishing all tests. It prints out the totals.
 
156
        DejaGnu.done();
 
157
    }
 
158
}
 
159
 
 
160
// local Variables:
 
161
// mode: C++
 
162
// indent-tabs-mode: t
 
163
// End:
 
164