From 128c27b2155fc6ee5969317f6511e4425b247de5 Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Wed, 28 Jul 1999 08:01:55 +0000 Subject: [PATCH] Added TestShutdown to detect memory leaks in xpcom. git-svn-id: svn://10.0.0.236/trunk@41452 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/tests/TestShutdown.cpp | 32 ++++++++++++++++++++++++++++ mozilla/xpcom/tests/makefile.win | 4 ++++ 2 files changed, 36 insertions(+) create mode 100644 mozilla/xpcom/tests/TestShutdown.cpp diff --git a/mozilla/xpcom/tests/TestShutdown.cpp b/mozilla/xpcom/tests/TestShutdown.cpp new file mode 100644 index 00000000000..a2b65a43e27 --- /dev/null +++ b/mozilla/xpcom/tests/TestShutdown.cpp @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsIServiceManager.h" + +// Gee this seems simple! It's for testing for memory leaks. + +void main() +{ + nsresult rv; + nsIServiceManager* servMgr; + rv = NS_InitXPCOM(&servMgr); + NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed"); + rv = NS_ShutdownXPCOM(servMgr); + NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed"); + NS_RELEASE(servMgr); +} diff --git a/mozilla/xpcom/tests/makefile.win b/mozilla/xpcom/tests/makefile.win index 9825666fecf..a4269d4fa11 100644 --- a/mozilla/xpcom/tests/makefile.win +++ b/mozilla/xpcom/tests/makefile.win @@ -38,6 +38,7 @@ PROG13 = .\$(OBJDIR)\TestThreads.exe PROG14 = .\$(OBJDIR)\TestObserverService.exe PROG15 = .\$(OBJDIR)\TestBuffers.exe PROG16 = .\$(OBJDIR)\TestPipes.exe +PROG17 = .\$(OBJDIR)\TestShutdown.exe RESFILE = timer.res @@ -54,6 +55,7 @@ PROGRAMS = $(PROG1) $(PROG2) $(PROG3) $(PROG4) $(PROG5) \ $(PROG14) \ $(PROG15) \ $(PROG16) \ + $(PROG17) \ $(NULL) LCFLAGS=-DUSE_NSREG -GX @@ -123,3 +125,5 @@ $(PROG14): $(OBJDIR) TestObserverService.cpp $(PROG15): $(OBJDIR) TestBuffers.cpp $(PROG16): $(OBJDIR) TestPipes.cpp + +$(PROG17): $(OBJDIR) TestShutdown.cpp