os/ossrv/genericservices/httputils/Test/IpuTestUtils/ctestbase.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 #include "ctestbase.h"
    19 
    20 
    21 EXPORT_C void CTestBase::MemoryLeakTestL(CTestBase& aTest, CIpuTestHarness& aTestHarness)
    22 	{
    23 	// set aTestHarness to be in memoryleak mode
    24 	aTestHarness.SetTestMode(CIpuTestHarness::ETestModeMemoryLeak);
    25 
    26 	TInt ii=0;
    27 	_LIT(KMemoryLeakMessage, "Memory Leak Testing on allocation %d\n");
    28 	FOREVER
    29 		{
    30 		aTestHarness.LogIt(KMemoryLeakMessage, ii);
    31 		__UHEAP_MARK;
    32 		__UHEAP_FAILNEXT(ii);
    33 		TRAPD(err,aTest.DoTestsL());
    34 		__UHEAP_MARKEND;
    35 		User::Heap().Check();
    36 		__UHEAP_RESET;
    37 		// Break out if the test passes successfully;
    38 		if (err == KErrNone)
    39 			break;
    40 		if (err != KErrNoMemory)
    41 			{
    42 			// set aTestHarness back to normal mode
    43 			aTestHarness.SetTestMode(CIpuTestHarness::ETestModeNormal);			
    44 			User::LeaveIfError(err);
    45 			}
    46 		++ii;
    47 		}
    48 	// set aTestHarness back to normal mode
    49 	aTestHarness.SetTestMode(CIpuTestHarness::ETestModeNormal);
    50 	}