2 #include "../actionscript.all/check.as"
5 xmlArray
[0] = 'Plain text';
6 xmlArray
[1] = 'Plain *NEWLINE* text';
7 xmlArray
[2] = 'Plain *NULL* text';
8 xmlArray
[3] = 'Plain *NULL**NEWLINE* text';
9 xmlArray
[4] = '<xml>Some XML</xml>';
10 xmlArray
[5] = '<xml>Some XML*NEWLINE*</xml>';
11 xmlArray
[6] = '<xml>Some XML*NULL*</xml>';
12 xmlArray
[7] = '<xml>Some XML*NEWLINE**NULL*</xml>';
13 xmlArray
[8] = undefined;
17 for (i
= 0; i
< 250; ++i
) {
18 a
+= "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // 60
21 xmlArray
[12] = 'Last Item';
22 xmlArray
[13] = 'closeNow';
25 expectedArray
= new Array();
26 expectedArray
[0] = 'Plain text';
27 expectedArray
[1] = 'Plain \n text';
28 expectedArray
[2] = 'Plain ';
29 expectedArray
[3] = ' text';
30 expectedArray
[4] = 'Plain ';
31 expectedArray
[5] = '\n text';
32 expectedArray
[6] = '<xml>Some XML</xml>';
33 expectedArray
[7] = '<xml>Some XML\n</xml>';
34 expectedArray
[8] = '<xml>Some XML';
35 expectedArray
[9] = '</xml>';
36 expectedArray
[10] = '<xml>Some XML\n';
37 expectedArray
[11] = '</xml>';
38 expectedArray
[12] = 'undefined';
39 expectedArray
[13] = 9;
40 expectedArray
[14] = '';
41 // Don't check 15 (we'll only check length)
42 expectedArray
[16] = 'Last Item';
51 function handleConnect
(connectionStatus
) {
52 check_equals
(connectionStatus
, true);
53 if (connectionStatus
) {
56 if (gc
< xmlArray
.length
) {
57 myXML
.send
(xmlArray
[gc
++]);
60 else { trace
('Initial connection failed!'); }
63 // Store data and send next lot.
64 function handleData
(data
) {
65 receivedArray
.push
(data
);
66 myXML
.send
(xmlArray
[gc
++]);
69 function handleDisconnect
() {
70 trace
('Connection lost.');
74 myXML
= new XMLSocket;
75 myXML
.onConnect
= handleConnect
;
76 myXML
.onData
= handleData
;
77 myXML
.onClose
= handleDisconnect
;
78 receivedArray
= new Array();
80 ret
= myXML
.connect
("localhost", 2229);
81 check_equals
(ret
, true);
85 function checkResults
() {
87 check_equals
(receivedArray
[0], expectedArray
[0]);
88 check_equals
(receivedArray
[1], expectedArray
[1]);
89 check_equals
(receivedArray
[2], expectedArray
[2]);
90 check_equals
(receivedArray
[3], expectedArray
[3]);
91 check_equals
(receivedArray
[4], expectedArray
[4]);
92 check_equals
(receivedArray
[5], expectedArray
[5]);
93 check_equals
(receivedArray
[6], expectedArray
[6]);
94 check_equals
(receivedArray
[7], expectedArray
[7]);
95 check_equals
(receivedArray
[8], expectedArray
[8]);
96 check_equals
(receivedArray
[9], expectedArray
[9]);
97 check_equals
(receivedArray
[10], expectedArray
[10]);
98 check_equals
(receivedArray
[11], expectedArray
[11]);
99 check_equals
(receivedArray
[12], expectedArray
[12]);
100 check_equals
(receivedArray
[13], expectedArray
[13]);
101 check_equals
(receivedArray
[14], expectedArray
[14]);
102 check_equals
(receivedArray
[15].length
, 15000);
103 check_equals
(receivedArray
[15].charAt
(0), 'a');
104 check_equals
(receivedArray
[16], expectedArray
[16]);
108 loadMovie
("FSCommand:quit", "");