kerneltest/e32test/power/t_domain.cpp
branchRCL_3
changeset 294 039a3e647356
parent 257 3e88ff8f41d5
child 295 5460f47b94ad
equal deleted inserted replaced
268:345b1ca54e88 294:039a3e647356
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2009 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 	
       
   812 	CDmTest5(TDmDomainId aPowerId, TDmDomainId aTestId, TDmDomainState aPowerState, TDmDomainState aTestState) : 
   810 	CDmTest5(TDmDomainId aPowerId, TDmDomainId aTestId, TDmDomainState aPowerState, TDmDomainState aTestState) : 
   813 		CActive(CActive::EPriorityStandard), 
   811 		CActive(CActive::EPriorityStandard), 
   814 		iPowerDomainId(aPowerId), iTestDomainId(aTestId), iPowerState(aPowerState), iTestState(aTestState) {}
   812 		iPowerDomainId(aPowerId), iTestDomainId(aTestId), iPowerState(aPowerState), iTestState(aTestState) {}
   815 protected:
   813 protected:
   816 	// from CActive
   814 	// from CActive
   846 
   844 
   847 	TInt				iTransitionsCompleted;
   845 	TInt				iTransitionsCompleted;
   848 	TInt				iTransitionsExpected;
   846 	TInt				iTransitionsExpected;
   849 	};
   847 	};
   850 
   848 
   851 void CDmTest5::RunTestOnGetTransitionFailures(RArray<const TTransitionFailure>& aTransitionFailure)
   849 
   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 	}
       
   873 
   850 
   874 //! @SYMTestCaseID PBASE-T_DOMAIN-5
   851 //! @SYMTestCaseID PBASE-T_DOMAIN-5
   875 //! @SYMTestType CT
   852 //! @SYMTestType CT
   876 //! @SYMTestCaseDesc Connects to two domain hierarchies simulteneously and perform various tests
   853 //! @SYMTestCaseDesc Connects to two domain hierarchies simulteneously and perform various tests
   877 //! @SYMREQ 3704,3705,3706,3707,3708,3709,3710,3711,3720,3721,3724,3725,3726,3727
   854 //! @SYMREQ 3704,3705,3706,3707,3708,3709,3710,3711,3720,3721,3724,3725,3726,3727
  1127 	
  1104 	
  1128 	// get the failures on the test hierarchy
  1105 	// get the failures on the test hierarchy
  1129 	testFailureCount = iTestDomainManager.GetTransitionFailureCount();
  1106 	testFailureCount = iTestDomainManager.GetTransitionFailureCount();
  1130 	test (testFailureCount == 1);
  1107 	test (testFailureCount == 1);
  1131 
  1108 
  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 	
       
  1144 	r = iTestDomainManager.GetTransitionFailures(testFailures);
  1109 	r = iTestDomainManager.GetTransitionFailures(testFailures);
  1145 	test(r == KErrNone);
  1110 	test(r == KErrNone);
  1146 	test(testFailureCount == testFailures.Count());
  1111 	test(testFailureCount == testFailures.Count());
  1147 
  1112 
  1148 	test.Printf(_L("Test failures = %d\n"), testFailureCount);
  1113 	test.Printf(_L("Test failures = %d\n"), testFailureCount);
  2244 
  2209 
  2245 	while (iter--)
  2210 	while (iter--)
  2246 		{
  2211 		{
  2247 		MDmTest* tests[] = 
  2212 		MDmTest* tests[] = 
  2248 			{
  2213 			{
       
  2214 
  2249 			new CDmTest1(KDmIdRoot, EPwStandby),
  2215 			new CDmTest1(KDmIdRoot, EPwStandby),
  2250 			new CDmTest1(KDmIdRoot, EPwOff),
  2216 			new CDmTest1(KDmIdRoot, EPwOff),
  2251 			new CDmTest1(KDmIdRoot, EPwActive),
  2217 			new CDmTest1(KDmIdRoot, EPwActive),
  2252 			new CDmTest1(KDmIdApps, EPwStandby),
  2218 			new CDmTest1(KDmIdApps, EPwStandby),
  2253 			new CDmTest1(KDmIdApps, EPwOff),
  2219 			new CDmTest1(KDmIdApps, EPwOff),