phonebookengines/contactsmodel/tsrc/Integration/TCntPolice/Template/CStep.cpp
changeset 0 e686773b3f54
child 24 0ba2181d7c28
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 1997-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 #include "PARAM_MESS_NAME_CStep.h"
       
    17 
       
    18 
       
    19 //TO BE SAFE
       
    20 IMPORT_C TInt StartDialogThread();
       
    21 
       
    22 CPARAM_MESS_NAMEStep::CPARAM_MESS_NAMEStep()
       
    23 /** Each test step initialises it's own name
       
    24 */
       
    25 	{
       
    26 	// store the name of this test case
       
    27 	// this is the name that is used by the script file
       
    28 	//DEF iTestStepName = _L("CPARAM_MESS_NAMEStep");
       
    29 
       
    30 	//The server name and IPC number is obtained and all messages are checked Sync
       
    31 	SR_ServerName		= _L("PARAM_SVR_NAME");
       
    32 	SR_MESSAGE_TYPE		=	2;
       
    33 	SR_MESSAGE_ID		= PARAM_MESS_VALUE;
       
    34 	SR_MESSAGE_MASK		= PARAM_MESS_CAPMASKLL;
       
    35 
       
    36 	//The iServer_Panic is a unique name from Server,but always truncated to KMaxExitCategoryName
       
    37 	
       
    38 	iServer_Panic		=	_L("PARAM_SVR_T16_PANIC");
       
    39 
       
    40 	TCapability cap[] = {ECapabilityPARAM_MESS_NAMECAP, ECapability_Limit};
       
    41 	
       
    42 	TSecurityInfo info;
       
    43 	info.Set(RProcess());
       
    44 	TBool result = EFalse;
       
    45 	
       
    46 	for (TInt i = 0; cap[i] != ECapability_Limit; i++) 
       
    47 	{
       
    48 	
       
    49 		if (!(info.iCaps.HasCapability(cap[i])))
       
    50 		{
       
    51 			result=ETrue;
       
    52 		
       
    53 		}
       
    54 		
       
    55 	}
       
    56 	
       
    57 	
       
    58 	iExpect_Rejection = result;
       
    59 	
       
    60 	iStepCap			= PARAM_MESS_CAPMASKLL;
       
    61 
       
    62 	//Get a unique thread name
       
    63 	ChildThread_SR.Format(_L("ChildThread_%S_%d"),&SR_ServerName,SR_MESSAGE_ID);
       
    64 
       
    65 	}
       
    66 
       
    67 /*
       
    68 Exec_SendReceive():
       
    69 	This Fn is called by the Child Thread
       
    70 1.	Create a session with the server
       
    71 2.	Test an SendReceive call
       
    72 3.	Informs the main thread about the status of the call using
       
    73 	a.	iSessionCreated, if the a connection is established
       
    74 	b.	iResult_Server, holds the return value for connection 
       
    75 	c.	iResult_SR, the return value of SendReceive	call
       
    76 */
       
    77 TInt CPARAM_MESS_NAMEStep::Exec_SendReceive()
       
    78 	{
       
    79 	iResult_Server = CreateSession(SR_ServerName,Version(),2);
       
    80 
       
    81 	if (iResult_Server!=KErrNone)
       
    82 		{
       
    83 
       
    84 		iResult_Server=StartServer();
       
    85 		if (iResult_Server!=KErrNone)
       
    86 			return(iResult_Server);
       
    87 
       
    88 		iResult_Server = CreateSession(SR_ServerName,TVersion(),2);
       
    89 		}
       
    90 	if(iResult_Server == 0)
       
    91 		{
       
    92 		iSessionCreated = ETrue;
       
    93 		if(SR_MESSAGE_ID >= 0)
       
    94 			iResult_SR	=	SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0));
       
    95 		}
       
    96 
       
    97 	return iResult_Server;
       
    98 	}