[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10437: Improved remoting test to al
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10437: Improved remoting test to also check number of connections engaged. |
Date: |
Mon, 15 Dec 2008 13:01:11 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10437
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Mon 2008-12-15 13:01:11 +0100
message:
Improved remoting test to also check number of connections engaged.
Gnash passes those!
modified:
testsuite/misc-ming.all/remoting.as
testsuite/misc-ming.all/remoting.php
=== modified file 'testsuite/misc-ming.all/remoting.as'
--- a/testsuite/misc-ming.all/remoting.as 2008-12-15 10:43:12 +0000
+++ b/testsuite/misc-ming.all/remoting.as 2008-12-15 12:01:11 +0000
@@ -24,7 +24,7 @@
endOfTest = function()
{
//note("END OF TEST");
- check_totals(60);
+ check_totals(74);
};
@@ -37,9 +37,10 @@
stop();
printInfo = function(result) {
+ note("remote_port: " + result['remote_port']);
note("request_id: " + result['request_id']);
note("message: " + result['message']);
- note("type: " + result['type']);
+ note("arg1_type: " + result['arg1_type']);
note("hex: " + result['hex']);
//trace(result['message']);
};
@@ -65,9 +66,10 @@
nc.call("ary_123", o, ary1); // 31
o.onResult = function(res) {
//note(printInfo(res));
+ connectionPort=res.remote_port;
check_equals(res.request_id, '/1');
check_equals(res.message, 'ary_123');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:00:03:00:3f:f0:00:00:00:00:00:00:00:40:00:00:00:00:00:00:00:00:40:08:00:00:00:00:00:00');
test2();
};
@@ -80,70 +82,62 @@
nc.call("ary_123custom", o, ary2); // 32
o.onResult = function(res) {
//note(printInfo(res));
+ check(res.remote_port != connectionPort);
+ connectionPort = res.remote_port;
check_equals(res.request_id, '/2');
check_equals(res.message, 'ary_123custom');
- check_equals(res.type, 'ECMA_ARRAY');
+ check_equals(res.arg1_type, 'ECMA_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:08:00:00:00:03:00:01:30:00:3f:f0:00:00:00:00:00:00:00:01:31:00:40:00:00:00:00:00:00:00:00:01:32:00:40:08:00:00:00:00:00:00:00:06:63:75:73:74:6f:6d:02:00:06:63:75:73:74:6f:6d:00:00:09');
- test3();
};
-}
-function test3()
-{
o={onStatus:handleOnStatus};
ary3=[1,2,3]; ary3.length=255;
nc.call("ary_123length255", o, ary3); // 33
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/3');
check_equals(res.message, 'ary_123length255');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:00:ff:00:3f:f0:00:00:00:00:00:00:00:40:00:00:00:00:00:00:00:00:40:08:00:00:00:00:00:00:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06');
- test4();
};
-}
-function test4()
-{
o={onStatus:handleOnStatus};
ary4=[]; ary4[3]=3;
nc.call("ary__3", o, ary4); // 34
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/4');
check_equals(res.message, 'ary__3');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:00:04:06:06:06:00:40:08:00:00:00:00:00:00');
test5();
};
-}
-function test5()
-{
o={onStatus:handleOnStatus};
ary5=[]; ary5['3']=3;
nc.call("ary_s3", o, ary5); // 35
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/5');
check_equals(res.message, 'ary_s3');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:00:04:06:06:06:00:40:08:00:00:00:00:00:00');
test6();
};
-}
-function test6()
-{
o={onStatus:handleOnStatus};
ary6=['0','0','0'];
ary6.custom='custom'; AsSetPropFlags(ary6, 'custom', 1); // hide from
enumeration
nc.call("ary_000_assetpropflags", o, ary6); // 36
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/6');
check_equals(res.message, 'ary_000_assetpropflags');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:00:03:02:00:01:30:02:00:01:30:02:00:01:30');
test7();
};
@@ -156,101 +150,86 @@
nc.call("ary_float", o, ary7); // 37
o.onResult = function(res) {
//note(printInfo(res));
+ check(res.remote_port != connectionPort);
+ connectionPort = res.remote_port;
check_equals(res.request_id, '/7');
check_equals(res.message, 'ary_float');
- check_equals(res.type, 'ECMA_ARRAY');
+ check_equals(res.arg1_type, 'ECMA_ARRAY');
// The bug here is that gnash encodes 0 as the length of the array
while
// the expected behaviour is to encode 3.
xcheck_equals(res.hex,
'0a:00:00:00:01:08:00:00:00:03:00:03:32:2e:35:00:3f:f0:00:00:00:00:00:00:00:00:09');
- test8();
};
-}
-function test8()
-{
o={onStatus:handleOnStatus};
ary8=[]; ary8['256']=1;
nc.call("ary_s256", o, ary8); // 38
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/8');
check_equals(res.message, 'ary_s256');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:01:01:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:06:00:3f:f0:00:00:00:00:00:00');
- test9();
};
-}
-function test9()
-{
o={onStatus:handleOnStatus};
ary9=[]; ary9['-1']=1;
nc.call("ary_sminus1", o, ary9); // 39
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/9');
check_equals(res.message, 'ary_sminus1');
- check_equals(res.type, 'ECMA_ARRAY');
+ check_equals(res.arg1_type, 'ECMA_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:08:00:00:00:00:00:02:2d:31:00:3f:f0:00:00:00:00:00:00:00:00:09');
- test10();
};
-}
-function test10()
-{
o={onStatus:handleOnStatus};
ary10=[]; ary10[-1]=1; // ECMA
nc.call("ary_minus1", o, ary10);
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/10');
check_equals(res.message, 'ary_minus1');
- check_equals(res.type, 'ECMA_ARRAY');
+ check_equals(res.arg1_type, 'ECMA_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:08:00:00:00:00:00:02:2d:31:00:3f:f0:00:00:00:00:00:00:00:00:09');
test11();
};
-}
-function test11()
-{
o={onStatus:handleOnStatus};
ary11=['a','b','c']; // STRICT
nc.call("ary_abc", o, ary11); //
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/11');
check_equals(res.message, 'ary_abc');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:00:03:02:00:01:61:02:00:01:62:02:00:01:63');
- test12();
};
-}
-function test12()
-{
o={onStatus:handleOnStatus};
ary12=[]; ary12['']=1;
nc.call("ary_emptypropname", o, ary12); //
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/12');
check_equals(res.message, 'ary_emptypropname');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex, '0a:00:00:00:01:0a:00:00:00:00');
- test13();
};
-}
-function test13()
-{
o={onStatus:handleOnStatus};
ary13=[]; ary13[1] = ary11;
nc.call("ary_nested", o, ary13); //
o.onResult = function(res) {
//note(printInfo(res));
+ check_equals(res.remote_port, connectionPort);
check_equals(res.request_id, '/13');
check_equals(res.message, 'ary_nested');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex,
'0a:00:00:00:01:0a:00:00:00:02:06:0a:00:00:00:03:02:00:01:61:02:00:01:62:02:00:01:63');
test14();
};
@@ -258,7 +237,7 @@
function test14()
{
- note('Connecting to: '+url+' (pass "url" param to change)');
+ note('Connecting again to: '+url);
nc.connect(url); // reconnect, should reset call id
o={onStatus:handleOnStatus};
@@ -266,9 +245,11 @@
nc.call("ary_newconnect", o, ary13); //
o.onResult = function(res) {
//note(printInfo(res));
+ check(res.remote_port != connectionPort);
+ connectionPort = res.remote_port;
xcheck_equals(res.request_id, '/1'); // connection is reset
check_equals(res.message, 'ary_newconnect');
- check_equals(res.type, 'STRICT_ARRAY');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
check_equals(res.hex, '0a:00:00:00:01:0a:00:00:00:00');
onEnterFrame = test15;
};
@@ -276,27 +257,29 @@
function test15()
{
- delete onEnterFrame;
-
- o={onStatus:handleOnStatus};
- ary13=[];
- nc.call("ary_newconnect", o, ary13); //
- o.onResult = function(res) {
- //note(printInfo(res));
-
- // connection ID is NOT reset if the call happens
- // on next frame
- xcheck_equals(res.request_id, '/2');
- check_equals(res.message, 'ary_newconnect');
- check_equals(res.type, 'STRICT_ARRAY');
- check_equals(res.hex, '0a:00:00:00:01:0a:00:00:00:00');
- test16();
- };
+ delete onEnterFrame;
+
+ o={onStatus:handleOnStatus};
+ ary13=[];
+ nc.call("ary_newconnect", o, ary13); //
+ o.onResult = function(res) {
+ //note(printInfo(res));
+
+ // connection ID is NOT reset if the call happens
+ // on next frame
+ check(res.remote_port != connectionPort);
+ connectionPort = res.remote_port;
+ xcheck_equals(res.request_id, '/2');
+ check_equals(res.message, 'ary_newconnect');
+ check_equals(res.arg1_type, 'STRICT_ARRAY');
+ check_equals(res.hex, '0a:00:00:00:01:0a:00:00:00:00');
+ test16();
+ };
}
function test16()
{
- endOfTest();
+ endOfTest();
}
=== modified file 'testsuite/misc-ming.all/remoting.php'
--- a/testsuite/misc-ming.all/remoting.php 2008-12-14 23:31:33 +0000
+++ b/testsuite/misc-ming.all/remoting.php 2008-12-15 12:01:11 +0000
@@ -1,5 +1,18 @@
<?php
+class o_amf_val {
+ var $data;
+ var $type;
+ function o_amf_val($data, $type) {
+ $this->data = $data;
+ $this->type = $type;
+ }
+}
+function raw($amf) {
+ return new o_amf_val($amf, 'raw');
+}
+
+
# read a network short i bytes into amf
function get_short($amf, $i) {
return (ord($amf[$i]) << 8) | ord($amf[$i + 1]);
@@ -35,7 +48,7 @@
# pass: name of remote procedure, AMF encoded args
# returns: string
-function amf_1st_arg_type($message_name, $amf) {
+function arg1_type($amf) {
if(ord($amf[0]) != 0x0a) {
return "couldn't find args";
} else {
@@ -70,12 +83,18 @@
}
}
-function raw_rpc_to_array($request_id, $message_name, $amf) {
+function raw_rpc_to_array($amf, $extras) {
$ret = array();
- $ret['type'] = amf_1st_arg_type($message_name, $amf);
+ #phpinfo();
+ $ret['remote_port'] = $_SERVER['REMOTE_PORT'];
+ $ret['arg1_type'] = arg1_type($amf);
+ $ret['type'] = $ret['arg1_type']; # depricated. used arg1_type
$ret['hex'] = hexify($amf);
- $ret['message'] = $message_name;
- $ret['request_id'] = $request_id;
+ $ret['message'] = $extras['message_name'];
+ $ret['request_id'] = $extras['request_id'];
+ if(isset($extras['unsent'])) {
+ $ret['unsent'] = $extras['unsent'];
+ }
return $ret;
}
@@ -94,6 +113,8 @@
function make_val($val) {
if(is_array($val)) {
return chr(0x08) . make_ecma($val);
+ } elseif(is_object($val) && $val->type == 'raw') {
+ return $val->data;
} else {
return chr(0x02) . make_string($val);
}
@@ -101,11 +122,9 @@
# pass: name of remote procedure, AMF encoded args
# returns: amf reply
-function raw_rpc($request_id, $message_name, $amf) {
- $ret = '';
- $ary = raw_rpc_to_array($request_id, $message_name, $amf);
- $ret .= make_val($ary);
- return $ret;
+function raw_rpc($amf, $extras) {
+ $ary = raw_rpc_to_aRray($amf, $extras);
+ return make_val($ary);
}
function echo_main() {
@@ -120,15 +139,26 @@
}
$bodies = get_short($amf, $i); $i += 2;
+ $unsent = false; # if the previous message(s) was not sent it's stored
in this
while($bodies && $i < strlen($amf)) {
$len = get_short($amf, $i); $i += 2;
$message_name = substr($amf, $i, $len); $i += $len; # this is
the name of the remote procedure requested
$len = get_short($amf, $i); $i += 2;
$request_id = substr($amf, $i, $len); $i += $len; # eg /1
$len = get_long($amf, $i); $i += 4; # total size in bytes
- $answer = raw_rpc($request_id, $message_name, substr($amf, $i,
$len)); $i += $len;
+ $extra = array('message_name' => $message_name, 'request_id' =>
$request_id);
+ if($unsent) {
+ $extra['unsent'] = $unsent;
+ $unsent = false;
+ }
+ $answer = raw_rpc(substr($amf, $i, $len), $extra); $i += $len;
- if($request_id != '/') {
+ if($request_id == '/' || $request_id == '' || $request_id ==
'null') {
+ if(!$unsent) {
+ $unsent = array();
+ }
+ $unsent[] = raw($answer);
+ } else {
$num_replies += 1;
$reply .= make_string($request_id . '/onResult');
$reply .= make_string('null');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10437: Improved remoting test to also check number of connections engaged.,
Sandro Santilli <=