kerneltest/e32test/power/t_domain.cpp
branchRCL_3
changeset 42 a179b74831c9
parent 6 0173bcd7697c
equal deleted inserted replaced
41:0ffb4e86fcc9 42:a179b74831c9
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   804 	void RunL();
   804 	void RunL();
   805 	// from MDmTest
   805 	// from MDmTest
   806 	void Perform();
   806 	void Perform();
   807 	void Release();
   807 	void Release();
   808 	TInt TransitionNotification(MDmDomainMember& aDomainMember);
   808 	TInt TransitionNotification(MDmDomainMember& aDomainMember);
   809 	void TransitionRequestComplete();
   809 	void TransitionRequestComplete();	
       
   810 	void RunTestOnGetTransitionFailures(RArray<const TTransitionFailure>& aTransitionFailure);
       
   811 	
   810 	CDmTest5(TDmDomainId aPowerId, TDmDomainId aTestId, TDmDomainState aPowerState, TDmDomainState aTestState) : 
   812 	CDmTest5(TDmDomainId aPowerId, TDmDomainId aTestId, TDmDomainState aPowerState, TDmDomainState aTestState) : 
   811 		CActive(CActive::EPriorityStandard), 
   813 		CActive(CActive::EPriorityStandard), 
   812 		iPowerDomainId(aPowerId), iTestDomainId(aTestId), iPowerState(aPowerState), iTestState(aTestState) {}
   814 		iPowerDomainId(aPowerId), iTestDomainId(aTestId), iPowerState(aPowerState), iTestState(aTestState) {}
   813 protected:
   815 protected:
   814 	// from CActive
   816 	// from CActive
   844 
   846 
   845 	TInt				iTransitionsCompleted;
   847 	TInt				iTransitionsCompleted;
   846 	TInt				iTransitionsExpected;
   848 	TInt				iTransitionsExpected;
   847 	};
   849 	};
   848 
   850 
   849 
   851 void CDmTest5::RunTestOnGetTransitionFailures(RArray<const TTransitionFailure>& aTransitionFailure)
       
   852 	{
       
   853 	//*************************************************
       
   854 	// Test - OOM Testing on GetTransitionFailures()
       
   855 	// Simulates heap failure in GetTransitionFailures()
       
   856 	//*************************************************
       
   857 	TInt error = 0;
       
   858 	TInt count = 0;	
       
   859 	do
       
   860 		{		
       
   861 		__UHEAP_SETFAIL(RHeap::EFailNext, ++count);
       
   862 		error = iTestDomainManager.GetTransitionFailures(aTransitionFailure);						
       
   863 		test.Printf( _L( "CDmTest5::RunTestOnGetTransitionFailures, simulating heap failure on GetTransitionFailures(), Error=%d, Run=%d\n" ), error, count );
       
   864 		}while(error == KErrNoMemory);		
       
   865 		
       
   866 	__UHEAP_RESET;
       
   867 	
       
   868 	//Actual count of heap failure as the final iteration which terminates the loop would not return KErrNoMemory 
       
   869 	--count;
       
   870 	test(count > 0);
       
   871 	test.Printf( _L( "Out of memory tests on GetTransitionFailures() succeeded at heap failure rate of %i\n" ), count );
       
   872 	}
   850 
   873 
   851 //! @SYMTestCaseID PBASE-T_DOMAIN-5
   874 //! @SYMTestCaseID PBASE-T_DOMAIN-5
   852 //! @SYMTestType CT
   875 //! @SYMTestType CT
   853 //! @SYMTestCaseDesc Connects to two domain hierarchies simulteneously and perform various tests
   876 //! @SYMTestCaseDesc Connects to two domain hierarchies simulteneously and perform various tests
   854 //! @SYMREQ 3704,3705,3706,3707,3708,3709,3710,3711,3720,3721,3724,3725,3726,3727
   877 //! @SYMREQ 3704,3705,3706,3707,3708,3709,3710,3711,3720,3721,3724,3725,3726,3727
  1104 	
  1127 	
  1105 	// get the failures on the test hierarchy
  1128 	// get the failures on the test hierarchy
  1106 	testFailureCount = iTestDomainManager.GetTransitionFailureCount();
  1129 	testFailureCount = iTestDomainManager.GetTransitionFailureCount();
  1107 	test (testFailureCount == 1);
  1130 	test (testFailureCount == 1);
  1108 
  1131 
       
  1132 #ifdef _DEBUG
       
  1133 	//***************************************************************
       
  1134 	// OOM Testing: Simulates heap failure in GetTransitionFailures()
       
  1135 	//***************************************************************
       
  1136 	__UHEAP_MARK;
       
  1137 	RArray<const TTransitionFailure> oomTestFailures;
       
  1138 	RunTestOnGetTransitionFailures(oomTestFailures);
       
  1139 	test(oomTestFailures.Count()==1);
       
  1140 	oomTestFailures.Close();
       
  1141 	__UHEAP_MARKEND;
       
  1142 #endif 
       
  1143 	
  1109 	r = iTestDomainManager.GetTransitionFailures(testFailures);
  1144 	r = iTestDomainManager.GetTransitionFailures(testFailures);
  1110 	test(r == KErrNone);
  1145 	test(r == KErrNone);
  1111 	test(testFailureCount == testFailures.Count());
  1146 	test(testFailureCount == testFailures.Count());
  1112 
  1147 
  1113 	test.Printf(_L("Test failures = %d\n"), testFailureCount);
  1148 	test.Printf(_L("Test failures = %d\n"), testFailureCount);
  2209 
  2244 
  2210 	while (iter--)
  2245 	while (iter--)
  2211 		{
  2246 		{
  2212 		MDmTest* tests[] = 
  2247 		MDmTest* tests[] = 
  2213 			{
  2248 			{
  2214 
       
  2215 			new CDmTest1(KDmIdRoot, EPwStandby),
  2249 			new CDmTest1(KDmIdRoot, EPwStandby),
  2216 			new CDmTest1(KDmIdRoot, EPwOff),
  2250 			new CDmTest1(KDmIdRoot, EPwOff),
  2217 			new CDmTest1(KDmIdRoot, EPwActive),
  2251 			new CDmTest1(KDmIdRoot, EPwActive),
  2218 			new CDmTest1(KDmIdApps, EPwStandby),
  2252 			new CDmTest1(KDmIdApps, EPwStandby),
  2219 			new CDmTest1(KDmIdApps, EPwOff),
  2253 			new CDmTest1(KDmIdApps, EPwOff),