From db81b01f2a35e5f151c88e2f46ef7e254d83913f Mon Sep 17 00:00:00 2001 From: "darin%meer.net" Date: Thu, 21 Oct 2004 20:57:17 +0000 Subject: [PATCH] make necko tests work on the trunk --- netwerk/test/Makefile.in | 3 +++ netwerk/test/PropertiesTest.cpp | 4 ++++ netwerk/test/TestBlockingSocket.cpp | 4 ++++ netwerk/test/TestCallbacks.cpp | 4 ++++ netwerk/test/TestCookie.cpp | 4 ++++ netwerk/test/TestDNS.cpp | 4 ++++ netwerk/test/TestIDN.cpp | 4 ++++ netwerk/test/TestIOThreads.cpp | 6 +++++- netwerk/test/TestOpen.cpp | 4 ++++ netwerk/test/TestPageLoad.cpp | 6 +++++- netwerk/test/TestPerf.cpp | 4 ++++ netwerk/test/TestProtocols.cpp | 5 +++++ netwerk/test/TestServ.cpp | 4 ++++ netwerk/test/TestSocketTransport.cpp | 4 ++++ netwerk/test/TestStandardURL.cpp | 4 ++++ netwerk/test/TestStreamChannel.cpp | 4 ++++ netwerk/test/TestStreamLoader.cpp | 4 ++++ netwerk/test/TestStreamPump.cpp | 4 ++++ netwerk/test/TestStreamTransport.cpp | 4 ++++ netwerk/test/TestURLParser.cpp | 4 ++++ netwerk/test/TestUpload.cpp | 4 ++++ netwerk/test/urltest.cpp | 4 ++++ 22 files changed, 90 insertions(+), 2 deletions(-) diff --git a/netwerk/test/Makefile.in b/netwerk/test/Makefile.in index 96d65265d38..2ac21cd4234 100644 --- a/netwerk/test/Makefile.in +++ b/netwerk/test/Makefile.in @@ -84,8 +84,11 @@ LIBS = $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ $(XPCOM_LIBS) \ $(NSPR_LIBS) \ + $(TK_LIBS) \ $(NULL) +DEFINES += $(TK_CFLAGS) + include $(topsrcdir)/config/rules.mk _RES_FILES = urlparse.dat \ diff --git a/netwerk/test/PropertiesTest.cpp b/netwerk/test/PropertiesTest.cpp index 0f604c903cf..c345af68270 100644 --- a/netwerk/test/PropertiesTest.cpp +++ b/netwerk/test/PropertiesTest.cpp @@ -36,6 +36,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsXPCOM.h" #include "nsString.h" #include "nsIEventQueueService.h" @@ -63,6 +64,9 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult ret; diff --git a/netwerk/test/TestBlockingSocket.cpp b/netwerk/test/TestBlockingSocket.cpp index 6812c8ad65b..20eb741d816 100644 --- a/netwerk/test/TestBlockingSocket.cpp +++ b/netwerk/test/TestBlockingSocket.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsIComponentRegistrar.h" #include "nsISocketTransportService.h" #include "nsISocketTransport.h" @@ -120,6 +121,9 @@ RunBlockingTest(const nsACString &host, PRInt32 port, nsIFile *file) int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; if (argc < 4) { diff --git a/netwerk/test/TestCallbacks.cpp b/netwerk/test/TestCallbacks.cpp index 7a2c88326cb..216cb4e7fd4 100644 --- a/netwerk/test/TestCallbacks.cpp +++ b/netwerk/test/TestCallbacks.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include #ifdef WIN32 #include @@ -240,6 +241,9 @@ Consumer::Validate(nsIRequest* request, nsISupports *aContext) { nsresult StartLoad(const char *); int main(int argc, char *argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv = NS_OK; PRBool cmdLineURL = PR_FALSE; diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index 9e8b089de13..b214a783497 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -36,6 +36,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsIServiceManager.h" #include "nsICookieService.h" #include @@ -168,6 +169,9 @@ InitPrefs(nsIPrefBranch *aPrefBranch) int main(PRInt32 argc, char *argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv0 = NS_InitXPCOM2(nsnull, nsnull, nsnull); if (NS_FAILED(rv0)) return -1; diff --git a/netwerk/test/TestDNS.cpp b/netwerk/test/TestDNS.cpp index b23d6d50bb5..7a0ac0ccfa4 100644 --- a/netwerk/test/TestDNS.cpp +++ b/netwerk/test/TestDNS.cpp @@ -34,6 +34,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include #include #include "nsIServiceManager.h" @@ -88,6 +89,9 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(myDNSListener, nsIDNSListener) int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + int sleepLen = 10; // default: 10 seconds if (argc == 1) { diff --git a/netwerk/test/TestIDN.cpp b/netwerk/test/TestIDN.cpp index f55aa6dd8be..e91619859aa 100644 --- a/netwerk/test/TestIDN.cpp +++ b/netwerk/test/TestIDN.cpp @@ -37,6 +37,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include #include "nsIIDNService.h" #include "nsCOMPtr.h" @@ -45,6 +46,9 @@ #include "nsString.h" int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + // Test case from RFC 3492 (7.1 - Simplified Chinese) const char plain[] = "\xE4\xBB\x96\xE4\xBB\xAC\xE4\xB8\xBA\xE4\xBB\x80\xE4\xB9\x88\xE4\xB8\x8D\xE8\xAF\xB4\xE4\xB8\xAD\xE6\x96\x87"; diff --git a/netwerk/test/TestIOThreads.cpp b/netwerk/test/TestIOThreads.cpp index e990d2c458c..59ccd118478 100644 --- a/netwerk/test/TestIOThreads.cpp +++ b/netwerk/test/TestIOThreads.cpp @@ -34,6 +34,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsIServiceManager.h" #include "nsIEventTarget.h" #include "nsCOMPtr.h" @@ -77,8 +78,11 @@ static nsresult RunTest() return rv; } -int main() +int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; #if defined(PR_LOGGING) diff --git a/netwerk/test/TestOpen.cpp b/netwerk/test/TestOpen.cpp index 1643a17943b..b4c6e05605c 100644 --- a/netwerk/test/TestOpen.cpp +++ b/netwerk/test/TestOpen.cpp @@ -36,6 +36,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsCOMPtr.h" #include "nsString.h" #include "nsIURI.h" @@ -61,6 +62,9 @@ int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; char buf[256]; diff --git a/netwerk/test/TestPageLoad.cpp b/netwerk/test/TestPageLoad.cpp index 226e77f7d79..22525453c0e 100644 --- a/netwerk/test/TestPageLoad.cpp +++ b/netwerk/test/TestPageLoad.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsNetUtil.h" #include "nsIEventQueueService.h" #include "nsIServiceManager.h" @@ -345,7 +346,10 @@ nsresult auxLoad(char *uriBuf) //---------MAIN----------- int main(int argc, char **argv) -{ +{ + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; if (argc == 1) { diff --git a/netwerk/test/TestPerf.cpp b/netwerk/test/TestPerf.cpp index 401941c14f3..6352c12e60e 100644 --- a/netwerk/test/TestPerf.cpp +++ b/netwerk/test/TestPerf.cpp @@ -1,3 +1,4 @@ +#include "TestCommon.h" #include #include "nsCRT.h" /* should be "plstr.h"? */ #include "nsNetUtil.h" @@ -217,6 +218,9 @@ print_usage() int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; PRBool sync; diff --git a/netwerk/test/TestProtocols.cpp b/netwerk/test/TestProtocols.cpp index 912e9ed7239..1df71c3bf62 100644 --- a/netwerk/test/TestProtocols.cpp +++ b/netwerk/test/TestProtocols.cpp @@ -44,6 +44,8 @@ -Gagan Saksena 04/29/99 */ +#include "TestCommon.h" + #define FORCE_PR_LOG #include #ifdef WIN32 @@ -730,6 +732,9 @@ nsresult LoadURLFromConsole() int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv= (nsresult)-1; if (argc < 2) { printf("usage: %s [-verbose] [-file ] [-resume [-entityid ]] [-proxy ] [-console] ... \n", argv[0]); diff --git a/netwerk/test/TestServ.cpp b/netwerk/test/TestServ.cpp index 77674c77fa4..786f8e94bbe 100644 --- a/netwerk/test/TestServ.cpp +++ b/netwerk/test/TestServ.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include #include "nsIServiceManager.h" #include "nsIEventQueueService.h" @@ -144,6 +145,9 @@ MakeServer(PRInt32 port) int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv= (nsresult)-1; if (argc < 2) { printf("usage: %s \n", argv[0]); diff --git a/netwerk/test/TestSocketTransport.cpp b/netwerk/test/TestSocketTransport.cpp index 7640d45e506..bff37dcc0ab 100644 --- a/netwerk/test/TestSocketTransport.cpp +++ b/netwerk/test/TestSocketTransport.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsIComponentRegistrar.h" #include "nsISocketTransportService.h" #include "nsISocketTransport.h" @@ -280,6 +281,9 @@ RunTest(nsISocketTransportService *sts, int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; if (argc < 4) { diff --git a/netwerk/test/TestStandardURL.cpp b/netwerk/test/TestStandardURL.cpp index ab9465076ee..e80efb15241 100644 --- a/netwerk/test/TestStandardURL.cpp +++ b/netwerk/test/TestStandardURL.cpp @@ -1,3 +1,4 @@ +#include "TestCommon.h" #include #include "nsCOMPtr.h" #include "nsIServiceManager.h" @@ -85,6 +86,9 @@ static void ref_test() int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + if (argc < 2) { printf("usage: TestURL url [count]\n"); return -1; diff --git a/netwerk/test/TestStreamChannel.cpp b/netwerk/test/TestStreamChannel.cpp index b8b4d74d5ed..8952c687c1f 100644 --- a/netwerk/test/TestStreamChannel.cpp +++ b/netwerk/test/TestStreamChannel.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsIComponentRegistrar.h" #include "nsIStreamTransportService.h" #include "nsIAsyncInputStream.h" @@ -244,6 +245,9 @@ RunTest(nsIFile *file) int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; if (argc < 2) { diff --git a/netwerk/test/TestStreamLoader.cpp b/netwerk/test/TestStreamLoader.cpp index 1487d4be089..5bf2a26b7af 100644 --- a/netwerk/test/TestStreamLoader.cpp +++ b/netwerk/test/TestStreamLoader.cpp @@ -1,4 +1,5 @@ #include +#include "TestCommon.h" #include "nsNetUtil.h" #include "nsEventQueueUtils.h" #include "prlog.h" @@ -42,6 +43,9 @@ MyStreamLoaderObserver::OnStreamComplete(nsIStreamLoader *loader, int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + if (argc < 2) { printf("usage: %s \n", argv[0]); return -1; diff --git a/netwerk/test/TestStreamPump.cpp b/netwerk/test/TestStreamPump.cpp index 1dd818a5f0f..9c36f0db82d 100644 --- a/netwerk/test/TestStreamPump.cpp +++ b/netwerk/test/TestStreamPump.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsIComponentRegistrar.h" #include "nsIStreamTransportService.h" #include "nsIAsyncInputStream.h" @@ -202,6 +203,9 @@ RunTest(nsIFile *file, PRInt32 offset, PRInt32 length) int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; if (argc < 4) { diff --git a/netwerk/test/TestStreamTransport.cpp b/netwerk/test/TestStreamTransport.cpp index d2d87328fac..c21996320d5 100644 --- a/netwerk/test/TestStreamTransport.cpp +++ b/netwerk/test/TestStreamTransport.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #include "nsIComponentRegistrar.h" #include "nsIStreamTransportService.h" #include "nsIAsyncInputStream.h" @@ -335,6 +336,9 @@ RunBlockingTest(nsIFile *srcFile, nsIFile *destFile) int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; if (argc < 2) { diff --git a/netwerk/test/TestURLParser.cpp b/netwerk/test/TestURLParser.cpp index 86cb4ddafdc..a3dc54f1cb8 100644 --- a/netwerk/test/TestURLParser.cpp +++ b/netwerk/test/TestURLParser.cpp @@ -1,3 +1,4 @@ +#include "TestCommon.h" #include #include "nsIURLParser.h" #include "nsCOMPtr.h" @@ -87,6 +88,9 @@ parse_path(nsIURLParser *urlParser, char *path, PRInt32 pathLen) int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + if (argc < 2) { printf("usage: TestURLParser [-std|-noauth|-auth] \n"); return -1; diff --git a/netwerk/test/TestUpload.cpp b/netwerk/test/TestUpload.cpp index 98232f89af6..c4f80c85cc5 100644 --- a/netwerk/test/TestUpload.cpp +++ b/netwerk/test/TestUpload.cpp @@ -35,6 +35,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include "TestCommon.h" #ifdef WIN32 #include #endif @@ -133,6 +134,9 @@ InputTestConsumer::OnStopRequest(nsIRequest *request, nsISupports* context, int main(int argc, char* argv[]) { + if (test_common_init(&argc, &argv) != 0) + return -1; + nsresult rv; if (argc < 2) { diff --git a/netwerk/test/urltest.cpp b/netwerk/test/urltest.cpp index 403a3289212..a9991592dd4 100644 --- a/netwerk/test/urltest.cpp +++ b/netwerk/test/urltest.cpp @@ -43,6 +43,7 @@ #include +#include "TestCommon.h" #include "plstr.h" #include "nsIServiceManager.h" #include "nsIIOService.h" @@ -410,6 +411,9 @@ void printusage(void) int main(int argc, char **argv) { + if (test_common_init(&argc, &argv) != 0) + return -1; + int rv = -1; if (argc < 2) {