lowlevellibsandfws/pluginfw/Test_Bed/test_bed/LeakTestTransition.cpp
changeset 22 ddc455616bd6
parent 0 e4d67989cc36
child 45 4b03adbd26ca
child 57 2efc27d87e1c
equal deleted inserted replaced
18:47c74d1534e1 22:ddc455616bd6
    27 	iBreakStep(KMemoryLeakTestBreakNone)
    27 	iBreakStep(KMemoryLeakTestBreakNone)
    28 	{
    28 	{
    29 	// Do nothing here
    29 	// Do nothing here
    30 	}
    30 	}
    31 
    31 
    32 class TestRHeap : public RHeap
       
    33 	{
       
    34 public:
       
    35 	inline void Set(TAny* aPtr)
       
    36 		{
       
    37 		iTestData = aPtr;
       
    38 		};
       
    39 	};
       
    40 RHeap::SHeapCellInfo s;
       
    41 
       
    42 // Define the overloaded RunL behaviour here
    32 // Define the overloaded RunL behaviour here
    43 EXPORT_C void CLeakTestTransition::RunL()
    33 EXPORT_C void CLeakTestTransition::RunL()
    44 	{
    34 	{
    45 	// Setup leak check and call the base RunL
    35 	// Setup leak check and call the base RunL
    46 	iThread.HandleCount(iStartProcessHandleCount, iStartThreadHandleCount);
    36 	iThread.HandleCount(iStartProcessHandleCount, iStartThreadHandleCount);
    47 	(static_cast<TestRHeap&>(User::Heap())).Set(&s);
       
    48 	__UHEAP_SETFAIL(RHeap::EDeterministic,iFailStep);
    37 	__UHEAP_SETFAIL(RHeap::EDeterministic,iFailStep);
    49 	__UHEAP_MARK;
    38 	__UHEAP_MARK;
    50 	if(iBreakStep == iFailStep)
    39 	if(iBreakStep == iFailStep)
    51 		{
    40 		{
    52 		// Drop into the debugger because an unexpected leave occured
    41 		// Drop into the debugger because an unexpected leave occured
   139 		{
   128 		{
   140 		__DEBUGGER();										// Oops leaked some handles
   129 		__DEBUGGER();										// Oops leaked some handles
   141 		}
   130 		}
   142 	__UHEAP_MARKEND;
   131 	__UHEAP_MARKEND;
   143 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
   132 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
   144 	(static_cast<TestRHeap&>(User::Heap())).Set(0);
       
   145 	return KErrNone;
   133 	return KErrNone;
   146 	}
   134 	}
   147 
   135 
   148 EXPORT_C void CLeakTestTransition::PostTransitionCleanup()
   136 EXPORT_C void CLeakTestTransition::PostTransitionCleanup()
   149 	{
   137 	{
   150 	__UHEAP_MARKEND;
       
   151 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
   138 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
   152 	(static_cast<TestRHeap&>(User::Heap())).Set(0);
       
   153 	}
   139 	}