kerneltest/e32test/secure/t_suser.cpp
branchRCL_3
changeset 87 2f92ad2dc5db
parent 0 a41df078684a
child 286 48e57fb1237e
equal deleted inserted replaced
81:e7d2d738d3c2 87:2f92ad2dc5db
    40 #define __E32TEST_EXTENSION__
    40 #define __E32TEST_EXTENSION__
    41 
    41 
    42 #include <e32test.h>
    42 #include <e32test.h>
    43 #include <e32svr.h>
    43 #include <e32svr.h>
    44 #include <nkern/nk_trace.h>
    44 #include <nkern/nk_trace.h>
       
    45 #include <e32hal.h>
       
    46 #include <hal.h>
    45 
    47 
    46 LOCAL_D RTest test(_L("T_SUSER"));
    48 LOCAL_D RTest test(_L("T_SUSER"));
    47 
    49 
    48 _LIT(KSyncSemaphoreName,"T_SUSER-SyncSemaphore");
    50 _LIT(KSyncSemaphoreName,"T_SUSER-SyncSemaphore");
    49 RSemaphore SyncSemaphore;
    51 RSemaphore SyncSemaphore;
   944 	User::WaitForRequest(logonStatus);
   946 	User::WaitForRequest(logonStatus);
   945 	test(process.ExitType()==EExitKill);
   947 	test(process.ExitType()==EExitKill);
   946 	test(logonStatus==KErrPermissionDenied);
   948 	test(logonStatus==KErrPermissionDenied);
   947 	CLOSE_AND_WAIT(process);
   949 	CLOSE_AND_WAIT(process);
   948 
   950 
   949 	test.Next(_L("Calling UserSvr::AddEvent(ESwitchOff) with ECapabilityPowerMgmt & ECapabilitySwEvent"));
   951 	TInt muid = 0;
   950 	TRequestStatus absstatus;
   952 	HAL::Get(HAL::EMachineUid, muid);
   951 	RTimer abstimer;
   953 	if(muid==HAL::EMachineUid_OmapH2 || muid==HAL::EMachineUid_OmapH4 || muid==HAL::EMachineUid_OmapH6 || muid==HAL::EMachineUid_NE1_TB || muid==HAL::EMachineUid_X86PC || muid==HAL::EMachineUid_Win32Emulator)
   952 	TInt r = abstimer.CreateLocal();
   954 		{
   953 	test (r == KErrNone);
   955 		test.Next(_L("Calling UserSvr::AddEvent(ESwitchOff) with ECapabilityPowerMgmt & ECapabilitySwEvent"));
   954 	SetAbsoluteTimeout(abstimer, 5000000, absstatus); // 5 sec
   956 		TRequestStatus absstatus;
   955 	process.Create((1u<<ECapabilitySwEvent)|(1u<<ECapabilityPowerMgmt),ETestProcessAddEventESwitchOff);
   957 		RTimer abstimer;
   956 	process.Logon(logonStatus);
   958 		TInt r = abstimer.CreateLocal();
   957 	process.Resume();
   959 		test (r == KErrNone);
   958 	User::WaitForRequest(absstatus);
   960 		SetAbsoluteTimeout(abstimer, 5000000, absstatus); // 5 sec
   959 	abstimer.Close();
   961 		process.Create((1u<<ECapabilitySwEvent)|(1u<<ECapabilityPowerMgmt),ETestProcessAddEventESwitchOff);
   960 	User::WaitForRequest(logonStatus);
   962 		process.Logon(logonStatus);
   961 	test(process.ExitType()==EExitKill);
   963 		process.Resume();
   962 	test(logonStatus==KErrNone);
   964 		User::WaitForRequest(absstatus);
   963 	CLOSE_AND_WAIT(process);
   965 		abstimer.Close();
       
   966 		User::WaitForRequest(logonStatus);
       
   967 		test(process.ExitType()==EExitKill);
       
   968 		test(logonStatus==KErrNone);
       
   969 		CLOSE_AND_WAIT(process);
       
   970 		}
   964 
   971 
   965 	test.End();
   972 	test.End();
   966 	}
   973 	}
   967 
   974 
   968 
   975