зеркало из https://github.com/mozilla/gecko-dev.git
Bug 369034 - TestTXMgr has error and leaks object; (Av1a) Add mgr->Clear(), use ScopedXPCOM() and run this test; r=benjamin
This commit is contained in:
Родитель
345808719a
Коммит
1993f0671f
|
@ -20,6 +20,7 @@
|
|||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Serge Gautherie <sgautherie.bz@free.fr>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -42,18 +43,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
REQUIRES = xpcom \
|
||||
txmgr \
|
||||
$(NULL)
|
||||
REQUIRES = txmgr xpcom
|
||||
|
||||
PROGRAM = TestTXMgr$(BIN_SUFFIX)
|
||||
|
||||
CPPSRCS = TestTXMgr.cpp
|
||||
|
||||
LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
CPP_UNIT_TESTS = TestTXMgr.cpp
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Serge Gautherie <sgautherie.bz@free.fr>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -35,11 +36,9 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "nsXPCOM.h"
|
||||
#include "TestHarness.h"
|
||||
|
||||
#include "nsITransactionManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
static PRInt32 sConstructorCount = 0;
|
||||
|
@ -906,8 +905,8 @@ quick_test(TestTransactionFactory *factory)
|
|||
*******************************************************************/
|
||||
|
||||
printf("Call Clear() with empty undo and redo stack ... ");
|
||||
result = mgr->Clear();
|
||||
|
||||
result = mgr->Clear();
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear on empty undo and redo stack failed. (%d)\n", result);
|
||||
return result;
|
||||
|
@ -1201,7 +1200,6 @@ quick_test(TestTransactionFactory *factory)
|
|||
}
|
||||
|
||||
result = mgr->Clear();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear() failed. (%d)\n", result);
|
||||
return result;
|
||||
|
@ -1586,7 +1584,6 @@ quick_test(TestTransactionFactory *factory)
|
|||
}
|
||||
|
||||
result = mgr->Clear();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear() failed. (%d)\n",
|
||||
result);
|
||||
|
@ -2669,6 +2666,12 @@ quick_test(TestTransactionFactory *factory)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = mgr->Clear();
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear() failed. (%d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -4371,6 +4374,12 @@ quick_batch_test(TestTransactionFactory *factory)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = mgr->Clear();
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear() failed. (%d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -4559,7 +4568,11 @@ stress_test(TestTransactionFactory *factory, PRInt32 iterations)
|
|||
}
|
||||
}
|
||||
|
||||
// printf("%d %d - ", sConstructorCount, sDestructorCount);
|
||||
result = mgr->Clear();
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear() failed. (%d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (sConstructorCount != sDestructorCount) {
|
||||
printf("ERROR: Transaction constructor count (%d) != destructor count (%d).\n",
|
||||
|
@ -4664,9 +4677,11 @@ aggregation_batch_stress_test()
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
nsresult result = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
ScopedXPCOM xpcom("nsITransactionManager");
|
||||
if (xpcom.failed())
|
||||
return 1;
|
||||
|
||||
nsresult result;
|
||||
|
||||
result = simple_test();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче