resourcemgmt/hwresourcesmgr/test/TestCapsHWRMPolicing/src/HWRMFmTxOff_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 "HWRMFmTxOff_CStep.h"
       
    19 #include "HWRMFmTxClientServer.h"
       
    20 
       
    21 
       
    22 //TO BE SAFE
       
    23 IMPORT_C TInt StartDialogThread();
       
    24 
       
    25 CHWRMFmTxOffStep::CHWRMFmTxOffStep()
       
    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 KCapabilityCapabilityMultimediaDDBitMask  = 0x8; //8LL;
       
    34 	
       
    35 	//The server name and IPC number is obtained and all messages are checked Sync
       
    36 	SR_ServerName		= KServerProcessName;
       
    37 	SR_MESSAGE_TYPE		= KSyncMessage;	//Is it Async or sync?
       
    38 	SR_MESSAGE_ID		= EHWRMFmTxOff ;	//It holds the IPC number
       
    39 	SR_MESSAGE_MASK		= KCapabilityCapabilityMultimediaDDBitMask; //Holds the cap mask for the message
       
    40 	
       
    41 	
       
    42 
       
    43 	//The iServer_Panic is a unique name from Server,but always truncated to KMaxExitCategoryName
       
    44 
       
    45 	iServer_Panic		=	_L("HWRM Server");
       
    46 
       
    47 	//TCapability cap[] = {ECapabilityPARAM_MESS_NAMECAP, ECapability_Limit};
       
    48 	TCapability cap[] = {ECapabilityMultimediaDD, ECapability_Limit};
       
    49 
       
    50 	TSecurityInfo info;
       
    51 	info.Set(RProcess());
       
    52 	TBool result = EFalse;
       
    53 
       
    54 	for (TInt i = 0; cap[i] != ECapability_Limit; i++)
       
    55 	{
       
    56 
       
    57 		if (!(info.iCaps.HasCapability(cap[i])))
       
    58 		{
       
    59 			result=ETrue;
       
    60 
       
    61 		}
       
    62 
       
    63 	}
       
    64 #ifdef HWRM_FMTX_POLICY_CHECKING_DISABLED
       
    65             
       
    66     result = EFalse;
       
    67             
       
    68 #endif
       
    69             
       
    70                 
       
    71     iExpect_Rejection = result;
       
    72 
       
    73 	iStepCap            = KCapabilityCapabilityMultimediaDDBitMask;
       
    74 
       
    75 	//Get a unique thread name
       
    76 	ChildThread_SR.Format(_L("ChildThread_%S_%d"),&SR_ServerName,SR_MESSAGE_ID);
       
    77 	}
       
    78 
       
    79 /*
       
    80 Exec_SendReceive():
       
    81 	This Fn is called by the Child Thread
       
    82 1.	Create a session with the server
       
    83 2.	Test an SendReceive call
       
    84 3.	Informs the main thread about the status of the call using
       
    85 	a.	iSessionCreated, if the a connection is established
       
    86 	b.	iResult_Server, holds the return value for connection
       
    87 	c.	iResult_SR, the return value of SendReceive	call
       
    88 */
       
    89 
       
    90 TInt CHWRMFmTxOffStep::Exec_SendReceive()
       
    91 	{
       
    92 	iResult_Server = CreateSession(SR_ServerName,Version(),2);
       
    93 
       
    94 	if (iResult_Server!=KErrNone)
       
    95 		{
       
    96 
       
    97 		iResult_Server=StartServer();
       
    98 		if (iResult_Server!=KErrNone)
       
    99 			return(iResult_Server);
       
   100 
       
   101 		iResult_Server = CreateSession(SR_ServerName,TVersion(),2);
       
   102 		}
       
   103 	if(iResult_Server == KErrNone)
       
   104 		{
       
   105 		iSessionCreated = ETrue;
       
   106 		
       
   107 		/*
       
   108 		if(SR_MESSAGE_ID == EEtelDbgMarkHeap ||
       
   109 			SR_MESSAGE_ID == EEtelDbgCheckHeap ||
       
   110 			SR_MESSAGE_ID == EEtelDbgMarkEnd ||
       
   111 			SR_MESSAGE_ID == EEtelDbgFailNext)
       
   112 				{
       
   113  				iResult_SR = TestDebugHeap(SR_MESSAGE_ID);
       
   114 				}
       
   115 		else
       
   116 			*/
       
   117 			if(SR_MESSAGE_ID >= 0)
       
   118 				{
       
   119 			 	TIpcArgs args(0,0,0,0);
       
   120 				iResult_SR	=	SendReceive(SR_MESSAGE_ID,args);
       
   121 				}
       
   122 		}
       
   123 
       
   124 	return iResult_Server;
       
   125 	}