diff --git a/mozilla/xpcom/remote/tests/Makefile b/mozilla/xpcom/remote/tests/Makefile new file mode 100644 index 00000000000..7d52e967f48 --- /dev/null +++ b/mozilla/xpcom/remote/tests/Makefile @@ -0,0 +1,64 @@ +#!gmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): + +DEPTH = ../../.. +topsrcdir = ../../.. +srcdir = . +VPATH = . + +include $(DEPTH)/config/autoconf.mk + +include $(topsrcdir)/config/config.mk + +SIMPLE_PROGRAMS = clientIn serverIn \ + clientOut serverOut \ + clientInOut serverInOut \ + clientComb serverComb + +XPIDL_MODULE = rpctest + +XPIDLSRCS = nsIRPCTestIn.idl \ + nsIRPCTestOut.idl \ + nsIRPCTestInOut.idl \ + nsIRPCTestComb.idl + +INCLUDES += -I../common -I../server -I../client + +LIBRARY_NAME = common + +CPPSRCS = common.cpp + +LIBS = \ + -lcommon \ + -lxpcom \ + -lxptinfo \ + -lrpcserver \ + -lrpcclient \ + -lrpccommon \ + $(NSPR_LIBS) \ + $(NULL) + + +include $(topsrcdir)/config/rules.mk + + + + diff --git a/mozilla/xpcom/remote/tests/Makefile.in b/mozilla/xpcom/remote/tests/Makefile.in index 1b1f8a39768..eff6eac861e 100644 --- a/mozilla/xpcom/remote/tests/Makefile.in +++ b/mozilla/xpcom/remote/tests/Makefile.in @@ -19,8 +19,8 @@ # # Contributor(s): -DEPTH = ../../.. -topsrcdir = ../../.. +DEPTH = ../.. +topsrcdir = ../.. srcdir = . VPATH = . @@ -28,11 +28,11 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -SIMPLE_PROGRAMS = clientInOut serverInOut +SIMPLE_PROGRAMS = client server XPIDL_MODULE = rpctest -XPIDLSRCS = nsIRPCTestInOut.idl +XPIDLSRCS = nsIRPCTest.idl INCLUDES += -I../common -I../server -I../client diff --git a/mozilla/xpcom/remote/tests/README b/mozilla/xpcom/remote/tests/README new file mode 100644 index 00000000000..fa4aab6f4e5 --- /dev/null +++ b/mozilla/xpcom/remote/tests/README @@ -0,0 +1,29 @@ +To build the tests, + - Run make or gmake. + +To run the tests, + - Run each server and client modules on separate terminals. + - Type the following, + + sIn - server for IN parameter tests + cIn - client for IN parameter tests + sOut - server for OUT parameter tests + cOut - client for OUT parameter tests + sIO - server for INOUT parameter tests + cIO - client for INOUT parameter tests + sComb - server for Combinational tests + cComb - client for Combinational tests + + Each server and client module writes the values of each + parameter that it sends and/or receive to a result file. + Each has its own result file. + +To check the result, the result files of the server and +the client will be compared using the diff tool. Tests +pass if data in both files exactly match; otherwise, +they fail. + chkIn - comparing the IN result files + chkOut - comparing the OUT result files + chkIO - comparing the INOUT result files + chkComb - comparing the Combinational result files + diff --git a/mozilla/xpcom/remote/tests/cComb b/mozilla/xpcom/remote/tests/cComb new file mode 100644 index 00000000000..58d0b09885f --- /dev/null +++ b/mozilla/xpcom/remote/tests/cComb @@ -0,0 +1,3 @@ +rm serverComb.res +rm clientComb.res +clientComb diff --git a/mozilla/xpcom/remote/tests/cIO b/mozilla/xpcom/remote/tests/cIO new file mode 100755 index 00000000000..5d816361d8b --- /dev/null +++ b/mozilla/xpcom/remote/tests/cIO @@ -0,0 +1,3 @@ +rm serverInOut.res +rm clientInOut.res +clientInOut diff --git a/mozilla/xpcom/remote/tests/cIn b/mozilla/xpcom/remote/tests/cIn new file mode 100755 index 00000000000..375811012ea --- /dev/null +++ b/mozilla/xpcom/remote/tests/cIn @@ -0,0 +1,3 @@ +rm serverIn.res +rm clientIn.res +clientIn diff --git a/mozilla/xpcom/remote/tests/cOut b/mozilla/xpcom/remote/tests/cOut new file mode 100755 index 00000000000..d1e52dbe3e4 --- /dev/null +++ b/mozilla/xpcom/remote/tests/cOut @@ -0,0 +1,3 @@ +rm serverOut.res +rm clientOut.res +clientOut diff --git a/mozilla/xpcom/remote/tests/chkComb b/mozilla/xpcom/remote/tests/chkComb new file mode 100755 index 00000000000..a06e0512880 --- /dev/null +++ b/mozilla/xpcom/remote/tests/chkComb @@ -0,0 +1,3 @@ +echo diff clientComb.res serverComb.res +diff clientComb.res serverComb.res + diff --git a/mozilla/xpcom/remote/tests/chkIO b/mozilla/xpcom/remote/tests/chkIO new file mode 100755 index 00000000000..7df6fc18139 --- /dev/null +++ b/mozilla/xpcom/remote/tests/chkIO @@ -0,0 +1,3 @@ +echo diff clientInOut.res serverInOut.res +diff clientInOut.res serverInOut.res + diff --git a/mozilla/xpcom/remote/tests/chkIn b/mozilla/xpcom/remote/tests/chkIn new file mode 100755 index 00000000000..86075bf929e --- /dev/null +++ b/mozilla/xpcom/remote/tests/chkIn @@ -0,0 +1,3 @@ +echo diff clientIn.res serverIn.res +diff clientIn.res serverIn.res + diff --git a/mozilla/xpcom/remote/tests/chkOut b/mozilla/xpcom/remote/tests/chkOut new file mode 100755 index 00000000000..4dd0372ae76 --- /dev/null +++ b/mozilla/xpcom/remote/tests/chkOut @@ -0,0 +1,3 @@ +echo diff clientOut.res serverOut.res +diff clientOut.res serverOut.res + diff --git a/mozilla/xpcom/remote/tests/clean b/mozilla/xpcom/remote/tests/clean new file mode 100755 index 00000000000..625766a5275 --- /dev/null +++ b/mozilla/xpcom/remote/tests/clean @@ -0,0 +1,3 @@ +#!/usr/bin/sh +ME=`who am i |awk '{print $1}'` +for d in `ipcs -q | grep $ME |awk '{print $2}'`;do ipcrm -q $d;done diff --git a/mozilla/xpcom/remote/tests/client.cpp b/mozilla/xpcom/remote/tests/client.cpp index 77d3e7f83cb..797d3ae2f29 100644 --- a/mozilla/xpcom/remote/tests/client.cpp +++ b/mozilla/xpcom/remote/tests/client.cpp @@ -1,23 +1,3 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include #include "RPCClientService.h" #include "nsISupports.h" @@ -37,6 +17,7 @@ int main(int argc, char **args) { nsIRPCTest *t1, *t2; rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTest),(nsISupports**)&t1); +#if 0 i = 1999; printf("--before call %d\n",i); t1->Test2(4321,&i); @@ -53,6 +34,7 @@ int main(int argc, char **args) { char *s2 = "world"; t1->Test3(s1,&s2); printf("s2 %s\n",s2); +#endif printf("-----------------------------------------------\n"); PRUint32 arrayCount = 2; char * array[2] = {"Hello","Pic"}; diff --git a/mozilla/xpcom/remote/tests/clientComb.cpp b/mozilla/xpcom/remote/tests/clientComb.cpp new file mode 100644 index 00000000000..1b5e9ab1947 --- /dev/null +++ b/mozilla/xpcom/remote/tests/clientComb.cpp @@ -0,0 +1,312 @@ +#include +#include +#include +#include +#include +#include "RPCClientService.h" +#include "nsISupports.h" +#include "nsISample.h" +#include "nsIRPCTestComb.h" +#include "deftest.h" +#include "proto.h" + +extern char* transportName; +int main(int argc, char **args) +{ + nsIID iid; + nsIRPCTestComb *t1; + PRBool b, b2; + PRUint8 o; + PRInt16 sInt; + PRUint16 usInt, usInt2; + PRInt32 lInt; + double d; + char c; + PRUnichar wc; + char* sio; + char* s; + char spid[20]; + + getProcessId(COMB_FDATA, &spid[0]); + ofstream f_res(CLIENT_COMB_RES); + if(!f_res) { + cerr << "Cannot open result file."; + } + + RPCClientService::Initialize(spid); + RPCClientService * rpcService = RPCClientService::GetInstance(); + rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestComb),(nsISupports**)&t1); + + b = PR_TRUE; + c = 'A'; + printf("--before call TestComb1 %c\n",c); + t1->TestComb1(b, &c); + printf("--after call TestComb1 %c\n",c); + f_res << form("TestComb1 %c\n",c); + printf("____________________________________________\n"); + + b = PR_TRUE; + sio = "This is a test."; + printf("--before call TestComb2 %s\n",sio); + t1->TestComb2(b, &sio); + printf("--after call TestComb2 %s\n",sio); + f_res << form("TestComb2 %s\n",sio); + printf("____________________________________________\n"); + + c = 'A'; + sio = "This is a test."; + printf("--before call TestComb3 %c\n",c); + printf("--before call TestComb3 %s\n",sio); + t1->TestComb3(&c, &sio); + printf("--after call TestComb3 %c\n",c); + printf("--after call TestComb3 %s\n",sio); + f_res << form("TestComb3 %c %s\n",c,sio); + printf("____________________________________________\n"); + + + b = PR_TRUE; + c = 'A'; + s = "This is a test."; + printf("--before call TestComb4 %c\n",c); + printf("--before call TestComb4 %s\n",s); + t1->TestComb4(&s, b, &c); + printf("--after call TestComb4 %c\n",c); + printf("--after call TestComb4 %s\n",s); + f_res << form("TestComb4 %c %s\n",c,s); + printf("____________________________________________\n"); + + sInt = 555; + c = 'A'; + printf("--before call TestComb5 %c\n",c); + t1->TestComb5(sInt, &c); + printf("--after call TestComb5 %c\n",c); + f_res << form("TestComb5 %c\n",c); + printf("____________________________________________\n"); + + b = PR_TRUE; + sInt = 555; + printf("--before call TestComb6 %d\n",sInt); + t1->TestComb6(b, &sInt); + printf("--after call TestComb6 %d\n",sInt); + f_res << form("TestComb6 %d\n",sInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + sInt = 555; + printf("--before call TestComb7 %d\n",sInt); + t1->TestComb7(b, &sInt); + printf("--after call TestComb7 %d\n",sInt); + f_res << form("TestComb7 %d\n",sInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + sInt = 555; + printf("--before call TestComb8 %d\n",b); + printf("--before call TestComb8 %d\n",sInt); + t1->TestComb8(b, sInt); + f_res << form("TestComb8 %d %d\n",b, sInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + c = 'a'; + printf("--before call TestComb9 %d\n",b); + printf("--before call TestComb9 %c\n",c); + t1->TestComb9(b, c); + printf("--after call TestComb9 %c\n",c); + f_res << form("TestComb9 %d %c\n",b, c); + printf("____________________________________________\n"); + + b = PR_TRUE; + s = (char *) malloc(sizeof(char) * 50); + strcpy(s,"This is a test."); + t1->TestComb10(b, &s); + printf("--after call TestComb10 %s\n",s); + f_res << form("TestComb10 %s\n", s); + printf("____________________________________________\n"); + + b = PR_TRUE; + c = 'A'; + printf("--before call TestComb11 %c\n",c); + t1->TestComb11(b, &c); + printf("--after call TestComb11 %c\n",c); + f_res << form("TestComb11 %c\n",c); + printf("____________________________________________\n"); + + b = PR_TRUE; + lInt = 100; + printf("--before call TestComb12 %d\n",lInt); + t1->TestComb12(b, &lInt); + printf("--after call TestComb12 %d\n",lInt); + f_res << form("TestComb12 %d\n",lInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + lInt = 100; + printf("--before call TestComb13 %d\n",lInt); + t1->TestComb13(b, &lInt); + printf("--after call TestComb13 %d\n",lInt); + f_res << form("TestComb13 %d\n",lInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + lInt = 100; + printf("--before call TestComb14 %d\n",b); + printf("--before call TestComb14 %d\n",lInt); + t1->TestComb14(b, lInt); + f_res << form("TestComb14 %d %d\n",b, lInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + d = 100.99; + printf("--before call TestComb15 %d\n",b); + printf("--before call TestComb15 %.50f\n",d); + t1->TestComb15(b, &d); + printf("--after call TestComb15 %.50f\n",d); + f_res << form("TestComb15 %.50f\n",d); + printf("____________________________________________\n"); + + b = PR_TRUE; + d = 100.99; + printf("--before call TestComb16 %d\n",b); + printf("--before call TestComb16 %.50f\n",d); + t1->TestComb16(b, &d); + printf("--after call TestComb16 %.50f\n",d); + f_res << form("TestComb16 %.50f\n",d); + printf("____________________________________________\n"); + + b = PR_TRUE; + usInt = 555; + printf("--before call TestComb17 %d\n",b); + printf("--before call TestComb17 %u\n",usInt); + t1->TestComb17(b, &usInt); + printf("--after call TestComb17 %u\n",usInt); + f_res << form("TestComb17 %d\n",usInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + usInt = 555; + printf("--before call TestComb18 %d\n",b); + printf("--before call TestComb18 %u\n",usInt); + t1->TestComb18(b, &usInt); + printf("--after call TestComb18 %u\n",usInt); + f_res << form("TestComb18 %d\n",usInt); + printf("____________________________________________\n"); + + b = PR_TRUE; + o = 7; + printf("--before call TestComb19 %d\n",b); + printf("--before call TestComb19 %d\n",o); + t1->TestComb19(b, &o); + printf("--after call TestComb19 %d\n",o); + f_res << form("TestComb19 %o\n",o); + printf("____________________________________________\n"); + + b = PR_TRUE; + o = 7; + printf("--before call TestComb20 %d\n",b); + printf("--before call TestComb20 %d\n",o); + t1->TestComb20(b, &o); + printf("--after call TestComb20 %d\n",o); + f_res << form("TestComb20 %o\n",o); + printf("____________________________________________\n"); + + b = PR_TRUE; + o = 7; + printf("--before call TestComb21 %d\n",o); + t1->TestComb21(b, o); + f_res << form("TestComb21 %d %o\n",b,o); + printf("____________________________________________\n"); + + b = PR_TRUE; + b2 = PR_TRUE; + printf("--before call TestComb22 %d\n",b2); + t1->TestComb22(b, b2); + f_res << form("TestComb22 %d %d\n",b,b2); + printf("____________________________________________\n"); + + b = PR_TRUE; + b2 = PR_TRUE; + printf("--before call TestComb23 %d\n",b2); + t1->TestComb23(b, &b2); + printf("--after call TestComb23 %d\n",b2); + f_res << form("TestComb23 %d\n",b2); + printf("____________________________________________\n"); + + b = PR_TRUE; + b2 = PR_TRUE; + printf("--before call TestComb24 %d\n",b2); + t1->TestComb24(b, &b2); + printf("--after call TestComb24 %d\n",b2); + f_res << form("TestComb24 %d\n",b2); + printf("____________________________________________\n"); + + b = PR_TRUE; + c = 'A'; + printf("--before call TestComb25 %d\n",b); + printf("--before call TestComb25 %d\n",c); + t1->TestComb25(&b, &c); + printf("--after call TestComb25 %d\n",b); + printf("--after call TestComb25 %d\n",c); + f_res << form("TestComb25 %d %c\n",b,c); + printf("____________________________________________\n"); + + b = PR_TRUE; + c = 'A'; + printf("--before call TestComb26 %d\n",b); + printf("--before call TestComb26 %d\n",c); + t1->TestComb26(&b, &c); + printf("--after call TestComb26 %d\n",c); + printf("--after call TestComb26 %d\n",b); + f_res << form("TestComb26 %d %c\n",b,c); + printf("____________________________________________\n"); + + b = PR_TRUE; + wc = 'A'; + printf("--before call TestComb27 %c\n",wc); + t1->TestComb27(b, &wc); + printf("--after call TestComb27 %c\n",wc); + f_res << form("TestComb27 %c\n",wc); + printf("____________________________________________\n"); + + sio = "This is a test."; + s = "This is a second test."; + printf("--before call TestComb30 %s\n",sio); + printf("--before call TestComb30 %s\n",s); + t1->TestComb30(s, &sio); + printf("--after call TestComb30 %s\n",sio); + f_res << form("TestComb30 %s\n",sio); + printf("____________________________________________\n"); + + o = 55; + usInt = 55; + printf("--before call TestComb31 %o\n",o); + printf("--before call TestComb31 %u\n",usInt); + t1->TestComb31(&o, &usInt); + printf("--after call TestComb31 %o\n",o); + printf("--after call TestComb31 %u\n",usInt); + f_res << form("TestComb31 %o %u\n",o,usInt); + printf("____________________________________________\n"); + + o = 55; + lInt = 55; + printf("--before call TestComb32 %o\n",o); + printf("--before call TestComb32 %d\n",lInt); + t1->TestComb32(&o, &lInt); + printf("--after call TestComb32 %o\n",o); + printf("--after call TestComb32 %d\n",lInt); + f_res << form("TestComb32 %o %d\n",o,lInt); + printf("____________________________________________\n"); + + lInt = 55; + usInt2 = 55; + printf("--before call TestComb33 %u\n",usInt2); + printf("--before call TestComb33 %d\n",lInt); + t1->TestComb33(&lInt, &usInt); + printf("--after call TestComb33 %u\n",usInt2); + printf("--after call TestComb33 %d\n",lInt); + f_res << form("TestComb33 %d %u\n",lInt,usInt); + printf("____________________________________________\n"); + + f_res.close(); +} + diff --git a/mozilla/xpcom/remote/tests/clientIn.cpp b/mozilla/xpcom/remote/tests/clientIn.cpp index 9f58a7603c7..09520bfaf16 100644 --- a/mozilla/xpcom/remote/tests/clientIn.cpp +++ b/mozilla/xpcom/remote/tests/clientIn.cpp @@ -1,37 +1,19 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include +#include +#include +#include +#include +#include #include "RPCClientService.h" #include "nsISupports.h" #include "nsISample.h" #include "nsIRPCTestIn.h" +#include "deftest.h" +#include "proto.h" extern char* transportName; int main(int argc, char **args) { - if (argc < 2) { - printf("format client \n"); - exit(1); - } - RPCClientService::Initialize(args[1]); - RPCClientService * rpcService = RPCClientService::GetInstance(); + nsIID iid; nsIRPCTestIn *t1; PRBool b; @@ -47,99 +29,240 @@ int main(int argc, char **args) { char c; PRUnichar wc; char* s; - PRUnichar ws; + PRUnichar *ws; + char spid[20]; + int i; + getProcessId(IN_FDATA, &spid[0]); + ofstream f_res(CLIENT_IN_RES); + if(!f_res) { + cerr << "Cannot open result file."; + } + + RPCClientService::Initialize(spid); + RPCClientService * rpcService = RPCClientService::GetInstance(); rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestIn),(nsISupports**)&t1); + b = PR_TRUE; - printf("--before call Test1 %d\n",b); - t1->Test1(b); + printf("--before call TestIn1 %d\n",b); + t1->TestIn1(b); + f_res << form("TestIn1 %d\n",b); b = PR_FALSE; - printf("--before call Test1 %d\n",b); - t1->Test1(b); + printf("--before call TestIn1 %d\n",b); + t1->TestIn1(b); + f_res << form("TestIn1 %d\n",b); printf("____________________________________________\n"); + o = 0; - printf("--before call Test2 %d\n",o); - t1->Test2(o); + printf("--before call TestIn2 %d\n",o); + t1->TestIn2(o); + f_res << form("TestIn2 %o\n",o); o = 124; - printf("--before call Test2 %d\n",o); - t1->Test2(o); + printf("--before call TestIn2 %d\n",o); + t1->TestIn2(o); + f_res << form("TestIn2 %o\n",o); printf("____________________________________________\n"); - sInt = -32768; - printf("--before call Test3 %d\n",sInt); - t1->Test3(sInt); - sInt = 32767; - printf("--before call Test3 %d\n",sInt); - t1->Test3(sInt); + + sInt = SHRT_MIN; + printf("--before call TestIn3 %d\n",sInt); + t1->TestIn3(sInt); + f_res << form("TestIn3 %d\n",sInt); + sInt = SHRT_MAX; + printf("--before call TestIn3 %d\n",sInt); + t1->TestIn3(sInt); + f_res << form("TestIn3 %d\n",sInt); printf("____________________________________________\n"); - lInt = -2147483648; - printf("--before call Test4 %d\n",lInt); - t1->Test4(lInt); - lInt = 2147483647; - printf("--before call Test4 %d\n",lInt); - t1->Test4(lInt); + + lInt = LONG_MIN; + printf("--before call TestIn4 %d\n",lInt); + t1->TestIn4(lInt); + f_res << form("TestIn4 %d\n",lInt); + lInt = LONG_MAX; + printf("--before call TestIn4 %d\n",lInt); + t1->TestIn4(lInt); + f_res << form("TestIn4 %d\n",lInt); printf("____________________________________________\n"); - llInt = -9223372036854775808; - printf("--before call Test5 %d\n",llInt); - t1->Test5(llInt); - llInt = 9223372036854775807; - printf("--before call Test5 %d\n",llInt); - t1->Test5(llInt); + + llInt = LONG_MIN; + printf("--before call TestIn5 %d\n",llInt); + t1->TestIn5(llInt); + f_res << form("TestIn5 %d\n",llInt); + llInt = LONG_MAX; + printf("--before call TestIn5 %d\n",llInt); + t1->TestIn5(llInt); + f_res << form("TestIn5 %d\n",llInt); printf("____________________________________________\n"); - usInt = 32768; - printf("--before call Test6 %u\n",usInt); - t1->Test6(usInt); - usInt = 65535; - printf("--before call Test6 %u\n",usInt); - t1->Test6(usInt); + + usInt = 555; + printf("--before call TestIn6 %u\n",usInt); + t1->TestIn6(usInt); + f_res << form("TestIn6 %u\n",usInt); + usInt = USHRT_MAX; + printf("--before call TestIn6 %u\n",usInt); + t1->TestIn6(usInt); + f_res << form("TestIn6 %u\n",usInt); printf("____________________________________________\n"); - ulInt = 0; - printf("--before call Test7 %u\n",ulInt); - t1->Test7(ulInt); - ulInt = 4294967295; - printf("--before call Test7 %u\n",ulInt); - t1->Test7(ulInt); + + ulInt = 555; + printf("--before call TestIn7 %u\n",ulInt); + t1->TestIn7(ulInt); + f_res << form("TestIn7 %u\n",ulInt); + ulInt = ULONG_MAX; + printf("--before call TestIn7 %u\n",ulInt); + t1->TestIn7(ulInt); + f_res << form("TestIn7 %u\n",ulInt); printf("____________________________________________\n"); - ullInt = 0; - printf("--before call Test8 %u\n",ullInt); - t1->Test8(ullInt); - //ullInt = 9223372036854775807; - ullInt = 18446744073709551615; - printf("--before call Test8 %u\n",ullInt); - t1->Test8(ullInt); + + ullInt = 555; + printf("--before call TestIn8 %u\n",ullInt); + t1->TestIn8(ullInt); + f_res << form("TestIn8 %u\n",ullInt); + ullInt = ULONG_MAX; + printf("--before call TestIn8 %u\n",ullInt); + t1->TestIn8(ullInt); + f_res << form("TestIn8 %u\n",ullInt); printf("____________________________________________\n"); - f = .123456789012345678901234567890; - printf("--before call Test9 %.38f\n",f); - t1->Test9(f); - f = 3.4E38; - printf("--before call Test9 %f\n",f); - t1->Test9(f); + + f = FLT_MIN; + printf("--before call TestIn9 %.50f\n",f); + t1->TestIn9(f); + f_res << form("TestIn9 %.50f\n",f); + f = FLT_MAX; + printf("--before call TestIn9 %f\n",f); + t1->TestIn9(f); + f_res << form("TestIn9 %.50f\n",f); printf("____________________________________________\n"); - d = .170000001111000000111111000000111110000000111111; - printf("--before call Test10 %.50f\n",d); - t1->Test10(d); - d = 1.7E308; - printf("--before call Test10 %f\n",d); - t1->Test10(d); + + d = DBL_MIN; + printf("--before call TestIn10 %.50f\n",d); + t1->TestIn10(d); + f_res << form("TestIn10 %.50f\n",d); + d = DBL_MAX; + printf("--before call TestIn10 %f\n",d); + t1->TestIn10(d); + f_res << form("TestIn10 %.50f\n",d); printf("____________________________________________\n"); + c = 'A'; - printf("--before call Test %d\n",c); - t1->Test11(c); + printf("--before call TestIn11 %d\n",c); + t1->TestIn11(c); + f_res << form("TestIn11 %c\n",c); c = 'Z'; - printf("--before call Test %d\n",c); - t1->Test11(c); + printf("--before call TestIn11 %d\n",c); + t1->TestIn11(c); + f_res << form("TestIn11 %c\n",c); printf("____________________________________________\n"); + wc = 'A'; - printf("--before call Test12 %d\n",wc); - t1->Test12(wc); + printf("--before call TestIn12 %d\n",wc); + t1->TestIn12(wc); + f_res << form("TestIn12 %c\n",wc); wc = 'Z'; - printf("--before call Test12 %d\n",wc); - t1->Test12(wc); + printf("--before call TestIn12 %d\n",wc); + t1->TestIn12(wc); + f_res << form("TestIn12 %c\n",wc); printf("____________________________________________\n"); - s = "This is a test."; - printf("--before call Test13 %s\n",s); - t1->Test13(s); - //s = ""; /* This is a bug... */ - //printf("--before call Test13 %s\n",s); - //t1->Test13(s); + + s = ""; + printf("--before call TestIn13 %s\n",s); + t1->TestIn13(s); + f_res << form("TestIn13 %s\n",s); + strcpy(s,"This is a test."); + printf("--before call TestIn13 %s\n",s); + t1->TestIn13(s); + f_res << form("TestIn13 %s\n",s); + printf("____________________________________________\n"); +/* + ws = new PRUnichar[50]; + ws[0] = '\0'; + printf("--before call TestIn14 %s\n",ws); + t1->TestIn14(ws); + f_res << form("TestIn14 %s\n",ws); + + for (i = 0; i < 10; i++) { + ws[i] = 'z'; + } + ws[i] = '\0'; + printf("--before call TestIn14 %s\n",ws); + t1->TestIn14(ws); + f_res << form("TestIn14 %s\n",ws); + delete ws; + printf("____________________________________________\n"); +*/ + + PRUint32 arrCount = 3; + const char *array[3] = {"Blackwood","MCD","StarLite"}; + printf("--before call TestIn15 data array.\n"); + t1->TestIn15(arrCount, array); + f_res << form("TestIn15 count %d\n", arrCount); + for (i = 0; i < arrCount; i++) { + f_res << form("TestIn15 Array[%d]=%s\n",i,array[i]); + } + printf("____________________________________________\n"); + + PRUint32 arrCount2 = 10; + PRInt32 arrLong[10] = {1111111, 2222222, 3333333, 4444444, 5555555, + 6666666, 7777777, 8888888, 9999999, 0}; + printf("--before call TestIn16 data array.\n"); + t1->TestIn16(arrCount2, &arrLong[0]); + f_res << form("TestIn16 count %d\n", arrCount2); + for (i = 0; i < arrCount2; i++) { + f_res << form("TestIn16 Array[%d]=%d\n",i,arrLong[i]); + } + printf("____________________________________________\n"); + + b = PR_TRUE; + o = 8; + sInt = 1; + lInt = 2; + llInt = 3; + usInt = 4; + ulInt = 5; + ullInt = 6; + f = 7; + d = 8; + c = 'A'; + + printf("--before call TestIn17 combination.\n"); + t1->TestIn17(b, c, o, sInt, usInt, lInt, ulInt, llInt, ullInt, f, d, s, arrCount2, &arrLong[0]); + f_res << form("TestIn17 PRBool %d\n",b); + f_res << form("TestIn17 PRUint8 %o\n",o); + f_res << form("TestIn17 PRInt16 %d\n",sInt); + f_res << form("TestIn17 PRInt32 %d\n",lInt); + f_res << form("TestIn17 PRInt64 %d\n",llInt); + f_res << form("TestIn17 PRUint16 %u\n",usInt); + f_res << form("TestIn17 PRUint32 %u\n",ulInt); + f_res << form("TestIn17 PRUint64 %u\n",ullInt); + f_res << form("TestIn17 float %.50f\n",f); + f_res << form("TestIn17 double %.50f\n",d); + f_res << form("TestIn17 char %c\n",c); + f_res << form("TestIn17 string %s\n",s); + f_res << form("TestIn17 count %d\n", arrCount2); + for (i = 0; i < arrCount2; i++) { + f_res << form("TestIn17 Array[%d]=%d\n",i,arrLong[i]); + } + printf("____________________________________________\n"); + + printf("--before call TestIn18 combination.\n"); + t1->TestIn18(c, o, sInt, usInt, lInt, ulInt, llInt, ullInt, f, d, s, arrCount2, &arrLong[0]); + f_res << form("TestIn18 PRUint8 %o\n",o); + f_res << form("TestIn18 PRInt16 %d\n",sInt); + f_res << form("TestIn18 PRInt32 %d\n",lInt); + f_res << form("TestIn18 PRInt64 %d\n",llInt); + f_res << form("TestIn18 PRUint16 %u\n",usInt); + f_res << form("TestIn18 PRUint32 %u\n",ulInt); + f_res << form("TestIn18 PRUint64 %u\n",ullInt); + f_res << form("TestIn18 float %.50f\n",f); + f_res << form("TestIn18 double %.50f\n",d); + f_res << form("TestIn18 char %c\n",c); + f_res << form("TestIn18 string %s\n",s); + f_res << form("TestIn18 count %d\n", arrCount2); + for (i = 0; i < arrCount2; i++) { + f_res << form("TestIn18 Array[%d]=%d\n",i,arrLong[i]); + } + printf("____________________________________________\n"); + + f_res.close(); } + diff --git a/mozilla/xpcom/remote/tests/clientInOut.cpp b/mozilla/xpcom/remote/tests/clientInOut.cpp index 7a4aabd95eb..0137e3244be 100644 --- a/mozilla/xpcom/remote/tests/clientInOut.cpp +++ b/mozilla/xpcom/remote/tests/clientInOut.cpp @@ -1,37 +1,19 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include +#include +#include +#include +#include +#include #include "RPCClientService.h" #include "nsISupports.h" #include "nsISample.h" #include "nsIRPCTestInOut.h" +#include "deftest.h" +#include "proto.h" extern char* transportName; int main(int argc, char **args) { - if (argc < 2) { - printf("format client \n"); - exit(1); - } - RPCClientService::Initialize(args[1]); - RPCClientService * rpcService = RPCClientService::GetInstance(); + nsIID iid; nsIRPCTestInOut *t1; PRBool b; @@ -47,90 +29,257 @@ int main(int argc, char **args) { char c; PRUnichar wc; char* s; - PRUnichar ws; + PRUnichar *ws; + char spid[20]; + int i; + getProcessId(INOUT_FDATA, &spid[0]); + ofstream f_res(CLIENT_INOUT_RES); + if(!f_res) { + cerr << "Cannot open result file."; + } + + RPCClientService::Initialize(spid); + RPCClientService * rpcService = RPCClientService::GetInstance(); rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestInOut),(nsISupports**)&t1); -#if 0 + + b = PR_TRUE; - printf("--before call Test1 %d\n",b); - t1->Test1(&b); - printf("--after call Test1 %d\n",b); - t1->Test1(&b); -#endif + printf("--before call TestInOut1 %d\n",b); + f_res << form("TestInOut1 before %d\n",b); + t1->TestInOut1(&b); + printf("--after call TestInOut1 %d\n",b); + f_res << form("TestInOut1 after %d\n",b); printf("____________________________________________\n"); - o = 124; - printf("--before call Test2 %d\n",o); - printf("--&o %p\n",&o); - t1->Test2(&o); - printf("--after call Test2 %d\n",o); - t1->Test2(&o); + + o = 10; + printf("--before call TestInOut2 %o\n",o); + f_res << form("TestInOut2 before %o\n",o); + t1->TestInOut2(&o); + printf("--after call TestInOut2 %o\n",o); + f_res << form("TestInOut2 after %o\n",o); printf("____________________________________________\n"); - sInt = -32768; - printf("--before call Test3 %d\n",sInt); - t1->Test3(&sInt); - printf("--after call Test3 %d\n",sInt); - t1->Test3(&sInt); + + sInt = SHRT_MIN; + printf("--before call TestInOut3 %d\n",sInt); + f_res << form("TestInOut3 before %d\n",sInt); + t1->TestInOut3(&sInt); + printf("--after call TestInOut3 %d\n",sInt); + f_res << form("TestInOut3 after %d\n",sInt); printf("____________________________________________\n"); - lInt = -2147483648; - printf("--before call Test4 %d\n",lInt); - t1->Test4(&lInt); - printf("--after call Test4 %d\n",lInt); - t1->Test4(&lInt); + + lInt = LONG_MIN; + printf("--before call TestInOut4 %d\n",lInt); + f_res << form("TestInOut4 before %l\n",lInt); + t1->TestInOut4(&lInt); + printf("--after call TestInOut4 %d\n",lInt); + f_res << form("TestInOut4 after %l\n",lInt); printf("____________________________________________\n"); - llInt = -9223372036854775808; - printf("--before call Test5 %d\n",llInt); - t1->Test5(&llInt); - printf("--after call Test5 %d\n",llInt); - t1->Test5(&llInt); + + llInt = LONG_MIN; + printf("--before call TestInOut5 %d\n",llInt); + f_res << form("TestInOut5 before %l\n",llInt); + t1->TestInOut5(&llInt); + printf("--after call TestInOut5 %d\n",llInt); + f_res << form("TestInOut5 after %l\n",llInt); printf("____________________________________________\n"); -// usInt = 32768; -// printf("--before call Test6 %u\n",usInt); -// t1->Test6(&usInt); -// printf("--after call Test6 %u\n",usInt); -// t1->Test6(&usInt); + + usInt = 555; + printf("--before call TestInOut6 %u\n",usInt); + f_res << form("TestInOut6 before %10u\n",usInt); + t1->TestInOut6(&usInt); + printf("--after call TestInOut6 %u\n",usInt); + f_res << form("TestInOut6 after %10u\n",usInt); printf("____________________________________________\n"); - ulInt = 4294967295; - printf("--before call Test7 %u\n",ulInt); - t1->Test7(&ulInt); - printf("--after call Test7 %u\n",ulInt); - t1->Test7(&ulInt); + + ulInt = 555; + printf("--before call TestInOut7 %u\n",ulInt); + f_res << form("TestInOut7 before %10u\n",ulInt); + t1->TestInOut7(&ulInt); + printf("--after call TestInOut7 %u\n",ulInt); + f_res << form("TestInOut7 after %10u\n",ulInt); printf("____________________________________________\n"); - ullInt = 18446744073709551615; - printf("--before call Test8 %u\n",ullInt); - t1->Test8(&ullInt); - printf("--after call Test8 %u\n",ullInt); - t1->Test8(&ullInt); + + ullInt = 555; + printf("--before call TestInOut8 %u\n",ullInt); + f_res << form("TestInOut8 before %10u\n",ullInt); + t1->TestInOut8(&ullInt); + printf("--after call TestInOut8 %u\n",ullInt); + f_res << form("TestInOut8 after %10u\n",ullInt); printf("____________________________________________\n"); - f = .123456789012345678901234567890; - printf("--before call Test9 %.38f\n",f); - t1->Test9(&f); - printf("--after call Test9 %f\n",f); - t1->Test9(&f); + + f = FLT_MIN; + printf("--before call TestInOut9 %.50f\n",f); + f_res << form("TestInOut9 before %.50f\n",f); + t1->TestInOut9(&f); + printf("--after call TestInOut9 %.50f\n",f); + f_res << form("TestInOut9 after %.50f\n",f); printf("____________________________________________\n"); - d = 1.7E308; - printf("--before call Test10 %.50f\n",d); - t1->Test10(&d); - printf("--after call Test10 %f\n",d); - t1->Test10(&d); + + d = DBL_MIN; + printf("--before call TestInOut10 %.50f\n",d); + f_res << form("TestInOut10 before %.50f\n",d); + t1->TestInOut10(&d); + printf("--after call TestInOut10 %.50f\n",d); + f_res << form("TestInOut10 after %.50f\n",d); printf("____________________________________________\n"); -// c = 'A'; -// printf("--before call Test %d\n",c); -// t1->Test11(&c); -// printf("--after call Test %d\n",c); -// t1->Test11(&c); -// printf("____________________________________________\n"); -// wc = 'A'; -// printf("--before call Test12 %d\n",wc); -// t1->Test12(&wc); -// printf("--after call Test12 %d\n",wc); -// t1->Test12(&wc); -// printf("____________________________________________\n"); + + c = 'A'; + printf("--before call TestInOut11 %d\n",c); + f_res << form("TestInOut11 before %c\n",c); + t1->TestInOut11(&c); + printf("--after call TestInOut11 %d\n",c); + f_res << form("TestInOut11 after %c\n",c); + printf("____________________________________________\n"); + + wc = 'A'; + printf("--before call TestInOut12 %d\n",wc); + f_res << form("TestInOut12 before %c\n",wc); + t1->TestInOut12(&wc); + printf("--after call TestInOut12 %d\n",wc); + f_res << form("TestInOut12 after %c\n",wc); + printf("____________________________________________\n"); + s = "This is a test."; -// s = (char *) malloc(sizeof(char) * 50); - printf("--before call Test13 %s\n",s); - t1->Test13(&s); - printf("--before call Test13 %s\n",s); - t1->Test13(&s); + printf("--before call TestInOut13 %s\n",s); + f_res << form("TestInOut13 before %s\n",s); + t1->TestInOut13(&s); + printf("--before call TestInOut13 %s\n",s); + f_res << form("TestInOut13 after %s\n",s); printf("____________________________________________\n"); +/* + ws = new PRUnichar[50]; + for (i = 0; i < 10; i++) { + ws[i] = 'z'; + } + ws[i] = '\0'; + printf("--before call TestInOut14 %s\n",ws); + f_res << form("TestInOut14 before %s\n",ws); + t1->TestInOut14(&ws); + printf("--before call TestInOut14 %s\n",ws); + f_res << form("TestInOut14 after %s\n",ws); + printf("____________________________________________\n"); +*/ + PRUint32 arrCount = 0; + char *array = new char [100]; + strcpy(array,"Going out... remote ipc test."); + arrCount = strlen(array); + printf("TestInOut15 before count %d\n", arrCount); + f_res << form("TestInOut15 before count %d\n", arrCount); + printf("TestInOut15 before Array=%s\n", array); + f_res << form("TestInOut15 before Array=%s\n",array); + printf("--before call TestInOut15 data array.\n"); + t1->TestInOut15(&arrCount, &array); + printf("TestInOut15 after count %d\n", arrCount); + f_res << form("TestInOut15 after count %d\n", arrCount); + printf("TestInOut15 after Array=%s\n", array); + f_res << form("TestInOut15 after Array=%s\n",array); + printf("____________________________________________\n"); + + + printf("--before call TestInOut16 combination.\n"); + + b = PR_FALSE; + o = 555; + c = 'Z'; + sInt = 9; + usInt = 9; + lInt = 9; + ulInt = 9; + llInt = 9; + ullInt = 9; + f = 9; + d = 9; + s = "This is an inout parameter test."; + + f_res << form("TestInOut16 before %d\n",b); + f_res << form("TestInOut16 before %d\n",lInt); + f_res << form("TestInOut16 before %d\n",llInt); + f_res << form("TestInOut16 before %u\n",usInt); + f_res << form("TestInOut16 before %u\n",ulInt); + f_res << form("TestInOut16 before %u\n",ullInt); + f_res << form("TestInOut16 before %.50f\n",f); + f_res << form("TestInOut16 before %.50f\n",d); + f_res << form("TestInOut16 before %c\n",c); + f_res << form("TestInOut16 before %s\n",s); + + t1->TestInOut16( &b, &c, &usInt, &lInt, &ulInt, &llInt, &ullInt, &f, &d, &s); + + printf("After calling TestInOut16.\n"); + f_res << form("TestInOut16 after %d\n",b); + f_res << form("TestInOut16 after %d\n",lInt); + f_res << form("TestInOut16 after %d\n",llInt); + f_res << form("TestInOut16 after %u\n",usInt); + f_res << form("TestInOut16 after %u\n",ulInt); + f_res << form("TestInOut16 after %u\n",ullInt); + f_res << form("TestInOut16 after %.50f\n",f); + f_res << form("TestInOut16 after %.50f\n",d); + f_res << form("TestInOut16 after %c\n",c); + f_res << form("TestInOut16 after %s\n",s); + printf("____________________________________________\n"); + + PRUint32 arrCount2 = 5; + PRInt32 *arrLong = new PRInt32 [arrCount2]; + f_res << form("TestInOut17 before count %d\n", arrCount2); + for (i = 0; i < arrCount2; i++) { + arrLong[i] = 11111 + i; + f_res << form("TestInOut17 before Array[%d]=%d\n",i,arrLong[i]); + } + printf("--before call TestInOut17 data array.\n"); + t1->TestInOut17(&arrCount2, &arrLong); + f_res << form("TestInOut17 after count %d\n", arrCount2); + for (i = 0; i < arrCount2; i++) { + f_res << form("TestInOut17 after Array[%d]=%d\n",i,arrLong[i]); + } + delete arrLong; + printf("____________________________________________\n"); + + printf("--before call TestInOut18 combination.\n"); + + b = PR_FALSE; + o = 555; + c = 'Z'; + sInt = 9; + usInt = 9; + lInt = 9; + ulInt = 9; + llInt = 9; + ullInt = 9; + f = 9; + d = 9; + s = "This is an inout parameter test."; + + f_res << form("TestInOut18 before %d\n",b); + f_res << form("TestInOut18 before %o\n",o); + f_res << form("TestInOut18 before %d\n",sInt); + f_res << form("TestInOut18 before %d\n",lInt); + f_res << form("TestInOut18 before %d\n",llInt); + f_res << form("TestInOut18 before %u\n",usInt); + f_res << form("TestInOut18 before %u\n",ulInt); + f_res << form("TestInOut18 before %u\n",ullInt); + f_res << form("TestInOut18 before %.50f\n",f); + f_res << form("TestInOut18 before %.50f\n",d); + f_res << form("TestInOut18 before %c\n",c); + f_res << form("TestInOut18 before %s\n",s); + + t1->TestInOut18(&b, &c, &o, &sInt, &usInt, &lInt, &ulInt, &llInt, &ullInt, &f, &d, &s); + + printf("After calling TestInOut18.\n"); + f_res << form("TestInOut18 after %d\n",b); + f_res << form("TestInOut18 after %o\n",o); + f_res << form("TestInOut18 after %d\n",sInt); + f_res << form("TestInOut18 after %d\n",lInt); + f_res << form("TestInOut18 after %d\n",llInt); + f_res << form("TestInOut18 after %u\n",usInt); + f_res << form("TestInOut18 after %u\n",ulInt); + f_res << form("TestInOut18 after %u\n",ullInt); + f_res << form("TestInOut18 after %.50f\n",f); + f_res << form("TestInOut18 after %.50f\n",d); + f_res << form("TestInOut18 after %c\n",c); + f_res << form("TestInOut18 after %s\n",s); + printf("____________________________________________\n"); + + + f_res.close(); } diff --git a/mozilla/xpcom/remote/tests/clientOut.cpp b/mozilla/xpcom/remote/tests/clientOut.cpp index eba1a07d036..1e88d504d07 100644 --- a/mozilla/xpcom/remote/tests/clientOut.cpp +++ b/mozilla/xpcom/remote/tests/clientOut.cpp @@ -1,37 +1,19 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include +#include +#include +#include +#include +#include #include "RPCClientService.h" #include "nsISupports.h" #include "nsISample.h" #include "nsIRPCTestOut.h" +#include "deftest.h" +#include "proto.h" extern char* transportName; int main(int argc, char **args) { - if (argc < 2) { - printf("format client \n"); - exit(1); - } - RPCClientService::Initialize(args[1]); - RPCClientService * rpcService = RPCClientService::GetInstance(); + nsIID iid; nsIRPCTestOut *t1; PRBool b; @@ -47,87 +29,162 @@ int main(int argc, char **args) { char c; PRUnichar wc; char* s; - PRUnichar ws; + PRUnichar *ws; + char spid[20]; + getProcessId(OUT_FDATA, &spid[0]); + ofstream f_res(CLIENT_OUT_RES); + if(!f_res) { + cerr << "Cannot open result file."; + } + + RPCClientService::Initialize(spid); + RPCClientService * rpcService = RPCClientService::GetInstance(); rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestOut),(nsISupports**)&t1); + b = PR_TRUE; - printf("--before call Test1 %d\n",b); - t1->Test1(&b); - printf("--after call Test1 %d\n",b); - t1->Test1(&b); - printf("____________________________________________\n"); - o = 124; - printf("--before call Test2 %d\n",o); - t1->Test2(&o); - printf("--after call Test2 %d\n",o); - t1->Test2(&o); - printf("____________________________________________\n"); - sInt = -32768; - printf("--before call Test3 %d\n",sInt); - t1->Test3(&sInt); - printf("--after call Test3 %d\n",sInt); - t1->Test3(&sInt); - printf("____________________________________________\n"); - lInt = -2147483648; - printf("--before call Test4 %d\n",lInt); - t1->Test4(&lInt); - printf("--after call Test4 %d\n",lInt); - t1->Test4(&lInt); - printf("____________________________________________\n"); - llInt = -9223372036854775808; - printf("--before call Test5 %d\n",llInt); - t1->Test5(&llInt); - printf("--after call Test5 %d\n",llInt); - t1->Test5(&llInt); - printf("____________________________________________\n"); - usInt = 32768; - printf("--before call Test6 %u\n",usInt); - t1->Test6(&usInt); - printf("--after call Test6 %u\n",usInt); - t1->Test6(&usInt); - printf("____________________________________________\n"); - ulInt = 4294967295; - printf("--before call Test7 %u\n",ulInt); - t1->Test7(&ulInt); - printf("--after call Test7 %u\n",ulInt); - t1->Test7(&ulInt); - printf("____________________________________________\n"); - ullInt = 18446744073709551615; - printf("--before call Test8 %u\n",ullInt); - t1->Test8(&ullInt); - printf("--after call Test8 %u\n",ullInt); - t1->Test8(&ullInt); - printf("____________________________________________\n"); - f = .123456789012345678901234567890; - printf("--before call Test9 %.38f\n",f); - t1->Test9(&f); - printf("--after call Test9 %f\n",f); - t1->Test9(&f); - printf("____________________________________________\n"); - d = 1.7E308; - printf("--before call Test10 %.50f\n",d); - t1->Test10(&d); - printf("--after call Test10 %f\n",d); - t1->Test10(&d); - printf("____________________________________________\n"); - c = 'A'; - printf("--before call Test %d\n",c); - t1->Test11(&c); - printf("--after call Test %d\n",c); - t1->Test11(&c); - printf("____________________________________________\n"); - wc = 'A'; - printf("--before call Test12 %d\n",wc); - t1->Test12(&wc); - printf("--after call Test12 %d\n",wc); - t1->Test12(&wc); - printf("____________________________________________\n"); - s = "This is a test."; -// s = (char *) malloc(sizeof(char) * 50); - printf("--before call Test13 %s\n",s); - t1->Test13(&s); - printf("--before call Test13 %s\n",s); - t1->Test13(&s); + printf("--before call TestOut1 %d\n",b); + t1->TestOut1(&b); + printf("--after call TestOut1 %d\n",b); + f_res << form("TestOut1 %d\n",b); printf("____________________________________________\n"); + o = 124; + printf("--before call TestOut2 %d\n",o); + t1->TestOut2(&o); + printf("--after call TestOut2 %d\n",o); + f_res << form("TestOut2 %o\n",o); + printf("____________________________________________\n"); + + sInt = SHRT_MIN; + printf("--before call TestOut3 %d\n",sInt); + t1->TestOut3(&sInt); + printf("--after call TestOut3 %d\n",sInt); + f_res << form("TestOut3 %d\n",sInt); + printf("____________________________________________\n"); + + lInt = LONG_MIN; + printf("--before call TestOut4 %d\n",lInt); + t1->TestOut4(&lInt); + printf("--after call TestOut4 %d\n",lInt); + f_res << form("TestOut4 %d\n",lInt); + printf("____________________________________________\n"); + + llInt = LONG_MIN; + printf("--before call TestOut5 %d\n",llInt); + t1->TestOut5(&llInt); + printf("--after call TestOut5 %d\n",llInt); + f_res << form("TestOut5 %d\n",llInt); + printf("____________________________________________\n"); + + usInt = USHRT_MIN; + printf("--before call TestOut6 %u\n",usInt); + t1->TestOut6(&usInt); + printf("--after call TestOut6 %u\n",usInt); + f_res << form("TestOut6 %u\n",usInt); + printf("____________________________________________\n"); + + ulInt = ULONG_MIN; + printf("--before call TestOut7 %u\n",ulInt); + t1->TestOut7(&ulInt); + printf("--after call TestOut7 %u\n",ulInt); + f_res << form("TestOut7 %u\n",ulInt); + printf("____________________________________________\n"); + + ullInt = ULONG_MIN; + printf("--before call TestOut8 %u\n",ullInt); + t1->TestOut8(&ullInt); + printf("--after call TestOut8 %u\n",ullInt); + f_res << form("TestOut8 %u\n",ullInt); + printf("____________________________________________\n"); + + f = FLT_MIN; + printf("--before call TestOut9 %.38f\n",f); + t1->TestOut9(&f); + printf("--after call TestOut9 %f\n",f); + f_res << form("TestOut9 %.50f\n",f); + printf("____________________________________________\n"); + + d = DBL_MIN; + printf("--before call TestOut10 %.50f\n",d); + t1->TestOut10(&d); + printf("--after call TestOut10 %f\n",d); + f_res << form("TestOut10 %.50f\n",d); + printf("____________________________________________\n"); + + c = 'A'; + printf("--before call TestOut11 %d\n",c); + t1->TestOut11(&c); + printf("--after call TestOut11 %d\n",c); + f_res << form("TestOut11 %c\n",c); + printf("____________________________________________\n"); + + wc = 'A'; + printf("--before call TestOut12 %d\n",wc); + t1->TestOut12(&wc); + printf("--after call TestOut12 %d\n",wc); + f_res << form("TestOut12 %c\n",wc); + printf("____________________________________________\n"); + + s = new char[50]; + printf("--before call TestOut13 %s\n",s); + t1->TestOut13(&s); + printf("--after call TestOut13 %s\n",s); + f_res << form("TestOut13 %s\n",s); + delete s; + printf("____________________________________________\n"); +/* + ws = new PRUnichar[50]; + printf("--before call TestOut14 %s\n",ws); + t1->TestOut14(&ws); + printf("--after call TestOut14 %s\n",ws); + f_res << form("TestOut14 %s\n",ws); + delete ws; + printf("____________________________________________\n"); +*/ + + PRUint32 arrCount = 0; + char *array = new char [200]; + printf("--before call TestOut15 data array.\n"); + t1->TestOut15(&arrCount, &array); + printf("TestOut15 count %d\n", arrCount); + f_res << form("TestOut15 count %d\n", arrCount); + printf("TestOut15 Array=%s\n", array); + f_res << form("TestOut15 Array=%s\n",array); + delete array; + printf("____________________________________________\n"); + + + printf("--before call TestOut16 combination.\n"); + t1->TestOut16(&b, &c, &o, &sInt, &usInt, &lInt, &ulInt, &llInt, &ullInt, &f, &d, &s); + printf("After calling TestOut16.\n"); + + f_res << form("TestOut16 PRBool %d\n",b); + f_res << form("TestOut16 PRUint8 %o\n",o); + f_res << form("TestOut16 PRInt16 %d\n",sInt); + f_res << form("TestOut16 PRInt32 %d\n",lInt); + f_res << form("TestOut16 PRInt64 %d\n",llInt); + f_res << form("TestOut16 PRUint16 %u\n",usInt); + f_res << form("TestOut16 PRUint32 %u\n",ulInt); + f_res << form("TestOut16 PRUint64 %u\n",ullInt); + f_res << form("TestOut16 float %.50f\n",f); + f_res << form("TestOut16 double %.50f\n",d); + f_res << form("TestOut16 char %c\n",c); + f_res << form("TestOut16 string %s\n",s); + printf("____________________________________________\n"); + + PRUint32 arrCount2 = 0; + PRInt32 *arrLong = new PRInt32 [50]; + printf("--before call TestOut17 data array.\n"); + t1->TestOut17(&arrCount2, &arrLong); + f_res << form("TestOut17 count %d\n", arrCount2); + for (int i = 0; i < arrCount2; i++) { + f_res << form("TestOut17 Array[%d]=%d\n",i,arrLong[i]); + } + delete arrLong; + + printf("____________________________________________\n"); + + + f_res.close(); } diff --git a/mozilla/xpcom/remote/tests/common.cpp b/mozilla/xpcom/remote/tests/common.cpp new file mode 100644 index 00000000000..4ee3d88a567 --- /dev/null +++ b/mozilla/xpcom/remote/tests/common.cpp @@ -0,0 +1,119 @@ +#include +#include +#include +#include +#include +#include +#include "proto.h" + +/************************************************ + * Retrieves the server's process id + * from the data file. + ************************************************/ + +void getProcessId(char *fname, char *s) +{ + char ch; + short i = 0; + + ifstream f_in(fname); + if (!f_in) { + cerr << "Cannot open file %s.\n" << fname; + exit(1); + } + while(1){ + if (f_in.eof()) break; + f_in >> ch; + s[i++] = ch; + } + s[i-1] = '\0'; + f_in.close(); +} + +/*********************************************** + * Saves the server's process id + * in to the data file. + ***********************************************/ + +void setProcessId(char *fname) +{ + int pid = getpid(); + cout << "%x\n" << pid; + ofstream f_out(fname); + if(!f_out) { + cerr << "Cannot open file" << fname; + exit(1); + } + f_out << form("%x",pid); + f_out.close(); +} + +/*********************************************** + * Writes the string into the result data + * file by appending it into the existing data. + ***********************************************/ + +void writeResult(char *fname, char *str) { + + char **buf = new char *[500]; + int line = readFromFile(fname, buf); + int len = strlen(str); + buf[line] = new char[len]; + strcpy(buf[line], str); + writeToFile(fname, line + 1, buf); + for(int i = 0; i < line; i++){ + delete buf[i]; + } + delete buf; +} + +/*********************************************** + * Reads the content of the result data file. + * + ***********************************************/ + +int readFromFile(char *fname, char **buf) { + + + int i = 0; + ifstream f_in(fname); + if (!f_in) { + return i; + } + char *tmpbuf = new char[400]; + char ch; + int j = 0; + while(!f_in.eof()) { + f_in.get(ch); + tmpbuf[j++] = ch; + if (ch == '\n') { + tmpbuf[j] = '\0'; + buf[i] = new char[strlen(tmpbuf)]; + strcpy(buf[i++], tmpbuf); + j = 0; + } + } + delete tmpbuf; + f_in.close(); + return i; +} + +/*********************************************** + * Writes the content of the buffer to the + * of the result data file. + + ***********************************************/ +void writeToFile(char *fname, int numLine, char **buf) { + + ofstream f_out(fname); + if (!f_out) { + cerr << "Error in reading file %s.\n" << fname; + exit(1); + } + int i; + for(i = 0; i < numLine; i++) { + f_out << buf[i]; + } + f_out.close(); +} + diff --git a/mozilla/xpcom/remote/tests/deftest.h b/mozilla/xpcom/remote/tests/deftest.h new file mode 100644 index 00000000000..f4e5a9cd2d1 --- /dev/null +++ b/mozilla/xpcom/remote/tests/deftest.h @@ -0,0 +1,18 @@ +#define BUF_MAX 500 +#define BUF_MIN 100 +#define SERVER_IN_RES "serverIn.res" +#define CLIENT_IN_RES "clientIn.res" +#define SERVER_OUT_RES "serverOut.res" +#define CLIENT_OUT_RES "clientOut.res" +#define SERVER_INOUT_RES "serverInOut.res" +#define CLIENT_INOUT_RES "clientInOut.res" +#define SERVER_COMB_RES "serverComb.res" +#define CLIENT_COMB_RES "clientComb.res" +#define IN_FDATA "fileIn.dat" +#define OUT_FDATA "fileOut.dat" +#define INOUT_FDATA "fileInOut.dat" +#define COMB_FDATA "fileComb.dat" +#define USHRT_MIN 555 +#define ULONG_MIN 555 + + diff --git a/mozilla/xpcom/remote/tests/nsIRPCTest.idl b/mozilla/xpcom/remote/tests/nsIRPCTest.idl index e36fcd7f2c7..141593ee4b7 100644 --- a/mozilla/xpcom/remote/tests/nsIRPCTest.idl +++ b/mozilla/xpcom/remote/tests/nsIRPCTest.idl @@ -1,23 +1,3 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include "nsISupports.idl" [scriptable, uuid(e7fc2bf4-1dd1-11b2-9253-8efe01a2f0d2)] diff --git a/mozilla/xpcom/remote/tests/nsIRPCTestComb.idl b/mozilla/xpcom/remote/tests/nsIRPCTestComb.idl new file mode 100644 index 00000000000..a673d5ea6ca --- /dev/null +++ b/mozilla/xpcom/remote/tests/nsIRPCTestComb.idl @@ -0,0 +1,47 @@ +#include "nsISupports.idl" + +[scriptable, uuid(89eb8f10-c211-11d3-ad2a-005004159574)] +interface nsIRPCTestComb : nsISupports +{ + + void testComb1(in boolean bool, out char c); //FAILED + void testComb2(in boolean bool, inout string str); + void testComb3(out char c, inout string str); + void testComb4(inout string str, in boolean bool, out char c); //FAILED + void testComb5(in short s, out char c); + void testComb6(in boolean bool, out short s); //FAILED + void testComb7(in boolean bool, inout short s); //FAILED + void testComb8(in boolean bool, in short s); + void testComb9(in boolean bool, in char c); + void testComb10(in boolean bool, out string str); + void testComb11(in boolean bool, inout char c); + void testComb12(in boolean bool, out long l); + void testComb13(in boolean bool, inout long l); + void testComb14(in boolean bool, in long l); + void testComb15(in boolean bool, out double d); + void testComb16(in boolean bool, inout double d); + void testComb17(in boolean bool, inout unsigned short us); + void testComb18(in boolean bool, out unsigned short us); //FAILED + void testComb19(in boolean bool, out octet o); //FAILED + void testComb20(in boolean bool, inout octet o); //FAILED + void testComb21(in boolean bool, in octet o); + void testComb22(in boolean bool, in boolean bool2); + void testComb23(in boolean bool, inout boolean bool2); + void testComb24(in boolean bool, out boolean bool2); + void testComb25(out boolean bool, out char c); //FAILED + void testComb26(inout boolean bool, out char c); //FAILED + void testComb27(in boolean bool, out wchar wc); //FAILED + + void testComb30(in string s1, out string s2); + void testComb31(out octet o, out unsigned short us); //FAILED + void testComb32(out octet o, out long l); //FAILED after TransportImpl::Write + void testComb33(out long l, out unsigned short us); //FAILED + +// void testComb36(inout boolean bBool, inout char cChar, inout octet nByte, +// inout short nShort, inout unsigned short nUShort, +// inout long nLong, inout unsigned long nULong, +// inout long long nHyper, inout unsigned long long nUHyper, +// inout float fFloat, inout double fDouble, +// inout wstring aString); + +}; diff --git a/mozilla/xpcom/remote/tests/nsIRPCTestIn.idl b/mozilla/xpcom/remote/tests/nsIRPCTestIn.idl index 8192f57242e..c65df47325d 100644 --- a/mozilla/xpcom/remote/tests/nsIRPCTestIn.idl +++ b/mozilla/xpcom/remote/tests/nsIRPCTestIn.idl @@ -1,41 +1,38 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include "nsISupports.idl" [scriptable, uuid(9cc10d00-b191-11d3-ad1e-005004159574)] interface nsIRPCTestIn : nsISupports { - void test1(in boolean bool); - void test2(in octet oct); - void test3(in short s); - void test4(in long l); - void test5(in long long ll); - void test6(in unsigned short us); - void test7(in unsigned long ul); - void test8(in unsigned long long ull); - void test9(in float f); - void test10(in double d); - void test11(in char c); - void test12(in wchar wc); - void test13(in string str); -// void test14(in wstring wstr); -// void test20(in boolean abool); + void testIn1(in boolean bool); + void testIn2(in octet oct); + void testIn3(in short s); + void testIn4(in long l); + void testIn5(in long long ll); + void testIn6(in unsigned short us); + void testIn7(in unsigned long ul); + void testIn8(in unsigned long long ull); + void testIn9(in float f); + void testIn10(in double d); + void testIn11(in char c); + void testIn12(in wchar wc); + void testIn13(in string str); + void testIn14(in wstring wstr); +// WONT RUN void testIn15(in long count,[array, size_is(count)] in string valueArray); + void testIn15(in unsigned long count,[array, size_is(count)] in string valueArray); + void testIn16(in unsigned long count, [array, size_is(count)] in long longArray); + void testIn17(in boolean bBool, in char cChar, in octet nByte, + in short nShort, in unsigned short nUShort, + in long nLong, in unsigned long nULong, + in long long nHyper, in unsigned long long nUHyper, + in float fFloat, in double fDouble, + in string aString, + in unsigned long count, [array, size_is(count)] in long longArray); + void testIn18(in char cChar, in octet nByte, + in short nShort, in unsigned short nUShort, + in long nLong, in unsigned long nULong, + in long long nHyper, in unsigned long long nUHyper, + in float fFloat, in double fDouble, + in string aString, + in unsigned long count, [array, size_is(count)] in long longArray); + }; diff --git a/mozilla/xpcom/remote/tests/nsIRPCTestInOut.idl b/mozilla/xpcom/remote/tests/nsIRPCTestInOut.idl index 2ff9b35071d..a5bfe687a25 100644 --- a/mozilla/xpcom/remote/tests/nsIRPCTestInOut.idl +++ b/mozilla/xpcom/remote/tests/nsIRPCTestInOut.idl @@ -1,40 +1,34 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include "nsISupports.idl" -[scriptable, uuid(e284f6a0-b701-11d3-ad26-005004159574)] +[scriptable, uuid(16d17950-cdf5-11d3-ad2e-005004159574)] interface nsIRPCTestInOut : nsISupports { - void test1(inout boolean bool); - void test2(inout octet oct); - void test3(inout short s); - void test4(inout long l); - void test5(inout long long ll); - void test6(inout unsigned short us); - void test7(inout unsigned long ul); - void test8(inout unsigned long long ull); - void test9(inout float f); - void test10(inout double d); - void test11(inout char c); - void test12(inout wchar wc); - void test13(inout string str); -// void test14(inout wstring wstr); + void testInOut1(inout boolean bool); + void testInOut2(inout octet oct); //FAILED in IN (0) + void testInOut3(inout short s); // FAILED in IN (0) + void testInOut4(inout long l); + void testInOut5(inout long long ll); + void testInOut6(inout unsigned short us); //FAILED in IN (0) + void testInOut7(inout unsigned long ul); + void testInOut8(inout unsigned long long ull); + void testInOut9(inout float f); + void testInOut10(inout double d); + void testInOut11(inout char c); + void testInOut12(inout wchar wc); //FAILED core dump + void testInOut13(inout string str); + void testInOut14(inout wstring wstr); + void testInOut15(inout unsigned long count, [array, size_is(count)] inout char array); + void testInOut16(inout boolean bBool, inout char cChar, + inout unsigned short nUShort, + inout long nLong, inout unsigned long nULong, + inout long long nHyper, inout unsigned long long nUHyper, + inout float fFloat, inout double fDouble, + inout string aString); + void testInOut17(inout unsigned long count, [array, size_is(count)] inout long array); + void testInOut18(inout boolean bBool, inout char cChar, inout octet nByte, + inout short nShort, inout unsigned short nUShort, + inout long nLong, inout unsigned long nULong, + inout long long nHyper, inout unsigned long long nUHyper, + inout float fFloat, inout double fDouble, + inout string aString); }; diff --git a/mozilla/xpcom/remote/tests/nsIRPCTestOut.idl b/mozilla/xpcom/remote/tests/nsIRPCTestOut.idl index 1425ece5567..247763f2e75 100644 --- a/mozilla/xpcom/remote/tests/nsIRPCTestOut.idl +++ b/mozilla/xpcom/remote/tests/nsIRPCTestOut.idl @@ -1,40 +1,28 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include "nsISupports.idl" [scriptable, uuid(e284f6a0-b701-11d3-ad26-005004159574)] interface nsIRPCTestOut : nsISupports { - void test1(out boolean bool); - void test2(out octet oct); - void test3(out short s); - void test4(out long l); - void test5(out long long ll); - void test6(out unsigned short us); - void test7(out unsigned long ul); - void test8(out unsigned long long ull); - void test9(out float f); - void test10(out double d); - void test11(out char c); - void test12(out wchar wc); - void test13(out string str); -// void test14(out wstring wstr); + void testOut1(out boolean bool); + void testOut2(out octet oct); + void testOut3(out short s); + void testOut4(out long l); + void testOut5(out long long ll); + void testOut6(out unsigned short us); + void testOut7(out unsigned long ul); + void testOut8(out unsigned long long ull); + void testOut9(out float f); + void testOut10(out double d); + void testOut11(out char c); + void testOut12(out wchar wc); + void testOut13(out string str); + void testOut14(out wstring wstr); + void testOut15(out unsigned long count, [array, size_is(count)] out char array); + void testOut16(out boolean bBool, out char cChar, out octet nByte, + out short nShort, out unsigned short nUShort, + out long nLong, out unsigned long nULong, + out long long nHyper, out unsigned long long nUHyper, + out float fFloat, out double fDouble, + out string aString); + void testOut17(out unsigned long count, [array, size_is(count)] out long array); }; diff --git a/mozilla/xpcom/remote/tests/proto.h b/mozilla/xpcom/remote/tests/proto.h new file mode 100644 index 00000000000..d65042c76f2 --- /dev/null +++ b/mozilla/xpcom/remote/tests/proto.h @@ -0,0 +1,5 @@ +void setProcessId(char *); +void getProcessId(char *, char *s); +void writeResult(char *, char *); +void writeToFile(char *, int, char **); +int readFromFile(char *, char **); diff --git a/mozilla/xpcom/remote/tests/sComb b/mozilla/xpcom/remote/tests/sComb new file mode 100755 index 00000000000..73803f2d496 --- /dev/null +++ b/mozilla/xpcom/remote/tests/sComb @@ -0,0 +1,2 @@ +clean +serverComb diff --git a/mozilla/xpcom/remote/tests/sIO b/mozilla/xpcom/remote/tests/sIO new file mode 100755 index 00000000000..9b9683df6f8 --- /dev/null +++ b/mozilla/xpcom/remote/tests/sIO @@ -0,0 +1,2 @@ +clean +serverInOut diff --git a/mozilla/xpcom/remote/tests/sIn b/mozilla/xpcom/remote/tests/sIn new file mode 100755 index 00000000000..b3586ac1bfc --- /dev/null +++ b/mozilla/xpcom/remote/tests/sIn @@ -0,0 +1,2 @@ +clean +serverIn diff --git a/mozilla/xpcom/remote/tests/sOut b/mozilla/xpcom/remote/tests/sOut new file mode 100755 index 00000000000..f4dc6093f07 --- /dev/null +++ b/mozilla/xpcom/remote/tests/sOut @@ -0,0 +1,2 @@ +clean +serverOut diff --git a/mozilla/xpcom/remote/tests/server.cpp b/mozilla/xpcom/remote/tests/server.cpp index cf980b4b891..4f4cd37621c 100644 --- a/mozilla/xpcom/remote/tests/server.cpp +++ b/mozilla/xpcom/remote/tests/server.cpp @@ -1,23 +1,3 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include #include "RPCServerService.h" #include "nsISupports.h" diff --git a/mozilla/xpcom/remote/tests/serverComb.cpp b/mozilla/xpcom/remote/tests/serverComb.cpp new file mode 100644 index 00000000000..847d1d639f5 --- /dev/null +++ b/mozilla/xpcom/remote/tests/serverComb.cpp @@ -0,0 +1,431 @@ +#include +#include +#include +#include +#include "RPCServerService.h" +#include "nsISupports.h" +#include "nsIJVMManager.h" +#include "nsIRPCTestComb.h" +#include "IDispatcher.h" +#include "nsIThread.h" +#include "deftest.h" +#include "proto.h" + +class nsRPCTestCombImpl : public nsIRPCTestComb { + + + NS_DECL_ISUPPORTS + nsRPCTestCombImpl() { + NS_INIT_REFCNT(); + } + + NS_IMETHOD TestComb1(PRBool bool, char *c) { + printf("TestComb1 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test1 %d\n",bool); + printf("Before character assignment.\n"); + *c = 'Z'; + printf("After character assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb1 %c\n",*c); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb2(PRBool bool, char **s) { + printf("TestComb2 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test2 %d\n",bool); + printf("--nsRPCTestCombImpl::Test2 %s\n",*s); + printf("Before string assignment.\n"); + *s = "Remote ipc tests."; + printf("After string assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb2 %s\n",*s); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb3(char *c, char **s) { + printf("TestComb3 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test3 %s\n",*s); + printf("Before character assignment.\n"); + *c = 'Z'; + printf("After character assignment.\n"); + printf("Before string assignment.\n"); + *s = "Remote ipc tests."; + printf("After string assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb3 %c %s\n",*c,*s); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb4(char **s, PRBool bool, char *c) { + printf("TestComb4 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test4 %d\n",bool); + printf("--nsRPCTestCombImpl::Test4 %s\n",*s); + printf("Before character assignment.\n"); + *c = 'Z'; + printf("After character assignment.\n"); + printf("Before string assignment.\n"); + *s = "Remote ipc tests."; + printf("After string assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb4 %c %s\n",*c,*s); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb5(PRInt16 sInt, char *c) { + printf("TestComb5 this=%p\n", this); + printf("Before character assignment.\n"); + *c = 'Z'; + printf("After character assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb5 %c\n",*c); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb6(PRBool bool, PRInt16 *sInt) { + printf("TestComb6 this=%p\n", this); + printf("Before short int assignment.\n"); + *sInt = 777; + printf("After short int assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb6 %d\n",*sInt); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb7(PRBool bool, PRInt16 *sInt) { + printf("TestComb7 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test7 %d\n",*sInt); + printf("Before short int assignment.\n"); + *sInt = 777; + printf("After short int assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb7 %d\n",*sInt); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb8(PRBool bool, PRInt16 sInt) { + printf("TestComb8 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test8 %d\n",sInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb8 %d %d\n",bool, sInt); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb9(PRBool bool, char c) { + printf("TestComb9 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test9 %d\n",c); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb9 %d %c\n",bool, c); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb10(PRBool bool, char **s) { + printf("TestComb10 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test10 %d\n",bool); + printf("Before string assignment.\n"); + *s = "Remote ipc tests."; + printf("After string assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb10 %s\n",*s); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb11(PRBool bool, char *c) { + printf("TestComb11 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test11 %d\n",*c); + *c = 'Z'; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb11 %c\n",*c); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb12(PRBool bool, PRInt32 *l) { + printf("TestComb12 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test12 %d\n",bool); + *l = 99999999; + printf("After long integer assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb12 %d\n",*l); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb13(PRBool bool, PRInt32 *l) { + printf("TestComb13 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test13 %d\n",bool); + printf("--nsRPCTestCombImpl::Test13 %d\n",*l); + *l = 99999999; + printf("After long integer assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb13 %d\n",*l); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb14(PRBool bool, PRInt32 l) { + printf("TestComb14 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test14 %d\n",bool); + printf("--nsRPCTestCombImpl::Test14 %d\n",l); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb14 %d %d\n",bool, l); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb15(PRBool bool, double *d) { + printf("TestComb15 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test15 %d\n",bool); + *d = 9999999.9999999; + printf("After long integer assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb15 %.50f\n",*d); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb16(PRBool bool, double *d) { + printf("TestComb16 this=%p\n", this); + printf("--nsRPCTestCombImpl::Test16 %d\n",bool); + printf("--nsRPCTestCombImpl::Test16 %d\n",*d); + *d = 9999999.9999999; + printf("After long integer assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb16 %.50f\n", *d); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb17(PRBool bool, PRUint16 *usInt) { + printf("TestComb17 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test17 %d\n",*usInt); + printf("Before unsigned short int assignment.\n"); + *usInt = 777; + printf("After unsigned short int assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb17 %d\n",*usInt); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb18(PRBool bool, PRUint16 *usInt) { + printf("TestComb18 this=%p\n", this); + printf("Before unsigned short int assignment.\n"); + *usInt = 777; + printf("After unsigned short int assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb18 %d\n",*usInt); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb19(PRBool bool, PRUint8 *oct) { + printf("TestComb19 this=%p\n", this); + printf("Before assignment.\n"); + *oct = 77; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb19 %o\n",*oct); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb20(PRBool bool, PRUint8 *oct) { + printf("TestComb20 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test20 %d\n",*oct); + printf("Before assignment.\n"); + *oct = 77; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb20 %o\n",*oct); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb21(PRBool bool, PRUint8 oct) { + printf("TestComb21 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test21 %d\n",oct); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb21 %d %o\n",bool,oct); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb22(PRBool bool, PRBool bool2 ) { + printf("TestComb22 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test22 %d\n",bool2); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb22 %d %d\n",bool,bool2); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb23(PRBool bool, PRBool *bool2 ) { + printf("TestComb23 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test23 %d\n",*bool2); + printf("Before assignment.\n"); + *bool2 = PR_FALSE; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb23 %d\n",*bool2); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb24(PRBool bool, PRBool *bool2 ) { + printf("TestComb24 this=%p\n", this); + printf("Before assignment.\n"); + *bool2 = PR_FALSE; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb24 %d\n",*bool2); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb25(PRBool *bool, char *c) { + printf("TestComb25 this=%p\n", this); + printf("Before assignment.\n"); + *bool = PR_FALSE; + *c = 'Z'; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb25 %d %c\n",*bool,*c); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb26(PRBool *bool, char *c) { + printf("TestComb26 this=%p\n", this); + printf("--nsRPCTestCombInImpl::Test26 %d\n",*bool); + printf("Before assignment.\n"); + *bool = PR_FALSE; + *c = 'Z'; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb26 %d %c\n",*bool,*c); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb27(PRBool bool, PRUnichar *wc) { + printf("TestComb27 this=%p\n", this); + printf("Before assignment.\n"); + *wc = 'Z'; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb27 %c\n",*wc); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb30(const char *s1, char **s2) { + printf("TestComb30 this=%p\n", this); + printf("Before assignment.\n"); + *s2 = "Remote ipc test."; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb30 %s\n",*s2); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb31(PRUint8 *o, PRUint16 *usInt) { + printf("TestComb31 this=%p\n", this); + printf("Before assignment.\n"); + *o = 777; + *usInt = 999; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb31 %o %u\n",*o,*usInt); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb32(PRUint8 *o, PRInt32 *lInt) { + printf("TestComb32 this=%p\n", this); + printf("Before assignment.\n"); + *o = 99; + *lInt = 9999999; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb32 %o %u\n",*o,*lInt); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestComb33(PRInt32 *lInt, PRUint16 *us) { + printf("TestComb33 this=%p\n", this); + printf("Before assignment.\n"); + *us = 777; + *lInt = 9999999; + printf("After assignment.\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestComb33 %d %u\n",*lInt,*us); + writeResult(SERVER_COMB_RES,tmpstr); + delete tmpstr; + return NS_OK; + } +}; + +NS_IMPL_ISUPPORTS(nsRPCTestCombImpl, NS_GET_IID(nsIRPCTestComb)); +int main(int argc, char **args) +{ + int i; + const short num = 4; + nsRPCTestCombImpl * test[num]; + + setProcessId(COMB_FDATA); + for(i = 0; i < num; i++) { + test[i] = new nsRPCTestCombImpl(); + } + RPCServerService * rpcService = RPCServerService::GetInstance(); + IDispatcher *dispatcher; + rpcService->GetDispatcher(&dispatcher); + for(i = 0; i < num; i++) { + dispatcher->RegisterWithOID(test[i], i + 1); + } + while(1) { + PR_Sleep(100); + } + +} diff --git a/mozilla/xpcom/remote/tests/serverIn.cpp b/mozilla/xpcom/remote/tests/serverIn.cpp index 475d85bc32a..bde2268b1c7 100644 --- a/mozilla/xpcom/remote/tests/serverIn.cpp +++ b/mozilla/xpcom/remote/tests/serverIn.cpp @@ -1,31 +1,16 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include +#include +#include +#include #include "RPCServerService.h" #include "nsISupports.h" #include "nsIJVMManager.h" #include "nsIRPCTestIn.h" -#include #include "IDispatcher.h" #include "nsIThread.h" +#include "deftest.h" +#include "proto.h" + class nsRPCTestInImpl : public nsIRPCTestIn { NS_DECL_ISUPPORTS @@ -33,127 +18,287 @@ class nsRPCTestInImpl : public nsIRPCTestIn { NS_INIT_REFCNT(); } - NS_IMETHOD Test1(PRBool bool) { - printf("Test1 this=%p\n", this); + NS_IMETHOD TestIn1(PRBool bool) { + printf("TestIn1 this=%p\n", this); printf("--nsRPCTestInImpl::Test1 %d\n",bool); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn1 %d\n",bool); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test2(PRUint8 octet) { - printf("Test2 this=%p\n", this); + NS_IMETHOD TestIn2(PRUint8 octet) { + printf("TestIn2 this=%p\n", this); printf("--nsRPCTestInImpl::Test2 %d\n",octet); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn2 %o\n",octet); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test3(PRInt16 sInt) { - printf("Test3 this=%p\n", this); + NS_IMETHOD TestIn3(PRInt16 sInt) { + printf("TestIn3 this=%p\n", this); printf("--nsRPCTestInImpl::Test3 %d\n",sInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn3 %d\n",sInt); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test4(PRInt32 lInt) { - printf("Test4 this=%p\n", this); + NS_IMETHOD TestIn4(PRInt32 lInt) { + printf("TestIn4 this=%p\n", this); printf("--nsRPCTestInImpl::Test4 %d\n",lInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn4 %d\n",lInt); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test5(PRInt64 llInt) { - printf("Test5 this=%p\n", this); + NS_IMETHOD TestIn5(PRInt64 llInt) { + printf("TestIn5 this=%p\n", this); printf("--nsRPCTestInImpl::Test5 %d\n",llInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn5 %d\n",llInt); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test6(PRUint16 usInt) { - printf("Test6 this=%p\n", this); - printf("--nsRPCTestInImpl::Test6 %15u\n",usInt); + NS_IMETHOD TestIn6(PRUint16 usInt) { + printf("TestIn6 this=%p\n", this); + printf("--nsRPCTestInImpl::Test6 %u\n",usInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn6 %u\n",usInt); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test7(PRUint32 ulInt) { - printf("Test7 this=%p\n", this); - printf("--nsRPCTestInImpl::Test7 %15u\n",ulInt); + NS_IMETHOD TestIn7(PRUint32 ulInt) { + printf("TestIn7 this=%p\n", this); + printf("--nsRPCTestInImpl::Test7 %u\n",ulInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn7 %u\n",ulInt); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test8(PRUint64 ullInt) { - printf("Test8 this=%p\n", this); - printf("--nsRPCTestInImpl::Test8 %15u\n",ullInt); + NS_IMETHOD TestIn8(PRUint64 ullInt) { + printf("TestIn8 this=%p\n", this); + printf("--nsRPCTestInImpl::Test8 %u\n",ullInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn8 %u\n",ullInt); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test9(float f) { - printf("Test9 this=%p\n", this); + NS_IMETHOD TestIn9(float f) { + printf("TestIn9 this=%p\n", this); printf("--nsRPCTestInImpl::Test9 %.50f\n",f); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn9 %.50f\n",f); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test10(double d) { - printf("Test10 this=%p\n", this); + NS_IMETHOD TestIn10(double d) { + printf("TestIn10 this=%p\n", this); printf("--nsRPCTestInImpl::Test10 %.50f\n",d); + char *tmpstr = new char[500]; + sprintf(tmpstr,"TestIn10 %.50f\n",d); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test11(char c) { - printf("Test11 this=%p\n", this); + NS_IMETHOD TestIn11(char c) { + printf("TestIn11 this=%p\n", this); printf("--nsRPCTestInImpl::Test11 %c\n",c); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn11 %c\n",c); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test12(PRUnichar unic) { - printf("Test12 this=%p\n", this); + NS_IMETHOD TestIn12(PRUnichar unic) { + printf("TestIn12 this=%p\n", this); printf("--nsRPCTestInImpl::Test12 %c\n",unic); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn12 %c\n",unic); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test13(const char* s) { - printf("Test13 this=%p\n", this); + NS_IMETHOD TestIn13(const char* s) { + printf("TestIn13 this=%p\n", this); printf("--nsRPCTestInImpl::Test13 %s\n",s); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn13 %s\n",s); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; return NS_OK; } -// NS_IMETHOD Test14(PRUnichar* unis) { -// printf("Test14 this=%p\n", this); -// printf("--nsRPCTestInImpl::Test14 %s\n",unis); -// return NS_OK; -// } - + NS_IMETHOD TestIn14(const PRUnichar* unis) { + printf("TestIn14 this=%p\n", this); + printf("--nsRPCTestInImpl::Test14 %s\n",unis); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn14 %s\n",unis); + writeResult(SERVER_IN_RES, tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestIn15(PRUint32 count, const char **valueArray) { + printf("--TestIn15\n"); + printf("count %d\n",count); + char *tmpstr = new char[200]; + sprintf(tmpstr, "TestIn15 count %d\n", count); + writeResult(SERVER_IN_RES, tmpstr); + for (int i = 0; i < count; i++) { + printf("TestIn15 Array[%d]=%s\n",i,valueArray[i]); + sprintf(tmpstr,"TestIn15 Array[%d]=%s\n",i,valueArray[i]); + writeResult(SERVER_IN_RES, tmpstr); + } + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestIn16(PRUint32 count, PRInt32 *longArray) { + printf("--TestIn16\n"); + printf("count %d\n",count); + char *tmpstr = new char[200]; + sprintf(tmpstr, "TestIn16 count %d\n", count); + writeResult(SERVER_IN_RES, tmpstr); + for (int i = 0; i < count; i++) { + printf("TestIn16 Array[%d]=%d\n",i,longArray[i]); + sprintf(tmpstr,"TestIn16 Array[%d]=%d\n",i,longArray[i]); + writeResult(SERVER_IN_RES, tmpstr); + } + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestIn17(PRBool bBool, char cChar, PRUint8 nByte, + PRInt16 nShort, PRUint16 nUShort, + PRInt32 nLong,PRUint32 nULong, + PRInt64 nHyper, PRUint64 nUHyper, + float fFloat, double fDouble, const char *aString, + PRUint32 count, PRInt32 *longArray) + { + + printf("TestIn17 this=%p\n", this) ; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestIn17 PRBool %d\n",bBool); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 PRUint8 %o\n",nByte); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 PRInt16 %d\n",nShort); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 PRInt32 %d\n",nLong); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 PRInt64 %d\n",nHyper); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 PRUint16 %u\n",nUShort); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 PRUint32 %u\n",nULong); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 PRUint64 %u\n",nUHyper); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 float %.50f\n",fFloat); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 double %.50f\n",fDouble); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 char %c\n",cChar); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 string %s\n",aString); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn17 count %d\n", count); + writeResult(SERVER_IN_RES, tmpstr); + for (int i = 0; i < count; i++) { + printf("TestIn17 Array[%d]=%d\n",i,longArray[i]); + sprintf(tmpstr,"TestIn17 Array[%d]=%d\n",i,longArray[i]); + writeResult(SERVER_IN_RES, tmpstr); + } + + delete tmpstr; + return NS_OK; + + } + + NS_IMETHOD TestIn18(char cChar, PRUint8 nByte, + PRInt16 nShort, PRUint16 nUShort, + PRInt32 nLong,PRUint32 nULong, + PRInt64 nHyper, PRUint64 nUHyper, + float fFloat, double fDouble, const char *aString, + PRUint32 count, PRInt32 *longArray) + { + printf("TestIn18 this=%p\n", this); + char *tmpstr = new char[200]; + + sprintf(tmpstr,"TestIn18 PRUint8 %o\n",nByte); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 PRInt16 %d\n",nShort); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 PRInt32 %d\n",nLong); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 PRInt64 %d\n",nHyper); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 PRUint16 %u\n",nUShort); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 PRUint32 %u\n",nULong); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 PRUint64 %u\n",nUHyper); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 float %.50f\n",fFloat); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 double %.50f\n",fDouble); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 char %c\n",cChar); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 string %s\n",aString); + writeResult(SERVER_IN_RES, tmpstr); + sprintf(tmpstr,"TestIn18 count %d\n", count); + writeResult(SERVER_IN_RES, tmpstr); + for (int i = 0; i < count; i++) { + printf("TestIn18 Array[%d]=%d\n",i,longArray[i]); + sprintf(tmpstr,"TestIn18 Array[%d]=%d\n",i,longArray[i]); + writeResult(SERVER_IN_RES, tmpstr); + } + + delete tmpstr; + return NS_OK; + + } + }; NS_IMPL_ISUPPORTS(nsRPCTestInImpl, NS_GET_IID(nsIRPCTestIn)); int main(int argc, char **args) { - printf("%x\n",getpid()); - nsRPCTestInImpl * test1 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test2 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test3 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test4 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test5 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test6 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test7 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test8 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test9 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test10 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test11 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test12 = new nsRPCTestInImpl(); - nsRPCTestInImpl * test13 = new nsRPCTestInImpl(); + int i; + const short num = 2; + nsRPCTestInImpl * test[num]; + + setProcessId(IN_FDATA); + for(i = 0; i < num; i++) { + test[i] = new nsRPCTestInImpl(); + } RPCServerService * rpcService = RPCServerService::GetInstance(); IDispatcher *dispatcher; rpcService->GetDispatcher(&dispatcher); - dispatcher->RegisterWithOID(test1, 1); - dispatcher->RegisterWithOID(test2, 5); - dispatcher->RegisterWithOID(test3, 7); - dispatcher->RegisterWithOID(test4, 9); - dispatcher->RegisterWithOID(test5, 11); - dispatcher->RegisterWithOID(test6, 13); - dispatcher->RegisterWithOID(test7, 15); - dispatcher->RegisterWithOID(test8, 17); - dispatcher->RegisterWithOID(test9, 19); - dispatcher->RegisterWithOID(test10, 21); - dispatcher->RegisterWithOID(test11, 23); - dispatcher->RegisterWithOID(test12, 25); - dispatcher->RegisterWithOID(test13, 27); + for(i = 0; i < num; i++) { + dispatcher->RegisterWithOID(test[i], i + 1); + } while(1) { PR_Sleep(100); } - } - diff --git a/mozilla/xpcom/remote/tests/serverInOut.cpp b/mozilla/xpcom/remote/tests/serverInOut.cpp index b69c80b3b48..bbc70488856 100644 --- a/mozilla/xpcom/remote/tests/serverInOut.cpp +++ b/mozilla/xpcom/remote/tests/serverInOut.cpp @@ -1,32 +1,17 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include #include +#include +#include +#include +#include #include "RPCServerService.h" #include "nsISupports.h" #include "nsIJVMManager.h" #include "nsIRPCTestInOut.h" -#include #include "IDispatcher.h" #include "nsIThread.h" +#include "deftest.h" +#include "proto.h" class nsRPCTestInOutImpl : public nsIRPCTestInOut { NS_DECL_ISUPPORTS @@ -34,140 +19,443 @@ class nsRPCTestInOutImpl : public nsIRPCTestInOut { NS_INIT_REFCNT(); } - NS_IMETHOD Test1(PRBool *bool) { - printf("Test1 this=%p\n", this); + NS_IMETHOD TestInOut1(PRBool *bool) { + printf("TestInOut1 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test1 %d\n",*bool); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut1 before %d\n",*bool); + writeResult(SERVER_INOUT_RES, tmpstr); *bool = PR_FALSE; + sprintf(tmpstr,"TestInOut1 after %d\n",*bool); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test2(PRUint8 *octet) { - printf("Test2 this=%p\n", this); - printf("--nsRPCTestInOutImpl::Test2 %d\n",*octet); + NS_IMETHOD TestInOut2(PRUint8 *octet) { + printf("TestInOut2 this=%p\n", this); + printf("--nsRPCTestInOutImpl::Test2 %o\n",*octet); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut2 before %o\n",*octet); + writeResult(SERVER_INOUT_RES, tmpstr); *octet = 88; + sprintf(tmpstr,"TestInOut2 after %o\n",*octet); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test3(PRInt16 *sInt) { - printf("Test3 this=%p\n", this); -// printf("--nsRPCTestInOutImpl::Test3 %d\n",*sInt); - *sInt = 9999; + NS_IMETHOD TestInOut3(PRInt16 *sInt) { + printf("TestInOut3 this=%p\n", this); + printf("--nsRPCTestInOutImpl::Test3 %d\n",*sInt); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut3 before %d\n",*sInt); + writeResult(SERVER_INOUT_RES, tmpstr); + *sInt = SHRT_MAX; + sprintf(tmpstr,"TestInOut3 after %d\n",*sInt); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test4(PRInt32 *lInt) { - printf("Test4 this=%p\n", this); + NS_IMETHOD TestInOut4(PRInt32 *lInt) { + printf("TestInOut4 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test4 %d\n",*lInt); - *lInt = 99999; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut4 before %l\n",*lInt); + writeResult(SERVER_INOUT_RES, tmpstr); + *lInt = LONG_MAX; + sprintf(tmpstr,"TestInOut4 after %l\n",*lInt); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test5(PRInt64 *llInt) { - printf("Test5 this=%p\n", this); + NS_IMETHOD TestInOut5(PRInt64 *llInt) { + printf("TestInOut5 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test5 %d\n",*llInt); - *llInt = 999999; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut5 before %l\n",*llInt); + writeResult(SERVER_INOUT_RES, tmpstr); + *llInt = LONG_MAX; + sprintf(tmpstr,"TestInOut5 after %l\n",*llInt); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test6(PRUint16 *usInt) { - printf("Test6 this=%p\n", this); + NS_IMETHOD TestInOut6(PRUint16 *usInt) { + printf("TestInOut6 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test6 %15u\n",*usInt); - *usInt = 9999; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut6 before %10u\n",*usInt); + writeResult(SERVER_INOUT_RES, tmpstr); + *usInt = USHRT_MAX; + sprintf(tmpstr,"TestInOut6 after %10u\n",*usInt); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test7(PRUint32 *ulInt) { - printf("Test7 this=%p\n", this); + NS_IMETHOD TestInOut7(PRUint32 *ulInt) { + printf("TestInOut7 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test7 %15u\n",*ulInt); - *ulInt = 99999; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut7 before %10u\n",*ulInt); + writeResult(SERVER_INOUT_RES, tmpstr); + *ulInt = ULONG_MAX; + sprintf(tmpstr,"TestInOut7 after %10u\n",*ulInt); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test8(PRUint64 *ullInt) { - printf("Test8 this=%p\n", this); + NS_IMETHOD TestInOut8(PRUint64 *ullInt) { + printf("TestInOut8 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test8 %15u\n",*ullInt); - *ullInt = 9999999; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut8 before %10u\n",*ullInt); + writeResult(SERVER_INOUT_RES, tmpstr); + *ullInt = ULONG_MAX; + sprintf(tmpstr,"TestInOut8 after %10u\n",*ullInt); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test9(float *f) { - printf("Test9 this=%p\n", this); + NS_IMETHOD TestInOut9(float *f) { + printf("TestInOut9 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test9 %.50f\n",*f); - *f = 999.999; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut9 before %.50f\n",*f); + writeResult(SERVER_INOUT_RES, tmpstr); + *f = FLT_MAX; + sprintf(tmpstr,"TestInOut9 after %.50f\n",*f); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test10(double *d) { - printf("Test10 this=%p\n", this); + NS_IMETHOD TestInOut10(double *d) { + printf("TestInOut10 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test10 %.50f\n",*d); - *d = 9999999.9999999; + char *tmpstr = new char[500]; + sprintf(tmpstr,"TestInOut10 before %.50f\n",*d); + writeResult(SERVER_INOUT_RES, tmpstr); + *d = DBL_MAX; + sprintf(tmpstr,"TestInOut10 after %.50f\n",*d); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test11(char *c) { - printf("Test11 this=%p\n", this); + NS_IMETHOD TestInOut11(char *c) { + printf("TestInOut11 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test11 %c\n",*c); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut11 before %c\n",*c); + printf("THIS THIS THIS IS A TEST.... %s\n", tmpstr); + writeResult(SERVER_INOUT_RES, tmpstr); *c = 'G'; + sprintf(tmpstr,"TestInOut11 after %c\n",*c); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test12(PRUnichar *unic) { - printf("Test12 this=%p\n", this); + NS_IMETHOD TestInOut12(PRUnichar *unic) { + printf("TestInOut12 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test12 %c\n",*unic); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut12 before %c\n",*unic); + writeResult(SERVER_INOUT_RES, tmpstr); *unic = 'G'; + sprintf(tmpstr,"TestInOut12 after %c\n",*unic); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test13(char **s) { - printf("Test13 this=%p\n", this); + NS_IMETHOD TestInOut13(char **s) { + printf("TestInOut13 this=%p\n", this); printf("--nsRPCTestInOutImpl::Test13 %s\n",*s); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut13 before %s\n",*s); + writeResult(SERVER_INOUT_RES, tmpstr); *s = "remote ipc"; + sprintf(tmpstr,"TestInOut13 after %s\n",*s); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; return NS_OK; } -// NS_IMETHOD Test14(PRUnichar **unis) { -// printf("Test14 this=%p\n", this); -// printf("--nsRPCTestInOutImpl::Test14 %s\n",*unis); -// return NS_OK; -// } + NS_IMETHOD TestInOut14(PRUnichar **unis) { + printf("TestInOut14 this=%p\n", this); + printf("--nsRPCTestInOutImpl::Test14 %s\n",*unis); + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestInOut14 before %s\n",*unis); + writeResult(SERVER_INOUT_RES, tmpstr); + //*unis = "remote ipc"; + for (int i = 0; i < 10; i++) { + (*unis)[i] = 'a' + 1; + } + (*unis)[i] = '\0'; + sprintf(tmpstr,"TestInOut14 after %s\n",*unis); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestInOut15(PRUint32 *count, char **valueArray) { + printf("--TestInOut15\n"); + char *tmpstr = new char[200]; + printf("TestInOut15 before count %d\n", *count); + sprintf(tmpstr, "TestInOut15 before count %d\n", *count); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut15 before valueArray %s\n", *valueArray); + sprintf(tmpstr,"TestInOut15 before Array=%s\n",*valueArray); + writeResult(SERVER_INOUT_RES, tmpstr); + *valueArray = "Going in... remote ipc test."; + *count = strlen(*valueArray); + printf("TestInOut15 after count %d\n", *count); + sprintf(tmpstr, "TestInOut15 after count %d\n", *count); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut15 after valueArray %s\n", *valueArray); + sprintf(tmpstr,"TestInOut15 after Array=%s\n",*valueArray); + writeResult(SERVER_INOUT_RES, tmpstr); + delete tmpstr; + return NS_OK; + } + + + NS_IMETHOD TestInOut16(PRBool *bBool, char *cChar, + PRUint16 *nUShort, + PRInt32 *nLong,PRUint32 *nULong, + PRInt64 *nHyper, PRUint64 *nUHyper, + float *fFloat, double *fDouble, char **aString) + { + + printf("TestInOut16 before this=%p\n", this) ; + char *tmpstr = new char[200]; + printf("TestInOut16 before %d\n",*bBool); + sprintf(tmpstr,"TestInOut16 before %d\n",*bBool); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %d\n",*nLong); + sprintf(tmpstr,"TestInOut16 before %d\n",*nLong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %d\n",*nHyper); + sprintf(tmpstr,"TestInOut16 before %d\n",*nHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %u\n",*nUShort); + sprintf(tmpstr,"TestInOut16 before %u\n",*nUShort); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %u\n",*nULong); + sprintf(tmpstr,"TestInOut16 before %u\n",*nULong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %u\n",*nUHyper); + sprintf(tmpstr,"TestInOut16 before %u\n",*nUHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %.50f\n",*fFloat); + sprintf(tmpstr,"TestInOut16 before %.50f\n",*fFloat); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %.50f\n",*fDouble); + sprintf(tmpstr,"TestInOut16 before %.50f\n",*fDouble); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %c\n",*cChar); + sprintf(tmpstr,"TestInOut16 before %c\n",*cChar); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 before %s\n",*aString); + sprintf(tmpstr,"TestInOut16 before %s\n",*aString); + writeResult(SERVER_INOUT_RES, tmpstr); + + *bBool = PR_TRUE; + *cChar = 'A'; + *nUShort = 2; + *nLong = 3; + *nULong = 4; + *nHyper = 5; + *nUHyper = 6; + *fFloat = 7; + *fDouble = 8; + *aString = "Remote ipc test."; + + printf("TestInOut16 after %d\n",*bBool); + sprintf(tmpstr,"TestInOut16 after %d\n",*bBool); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %d\n",*nLong); + sprintf(tmpstr,"TestInOut16 after %d\n",*nLong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %d\n",*nHyper); + sprintf(tmpstr,"TestInOut16 after %d\n",*nHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %u\n",*nUShort); + sprintf(tmpstr,"TestInOut16 after %u\n",*nUShort); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %u\n",*nULong); + sprintf(tmpstr,"TestInOut16 after %u\n",*nULong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %u\n",*nUHyper); + sprintf(tmpstr,"TestInOut16 after %u\n",*nUHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %.50f\n",*fFloat); + sprintf(tmpstr,"TestInOut16 after %.50f\n",*fFloat); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %.50f\n",*fDouble); + sprintf(tmpstr,"TestInOut16 after %.50f\n",*fDouble); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %c\n",*cChar); + sprintf(tmpstr,"TestInOut16 after %c\n",*cChar); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut16 after %s\n",*aString); + sprintf(tmpstr,"TestInOut16 after %s\n",*aString); + writeResult(SERVER_INOUT_RES, tmpstr); + + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestInOut17(PRUint32 *count, PRInt32 **longArray) { + printf("--TestInOut17\n"); + char *tmpstr = new char[200]; + sprintf(tmpstr, "TestInOut17 before count %d\n", *count); + writeResult(SERVER_INOUT_RES, tmpstr); + for (int i = 0; i < *count; i++) { + printf("TestInOut17 before Array[%d]=%d\n",i,(*longArray)[i]); + sprintf(tmpstr,"TestInOut17 before Array[%d]=%d\n",i,(*longArray)[i]); + writeResult(SERVER_INOUT_RES, tmpstr); + } + *count = 5; + sprintf(tmpstr, "TestInOut17 after count %d\n", *count); + writeResult(SERVER_INOUT_RES, tmpstr); + *longArray = new PRInt32[*count]; + for (i = 0; i < *count; i++) { + //longArray[i] = new PRInt32; + (*longArray)[i] = 55555 + i; + printf("TestInOut17 after Array[%d]=%d\n",i,(*longArray)[i]); + sprintf(tmpstr,"TestInOut17 after Array[%d]=%d\n",i,(*longArray)[i]); + writeResult(SERVER_INOUT_RES, tmpstr); + } + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestInOut18(PRBool *bBool, char *cChar, PRUint8 *nByte, + PRInt16 *nShort, PRUint16 *nUShort, + PRInt32 *nLong,PRUint32 *nULong, + PRInt64 *nHyper, PRUint64 *nUHyper, + float *fFloat, double *fDouble, char **aString) + { + + printf("TestInOut18 before this=%p\n", this) ; + char *tmpstr = new char[200]; + printf("TestInOut18 before %d\n",*bBool); + sprintf(tmpstr,"TestInOut18 before %d\n",*bBool); + writeResult(SERVER_INOUT_RES, tmpstr); + sprintf(tmpstr,"TestInOut18 before %o\n",*nByte); + writeResult(SERVER_INOUT_RES, tmpstr); + sprintf(tmpstr,"TestInOut18 before %d\n",*nShort); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %d\n",*nLong); + sprintf(tmpstr,"TestInOut18 before %d\n",*nLong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %d\n",*nHyper); + sprintf(tmpstr,"TestInOut18 before %d\n",*nHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %u\n",*nUShort); + sprintf(tmpstr,"TestInOut18 before %u\n",*nUShort); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %u\n",*nULong); + sprintf(tmpstr,"TestInOut18 before %u\n",*nULong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %u\n",*nUHyper); + sprintf(tmpstr,"TestInOut18 before %u\n",*nUHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %.50f\n",*fFloat); + sprintf(tmpstr,"TestInOut18 before %.50f\n",*fFloat); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %.50f\n",*fDouble); + sprintf(tmpstr,"TestInOut18 before %.50f\n",*fDouble); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %c\n",*cChar); + sprintf(tmpstr,"TestInOut18 before %c\n",*cChar); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 before %s\n",*aString); + sprintf(tmpstr,"TestInOut18 before %s\n",*aString); + writeResult(SERVER_INOUT_RES, tmpstr); + + *bBool = PR_TRUE; + *nByte = 777; + *cChar = 'A'; + *nShort = 1; + *nUShort = 2; + *nLong = 3; + *nULong = 4; + *nHyper = 5; + *nUHyper = 6; + *fFloat = 7; + *fDouble = 8; + *aString = "Remote ipc test."; + + printf("TestInOut18 after %d\n",*bBool); + sprintf(tmpstr,"TestInOut18 after %d\n",*bBool); + writeResult(SERVER_INOUT_RES, tmpstr); + sprintf(tmpstr,"TestInOut18 after %o\n",*nByte); + writeResult(SERVER_INOUT_RES, tmpstr); + sprintf(tmpstr,"TestInOut18 after %d\n",*nShort); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %d\n",*nLong); + sprintf(tmpstr,"TestInOut18 after %d\n",*nLong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %d\n",*nHyper); + sprintf(tmpstr,"TestInOut18 after %d\n",*nHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %u\n",*nUShort); + sprintf(tmpstr,"TestInOut18 after %u\n",*nUShort); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %u\n",*nULong); + sprintf(tmpstr,"TestInOut18 after %u\n",*nULong); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %u\n",*nUHyper); + sprintf(tmpstr,"TestInOut18 after %u\n",*nUHyper); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %.50f\n",*fFloat); + sprintf(tmpstr,"TestInOut18 after %.50f\n",*fFloat); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %.50f\n",*fDouble); + sprintf(tmpstr,"TestInOut18 after %.50f\n",*fDouble); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %c\n",*cChar); + sprintf(tmpstr,"TestInOut18 after %c\n",*cChar); + writeResult(SERVER_INOUT_RES, tmpstr); + printf("TestInOut18 after %s\n",*aString); + sprintf(tmpstr,"TestInOut18 after %s\n",*aString); + writeResult(SERVER_INOUT_RES, tmpstr); + + delete tmpstr; + return NS_OK; + } + }; NS_IMPL_ISUPPORTS(nsRPCTestInOutImpl, NS_GET_IID(nsIRPCTestInOut)); int main(int argc, char **args) { - printf("%x\n",getpid()); - nsRPCTestInOutImpl * test1 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test2 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test3 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test4 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test5 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test6 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test7 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test8 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test9 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test10 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test11 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test12 = new nsRPCTestInOutImpl(); - nsRPCTestInOutImpl * test13 = new nsRPCTestInOutImpl(); + + int i; + const short num = 2; + nsRPCTestInOutImpl * test[num]; + + setProcessId(INOUT_FDATA); + for(i = 0; i < num; i++) { + test[i] = new nsRPCTestInOutImpl(); + } RPCServerService * rpcService = RPCServerService::GetInstance(); IDispatcher *dispatcher; rpcService->GetDispatcher(&dispatcher); - dispatcher->RegisterWithOID(test1, 1); - dispatcher->RegisterWithOID(test2, 5); - dispatcher->RegisterWithOID(test3, 7); - dispatcher->RegisterWithOID(test4, 9); - dispatcher->RegisterWithOID(test5, 11); - dispatcher->RegisterWithOID(test6, 13); - dispatcher->RegisterWithOID(test7, 15); - dispatcher->RegisterWithOID(test8, 17); - dispatcher->RegisterWithOID(test9, 19); - dispatcher->RegisterWithOID(test10, 21); - dispatcher->RegisterWithOID(test11, 23); - dispatcher->RegisterWithOID(test12, 25); - dispatcher->RegisterWithOID(test13, 27); - while(1) { - PR_Sleep(100); + for(i = 0; i < num; i++) { + dispatcher->RegisterWithOID(test[i], i + 1); + } + while(1) { + PR_Sleep(100); } - } - diff --git a/mozilla/xpcom/remote/tests/serverOut.cpp b/mozilla/xpcom/remote/tests/serverOut.cpp index 88accb5876e..29df39501a8 100644 --- a/mozilla/xpcom/remote/tests/serverOut.cpp +++ b/mozilla/xpcom/remote/tests/serverOut.cpp @@ -1,173 +1,274 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Sun Microsystems, - * Inc. Portions created by Sun are - * Copyright (C) 1999 Sun Microsystems, Inc. All - * Rights Reserved. - * - * Contributor(s): - */ #include #include +#include +#include +#include +#include #include "RPCServerService.h" #include "nsISupports.h" #include "nsIJVMManager.h" #include "nsIRPCTestOut.h" -#include #include "IDispatcher.h" #include "nsIThread.h" +#include "deftest.h" +#include "proto.h" -class nsRPCTestOutImpl : public nsIRPCTestOut { +class nsRPCTestOutImpl : public nsIRPCTestOut { NS_DECL_ISUPPORTS - nsRPCTestOutImpl() { + nsRPCTestOutImpl () { NS_INIT_REFCNT(); } - NS_IMETHOD Test1(PRBool *bool) { - printf("Test1 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test1 %d\n",*bool); + NS_IMETHOD TestOut1(PRBool *bool) { + printf("TestOut1 this=%p\n", this); *bool = PR_FALSE; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut1 %d\n",*bool); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test2(PRUint8 *octet) { - printf("Test2 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test2 %d\n",*octet); + NS_IMETHOD TestOut2(PRUint8 *octet) { + printf("TestOut2 this=%p\n", this); *octet = 88; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut2 %o\n",*octet); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test3(PRInt16 *sInt) { - printf("Test3 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test3 %d\n",*sInt); - *sInt = 9999; + NS_IMETHOD TestOut3(PRInt16 *sInt) { + printf("TestOut3 this=%p\n", this); + *sInt = SHRT_MAX; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut3 %d\n",*sInt); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test4(PRInt32 *lInt) { - printf("Test4 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test4 %d\n",*lInt); - *lInt = 99999; + NS_IMETHOD TestOut4(PRInt32 *lInt) { + printf("TestOut4 this=%p\n", this); + *lInt = LONG_MAX; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut4 %d\n",*lInt); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test5(PRInt64 *llInt) { - printf("Test5 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test5 %d\n",*llInt); - *llInt = 999999; + NS_IMETHOD TestOut5(PRInt64 *llInt) { + printf("TestOut5 this=%p\n", this); + *llInt = LONG_MAX; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut5 %d\n",*llInt); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test6(PRUint16 *usInt) { - printf("Test6 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test6 %15u\n",*usInt); - *usInt = 9999; + NS_IMETHOD TestOut6(PRUint16 *usInt) { + printf("TestOut6 this=%p\n", this); + *usInt = USHRT_MAX; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut6 %u\n",*usInt); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test7(PRUint32 *ulInt) { - printf("Test7 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test7 %15u\n",*ulInt); - *ulInt = 99999; + NS_IMETHOD TestOut7(PRUint32 *ulInt) { + printf("TestOut7 this=%p\n", this); + *ulInt = ULONG_MAX; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut7 %u\n",*ulInt); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test8(PRUint64 *ullInt) { - printf("Test8 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test8 %15u\n",*ullInt); - *ullInt = 9999999; + NS_IMETHOD TestOut8(PRUint64 *ullInt) { + printf("TestOut8 this=%p\n", this); + *ullInt = ULONG_MAX; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut8 %u\n",*ullInt); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test9(float *f) { - printf("Test9 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test9 %.50f\n",*f); - *f = 999.999; + NS_IMETHOD TestOut9(float *f) { + printf("TestOut9 this=%p\n", this); + *f = FLT_MAX; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut9 %.50f\n",*f); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test10(double *d) { - printf("Test10 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test10 %.50f\n",*d); - *d = 9999999.9999999; + NS_IMETHOD TestOut10(double *d) { + printf("TestOut10 this=%p\n", this); + *d = DBL_MAX; + char *tmpstr = new char[500]; + sprintf(tmpstr,"TestOut10 %.50f\n",*d); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test11(char *c) { - printf("Test11 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test11 %c\n",*c); + NS_IMETHOD TestOut11(char *c) { + printf("TestOut11 this=%p\n", this); *c = 'G'; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut11 %c\n",*c); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test12(PRUnichar *unic) { - printf("Test12 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test12 %c\n",*unic); + NS_IMETHOD TestOut12(PRUnichar *unic) { + printf("TestOut12 this=%p\n", this); *unic = 'G'; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut12 %c\n",*unic); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } - NS_IMETHOD Test13(char **s) { - printf("Test13 this=%p\n", this); - printf("--nsRPCTestOutImpl::Test13 %s\n",*s); + NS_IMETHOD TestOut13(char **s) { + printf("TestOut13 this=%p\n", this); *s = "remote ipc"; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut13 %s\n",*s); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; return NS_OK; } -// NS_IMETHOD Test14(PRUnichar **unis) { -// printf("Test14 this=%p\n", this); -// printf("--nsRPCTestOutImpl::Test14 %s\n",*unis); -// return NS_OK; -// } + NS_IMETHOD TestOut14(PRUnichar **unis) { + printf("TestOut14 this=%p\n", this); + //*unis = "remote ipc"; + *unis = new PRUnichar[50]; + for (int i = 0; i < 10; i++) { + (*unis)[i] = 'a' + 1; + } + (*unis)[i] = '\0'; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut14 %s\n",*unis); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestOut15(PRUint32 *count, char **valueArray) { + printf("--TestOut15\n"); + *valueArray = "This is a remote ipc test."; + *count = strlen(*valueArray); + char *tmpstr = new char[200]; + printf("TestOut15 count %d\n", *count); + sprintf(tmpstr, "TestOut15 count %d\n", *count); + writeResult(SERVER_OUT_RES, tmpstr); + printf("TestOut15 valueArray %s\n", *valueArray); + sprintf(tmpstr,"TestOut15 Array=%s\n",*valueArray); + writeResult(SERVER_OUT_RES, tmpstr); + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestOut16(PRBool *bBool, char *cChar, PRUint8 *nByte, + PRInt16 *nShort, PRUint16 *nUShort, + PRInt32 *nLong,PRUint32 *nULong, + PRInt64 *nHyper, PRUint64 *nUHyper, + float *fFloat, double *fDouble, char **aString) + { + *bBool = PR_TRUE; + *nByte = 777; + *cChar = 'A'; + *nShort = 1; + *nUShort = 2; + *nLong = 3; + *nULong = 4; + *nHyper = 5; + *nUHyper = 6; + *fFloat = 7; + *fDouble = 8; + *aString = "Remote ipc test."; + + printf("TestOut16 this=%p\n", this) ; + char *tmpstr = new char[200]; + sprintf(tmpstr,"TestOut16 PRBool %d\n",*bBool); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 PRUint8 %o\n",*nByte); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 PRInt16 %d\n",*nShort); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 PRInt32 %d\n",*nLong); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 PRInt64 %d\n",*nHyper); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 PRUint16 %u\n",*nUShort); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 PRUint32 %u\n",*nULong); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 PRUint64 %u\n",*nUHyper); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 float %.50f\n",*fFloat); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 double %.50f\n",*fDouble); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 char %c\n",*cChar); + writeResult(SERVER_OUT_RES, tmpstr); + sprintf(tmpstr,"TestOut16 string %s\n",*aString); + writeResult(SERVER_OUT_RES, tmpstr); + + delete tmpstr; + return NS_OK; + } + + NS_IMETHOD TestOut17(PRUint32 *count, PRInt32 **longArray) { + printf("--TestOut17\n"); + char *tmpstr = new char[200]; + *count = 5; + sprintf(tmpstr, "TestOut17 count %d\n", *count); + writeResult(SERVER_OUT_RES, tmpstr); + *longArray = new PRInt32[*count]; + for (int i = 0; i < *count; i++) { + (*longArray)[i] = 55555 + i; + printf("TestOut17 Array[%d]=%d\n",i,(*longArray)[i]); + sprintf(tmpstr,"TestOut17 Array[%d]=%d\n",i,(*longArray)[i]); + writeResult(SERVER_OUT_RES, tmpstr); + } + delete tmpstr; + return NS_OK; + } + + + }; -NS_IMPL_ISUPPORTS(nsRPCTestOutImpl, NS_GET_IID(nsIRPCTestOut)); +NS_IMPL_ISUPPORTS(nsRPCTestOutImpl , NS_GET_IID(nsIRPCTestOut)); int main(int argc, char **args) { - printf("%x\n",getpid()); - nsRPCTestOutImpl * test1 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test2 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test3 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test4 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test5 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test6 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test7 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test8 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test9 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test10 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test11 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test12 = new nsRPCTestOutImpl(); - nsRPCTestOutImpl * test13 = new nsRPCTestOutImpl(); + int i; + const short num = 5; + nsRPCTestOutImpl * test[num]; + + setProcessId(OUT_FDATA); + for(i = 0; i < num; i++) { + test[i] = new nsRPCTestOutImpl(); + } RPCServerService * rpcService = RPCServerService::GetInstance(); IDispatcher *dispatcher; rpcService->GetDispatcher(&dispatcher); - dispatcher->RegisterWithOID(test1, 1); - dispatcher->RegisterWithOID(test2, 5); - dispatcher->RegisterWithOID(test3, 7); - dispatcher->RegisterWithOID(test4, 9); - dispatcher->RegisterWithOID(test5, 11); - dispatcher->RegisterWithOID(test6, 13); - dispatcher->RegisterWithOID(test7, 15); - dispatcher->RegisterWithOID(test8, 17); - dispatcher->RegisterWithOID(test9, 19); - dispatcher->RegisterWithOID(test10, 21); - dispatcher->RegisterWithOID(test11, 23); - dispatcher->RegisterWithOID(test12, 25); - dispatcher->RegisterWithOID(test13, 27); - while(1) { - PR_Sleep(100); + for(i = 0; i < num; i++) { + dispatcher->RegisterWithOID(test[i], i + 1); + } + while(1) { + PR_Sleep(100); } - }