lowlevellibsandfws/pluginfw/Test_Bed/test_bed/LeakTestTransition.cpp
branchRCL_3
changeset 57 2efc27d87e1c
parent 56 acd3cd4aaceb
equal deleted inserted replaced
56:acd3cd4aaceb 57:2efc27d87e1c
    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 
    32 // Define the overloaded RunL behaviour here
    42 // Define the overloaded RunL behaviour here
    33 EXPORT_C void CLeakTestTransition::RunL()
    43 EXPORT_C void CLeakTestTransition::RunL()
    34 	{
    44 	{
    35 	// Setup leak check and call the base RunL
    45 	// Setup leak check and call the base RunL
    36 	iThread.HandleCount(iStartProcessHandleCount, iStartThreadHandleCount);
    46 	iThread.HandleCount(iStartProcessHandleCount, iStartThreadHandleCount);
       
    47 	(static_cast<TestRHeap&>(User::Heap())).Set(&s);
    37 	__UHEAP_SETFAIL(RHeap::EDeterministic,iFailStep);
    48 	__UHEAP_SETFAIL(RHeap::EDeterministic,iFailStep);
    38 	__UHEAP_MARK;
    49 	__UHEAP_MARK;
    39 	if(iBreakStep == iFailStep)
    50 	if(iBreakStep == iFailStep)
    40 		{
    51 		{
    41 		// Drop into the debugger because an unexpected leave occured
    52 		// Drop into the debugger because an unexpected leave occured
   128 		{
   139 		{
   129 		__DEBUGGER();										// Oops leaked some handles
   140 		__DEBUGGER();										// Oops leaked some handles
   130 		}
   141 		}
   131 	__UHEAP_MARKEND;
   142 	__UHEAP_MARKEND;
   132 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
   143 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
       
   144 	(static_cast<TestRHeap&>(User::Heap())).Set(0);
   133 	return KErrNone;
   145 	return KErrNone;
   134 	}
   146 	}
   135 
   147 
   136 EXPORT_C void CLeakTestTransition::PostTransitionCleanup()
   148 EXPORT_C void CLeakTestTransition::PostTransitionCleanup()
   137 	{
   149 	{
       
   150 	__UHEAP_MARKEND;
   138 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
   151 	__UHEAP_SETFAIL(RHeap::ENone, KMemoryLeakTestFailInit);	// No more fails
       
   152 	(static_cast<TestRHeap&>(User::Heap())).Set(0);
   139 	}
   153 	}