resourcemgmt/hwresourcesmgr/test/TestCapsHWRMPolicing/src/HWRMFmTxClearRtData_CStep.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 //Test Step header
       
    18 #include "HWRMFmTxClearRtData_CStep.h"
       
    19 #include "HWRMFmTxClientServer.h"
       
    20 
       
    21 
       
    22 //TO BE SAFE
       
    23 IMPORT_C TInt StartDialogThread();
       
    24 
       
    25 CHWRMFmTxClearRtDataStep::CHWRMFmTxClearRtDataStep()
       
    26 /** Each test step initialises it's own name
       
    27 */
       
    28 	{
       
    29 	// store the name of this test case
       
    30 	// this is the name that is used by the script file
       
    31 	//DEF iTestStepName = _L("CPARAM_MESS_NAMEStep");
       
    32 
       
    33 	const TUint32 KCapabilityWriteUserDataBitMask  = 0x10000; // 65536LL;
       
    34 	const TUint32 KCapabilityCapabilityMultimediaDDBitMask  = 0x8; //8LL;
       
    35 	
       
    36 	//The server name and IPC number is obtained and all messages are checked Sync
       
    37 	SR_ServerName		= KServerProcessName;
       
    38 	SR_MESSAGE_TYPE		= KSyncMessage;	//Is it Async or sync?
       
    39 	SR_MESSAGE_ID		= EHWRMFmTxClearRtData ;	//It holds the IPC number
       
    40 	SR_MESSAGE_MASK		= KCapabilityCapabilityMultimediaDDBitMask + KCapabilityWriteUserDataBitMask; //Holds the cap mask for the message
       
    41 	
       
    42 	
       
    43 
       
    44 	//The iServer_Panic is a unique name from Server,but always truncated to KMaxExitCategoryName
       
    45 
       
    46 	iServer_Panic		=	_L("HWRM Server");
       
    47 
       
    48 	//TCapability cap[] = {ECapabilityPARAM_MESS_NAMECAP, ECapability_Limit};
       
    49 	TCapability cap[] = {ECapabilityMultimediaDD, ECapabilityWriteUserData, ECapability_Limit};
       
    50 
       
    51 	TSecurityInfo info;
       
    52 	info.Set(RProcess());
       
    53 	TBool result = EFalse;
       
    54 
       
    55 	for (TInt i = 0; cap[i] != ECapability_Limit; i++)
       
    56 	{
       
    57 
       
    58 		if (!(info.iCaps.HasCapability(cap[i])))
       
    59 		{
       
    60 			result=ETrue;
       
    61 
       
    62 		}
       
    63 
       
    64 	}
       
    65 	
       
    66 #ifdef HWRM_FMTX_POLICY_CHECKING_DISABLED
       
    67             
       
    68     result = EFalse;
       
    69             
       
    70 #endif
       
    71             
       
    72                 
       
    73     iExpect_Rejection = result;
       
    74 
       
    75 
       
    76 	iStepCap            = KCapabilityCapabilityMultimediaDDBitMask + KCapabilityWriteUserDataBitMask;
       
    77 
       
    78 	//Get a unique thread name
       
    79 	ChildThread_SR.Format(_L("ChildThread_%S_%d"),&SR_ServerName,SR_MESSAGE_ID);
       
    80 	}
       
    81 
       
    82 /*
       
    83 Exec_SendReceive():
       
    84 	This Fn is called by the Child Thread
       
    85 1.	Create a session with the server
       
    86 2.	Test an SendReceive call
       
    87 3.	Informs the main thread about the status of the call using
       
    88 	a.	iSessionCreated, if the a connection is established
       
    89 	b.	iResult_Server, holds the return value for connection
       
    90 	c.	iResult_SR, the return value of SendReceive	call
       
    91 */
       
    92 
       
    93 TInt CHWRMFmTxClearRtDataStep::Exec_SendReceive()
       
    94 	{
       
    95 	iResult_Server = CreateSession(SR_ServerName,Version(),2);
       
    96 
       
    97 	if (iResult_Server!=KErrNone)
       
    98 		{
       
    99 
       
   100 		iResult_Server=StartServer();
       
   101 		if (iResult_Server!=KErrNone)
       
   102 			return(iResult_Server);
       
   103 
       
   104 		iResult_Server = CreateSession(SR_ServerName,TVersion(),2);
       
   105 		}
       
   106 	if(iResult_Server == KErrNone)
       
   107 		{
       
   108 		iSessionCreated = ETrue;
       
   109 		
       
   110 		/*
       
   111 		if(SR_MESSAGE_ID == EEtelDbgMarkHeap ||
       
   112 			SR_MESSAGE_ID == EEtelDbgCheckHeap ||
       
   113 			SR_MESSAGE_ID == EEtelDbgMarkEnd ||
       
   114 			SR_MESSAGE_ID == EEtelDbgFailNext)
       
   115 				{
       
   116  				iResult_SR = TestDebugHeap(SR_MESSAGE_ID);
       
   117 				}
       
   118 		else
       
   119 			*/
       
   120 			if(SR_MESSAGE_ID >= 0)
       
   121 				{
       
   122 			 	TIpcArgs args(0,0,0,0);
       
   123 				iResult_SR	=	SendReceive(SR_MESSAGE_ID,args);
       
   124 				}
       
   125 		}
       
   126 
       
   127 	return iResult_Server;
       
   128 	}