20
20
// compile this test case with Ming makeswf, and then
21
21
// execute it like this gnash -1 -r 0 -v out.swf
23
rcsid="$Id: LocalConnection.as,v 1.18 2008/01/05 03:55:00 rsavoye Exp $";
24
// We need more than one frame to test the connection properly.
26
rcsid="$Id: LocalConnection.as,v 1.21 2008/05/05 15:26:38 bwy Exp $";
25
27
#include "check.as"
27
29
#if OUTPUT_VERSION < 6
29
31
check_equals(LocalConnection, undefined);
31
34
#else // OUTPUT_VERSION >= 6
33
var tmp = new LocalConnection;
36
xcheck (LocalConnection.prototype.hasOwnProperty("send"));
37
xcheck (LocalConnection.prototype.hasOwnProperty("connect"));
38
xcheck (LocalConnection.prototype.hasOwnProperty("close"));
39
xcheck (LocalConnection.prototype.hasOwnProperty("domain"));
40
check (! LocalConnection.prototype.hasOwnProperty("allowDomain"));
41
check (! LocalConnection.prototype.hasOwnProperty("onStatus"));
43
var rec = new LocalConnection();
35
45
// test the LocalConnection constuctor
36
check_equals (typeof(tmp), 'object');
46
check_equals (typeof(rec), 'object');
48
var snd = new LocalConnection();
50
// Not sure if this is a sensible test.
38
53
// test the LocalConnection::close method
39
check_equals (typeof(tmp.close), 'function');
54
check_equals (typeof(rec.close), 'function');
41
56
// test the LocalConnection::connect method
42
// FIXME: this should not be failing as later we find the function
44
xcheck_equals (typeof(tmp.connnect), 'function');
57
check_equals (typeof(rec.connect), 'function');
46
59
// test the LocalConnection::domain method
47
check_equals (typeof(tmp.domain), 'function');
60
check_equals (typeof(rec.domain), 'function');
49
62
// test the LocalConnection::send method
50
check_equals (typeof(tmp.send), 'function');
63
check_equals (typeof(rec.send), 'function');
52
65
// Get the domain. By default this should be "localhost" because we
53
66
// haven't made any connections yet,
54
var domain = tmp.domain();
67
var domain = rec.domain();
55
68
check_equals (domain, "localhost");
57
70
// If the listen() times out waiting for a connection, it'll set the
60
73
// could always (in a normal application) check later for incoming
64
var ret = tmp.connect("lc_test");
77
result = rec.connect("lc_test");
78
xcheck_equals (rec.domain(), "localhost");
66
80
// NOTE: This test will fail if a shared memory segment of the same
67
81
// name exists. So the first time it'll pass, then it'll fail.
68
check_equals (ret, true);
82
check_equals (result, true);
84
// Checks only for syntactical correctness, not success
85
result = snd.send("lc_test", "testfunc", "val");
86
xcheck_equals (result, true);
88
// The function name may not be send or any other LC property.
89
result = snd.send("lc_test", "send");
90
xcheck_equals (result, false);
91
result = snd.send("lc_test", "onStatus");
92
xcheck_equals (result, false);
93
// Numbers are also bad
94
result = snd.send("lc_test", 1);
95
xcheck_equals (result, false);
97
result = snd.send("lc_test", funcname);
98
xcheck_equals (result, false);
101
// But anything else is fine.
102
result = snd.send("lc_test", "getSeconds");
103
xcheck_equals (result, true);
104
funcname = "onFullScreen";
105
result = snd.send("lc_test", funcname);
106
xcheck_equals (result, true);
72
112
#endif // OUTPUT_VERSION >= 6