@@ -37,179 +37,6 @@ describe("Tests garbage collection", function () {
3737 normalTest ( ) ;
3838 } ) ;
3939
40- // this test has implicit assert in com.tns.Runtime.getJavaObjectByID method
41- it ( "test1" , function ( ) {
42-
43- function createObjects ( name ) {
44- var c1 = new com . tns . tests . Class1 ( ) ;
45-
46- var cb1 = new com . tns . tests . Class1 . Callback1 ( name , {
47- getMessage : function ( ) {
48- var msg = c1 . getMessage ( ) ;
49- return msg ;
50- }
51- } ) ;
52-
53- return com . tns . tests . Class1 . Class2 . printMessageWithDelay ( cb1 , 5 * 1000 ) ;
54- }
55-
56- expect ( createObjects ( "Callback5" ) ) . toBe ( true ) ;
57- expect ( createObjects ( "Callback26" ) ) . toBe ( true ) ;
58-
59- gc ( ) ;
60- java . lang . System . gc ( ) ;
61- } ) ;
62-
63- // this test has implicit assert in com.tns.Runtime.getJavaObjectByID method
64- it ( "test2" , function ( ) {
65-
66- function indref1 ( ) {
67- this . class1 = new com . tns . tests . Class1 ( ) ;
68- }
69- indref1 . prototype . getMessage = function ( ) {
70- return "~~~" + this . class1 . getMessage ( ) ;
71- }
72-
73- function createObjects ( name ) {
74- var c1 = new indref1 ( ) ;
75-
76- var cb1 = new com . tns . tests . Class1 . Callback1 ( name , {
77- getMessage : function ( ) {
78- var msg = c1 . getMessage ( ) ;
79- return msg ;
80- }
81- } ) ;
82-
83- return com . tns . tests . Class1 . Class2 . printMessageWithDelay ( cb1 , 5 * 1000 ) ;
84- }
85-
86- expect ( createObjects ( "Callback55" ) ) . toBe ( true ) ;
87- expect ( createObjects ( "Callback56" ) ) . toBe ( true ) ;
88- gc ( ) ;
89- java . lang . System . gc ( ) ;
90- } ) ;
91-
92- // this test has implicit assert in com.tns.Runtime.getJavaObjectByID method
93- it ( "test3" , function ( ) {
94-
95- function indref2 ( ) {
96- this . helper = new indref2helper ( ) ;
97- }
98- indref2 . prototype . getMessage = function ( ) {
99- return "---" + this . helper . getMessage ( ) ;
100- }
101- function indref2helper ( ) {
102- this . class1 = new com . tns . tests . Class1 ( ) ;
103- }
104- indref2helper . prototype . getMessage = function ( ) {
105- return "***" + this . class1 . getMessage ( ) ;
106- }
107-
108- function createObjects ( name ) {
109- var c1 = new indref2 ( ) ;
110-
111- var cb1 = new com . tns . tests . Class1 . Callback1 ( name , {
112- getMessage : function ( ) {
113- var msg = c1 . getMessage ( ) ;
114- return msg ;
115- }
116- } ) ;
117-
118- return com . tns . tests . Class1 . Class2 . printMessageWithDelay ( cb1 , 5 * 1000 ) ;
119- }
120-
121- expect ( createObjects ( "Callback91" ) ) . toBe ( true ) ;
122- expect ( createObjects ( "Callback92" ) ) . toBe ( true ) ;
123- gc ( ) ;
124- java . lang . System . gc ( ) ;
125- } ) ;
126-
127- // this test has implicit assert in com.tns.Runtime.getJavaObjectByID method
128- it ( "test4" , function ( ) {
129-
130- function indref3 ( ) {
131- this . helper = new indref3helper ( ) ;
132- }
133- indref3 . prototype . getMessage = function ( ) {
134- return "+++" + this . helper . getMessage ( ) ;
135- }
136- function indref3helper ( ) {
137- this . _class1 = new com . tns . tests . Class1 ( ) ;
138-
139- Object . defineProperty ( this , "class1" , {
140- get : function ( ) {
141- return this . _class1
142- }
143- } ) ;
144- }
145- indref3helper . prototype . getMessage = function ( ) {
146- return "^^^" + this . class1 . getMessage ( ) ;
147- }
148-
149- function createObjects ( name ) {
150- var c1 = new indref3 ( ) ;
151-
152- var cb1 = new com . tns . tests . Class1 . Callback1 ( name , {
153- getMessage : function ( ) {
154- var msg = c1 . getMessage ( ) ;
155- return msg ;
156- }
157- } ) ;
158-
159- return com . tns . tests . Class1 . Class2 . printMessageWithDelay ( cb1 , 5 * 1000 ) ;
160- }
161-
162- expect ( createObjects ( "Callback1133" ) ) . toBe ( true ) ;
163- expect ( createObjects ( "Callback1134" ) ) . toBe ( true ) ;
164- gc ( ) ;
165- java . lang . System . gc ( ) ;
166- } ) ;
167-
168- // this test has implicit assert in com.tns.Runtime.getJavaObjectByID method
169- //originally test was commented out
170- xit ( "test5" , function ( ) {
171-
172- function indref4 ( ) {
173- this . helper = new indref4helper ( ) ;
174- }
175- indref4 . prototype . getMessage = function ( ) {
176- return "&&&" + this . helper . getMessageZZZ ( ) ;
177- }
178- function indref4helper ( ) {
179- var _class1 = new com . tns . tests . Class1 ( ) ;
180-
181- __log ( "indref4helper _class1=" + _class1 ) ;
182-
183- Object . defineProperty ( this , "class1" , {
184- get : function ( ) {
185- return _class1
186- }
187- , enumerable : false
188- } ) ;
189- }
190- indref4helper . prototype . getMessageZZZ = function ( ) {
191- return "```" + this . class1 . getMessage ( ) ;
192- }
193-
194- function createObjects ( name ) {
195- var c1 = new indref4 ( ) ;
196-
197- var cb1 = new com . tns . tests . Class1 . Callback1 ( name , {
198- getMessage : function ( ) {
199- var msg = c1 . getMessage ( ) ;
200- return msg ;
201- }
202- } ) ;
203-
204- return com . tns . tests . Class1 . Class2 . printMessageWithDelay ( cb1 , 5 * 1000 ) ;
205- }
206-
207- expect ( createObjects ( "Callback1178" ) ) . toBe ( true ) ;
208- expect ( createObjects ( "Callback1179" ) ) . toBe ( true ) ;
209- gc ( ) ;
210- java . lang . System . gc ( ) ;
211- } ) ;
212-
21340 it ( "testAccessingStringFieldWontLeak" , function ( ) {
21441
21542 __log ( "TEST: testAccessingStringFieldWontLeak" ) ;
@@ -241,52 +68,6 @@ describe("Tests garbage collection", function () {
24168 expect ( o . x ) . toBe ( 123 ) ;
24269 } ) ;
24370
244- it ( "should keep extended instances alive after GC" , function ( ) {
245- var C1 = com . tns . tests . Class1 . extend ( { } ) ;
246-
247- function createObjects ( name ) {
248- var c1 = new C1 ( ) ;
249-
250- var cb1 = new com . tns . tests . Class1 . Callback1 ( name , {
251- getMessage : function ( ) {
252- var msg = c1 . getMessage ( ) ;
253- return msg ;
254- }
255- } ) ;
256-
257- return com . tns . tests . Class1 . Class2 . printMessageWithDelay ( cb1 , 5 * 1000 ) ;
258- }
259-
260- expect ( createObjects ( "Callback452356" ) ) . toBe ( true ) ;
261- expect ( createObjects ( "Callback417892" ) ) . toBe ( true ) ;
262-
263- gc ( ) ;
264- java . lang . System . gc ( ) ;
265- } ) ;
266-
267- it ( "should keep array-enclosed objects alive after GC" , function ( ) {
268- function createObjects ( name ) {
269- var arr = new Array ( ) ;
270- arr . push ( new com . tns . tests . Class1 ( ) ) ;
271-
272- var cb1 = new com . tns . tests . Class1 . Callback1 ( name , {
273- getMessage : function ( ) {
274- var msg = arr [ 0 ] . getMessage ( ) ;
275- return msg ;
276- }
277- } ) ;
278-
279- return com . tns . tests . Class1 . Class2 . printMessageWithDelay ( cb1 , 2 * 1000 ) ;
280- }
281-
282- expect ( createObjects ( "Callback1" ) ) . toBe ( true ) ;
283- expect ( createObjects ( "Callback2" ) ) . toBe ( true ) ;
284- expect ( createObjects ( "Callback3" ) ) . toBe ( true ) ;
285-
286- gc ( ) ;
287- java . lang . System . gc ( ) ;
288- } )
289-
29071 it ( "should properly reintroduce Java object back in a callback" , function ( ) {
29172 function getTestObject ( ) {
29273 return new com . tns . tests . BadEqualsTest (
0 commit comments