pimappservices/calendar/tsrc/Integration/TestCalApiPolicing/generated/EDateIteratorCurrentElement1_CStep.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 2006-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 //Test Step header
       
    17 #include "EDateIteratorCurrentElement1_CStep.h"
       
    18 
       
    19 
       
    20 //TO BE SAFE
       
    21 IMPORT_C TInt StartDialogThread();
       
    22 
       
    23 CEDateIteratorCurrentElement1Step::CEDateIteratorCurrentElement1Step()
       
    24 /** Each test step initialises it's own name
       
    25 */
       
    26 	{
       
    27 	// store the name of this test case
       
    28 	// this is the name that is used by the script file
       
    29 	//DEF iTestStepName = _L("CEDateIteratorCurrentElement1Step");
       
    30 
       
    31 	//The server name and IPC number is obtained and all messages are checked Sync
       
    32 	SR_ServerName		= _L("!AgendaServer");
       
    33 	SR_MESSAGE_ID		= 102;
       
    34 	SR_MESSAGE_MASK		= 32768LL;
       
    35 
       
    36 	//The iServer_Panic is a unique name from Server,but always truncated to KMaxExitCategoryName
       
    37 	
       
    38 	iServer_Panic		=	_L("AgnServer");
       
    39 
       
    40 	TCapability cap[] = {ECapabilityReadUserData, 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 		if (!(info.iCaps.HasCapability(cap[i])))
       
    49 			{
       
    50 			result=ETrue;
       
    51 			}
       
    52 		}
       
    53 	
       
    54 	SR_MESSAGE_TYPE		= GetSyncOrAsync(SR_MESSAGE_ID);
       
    55 
       
    56 	iExpect_Rejection = result;
       
    57 	
       
    58 	iStepCap			= 32768LL;
       
    59 
       
    60 	//Get a unique thread name
       
    61 	ChildThread_SR.Format(_L("ChildThread_%S_%d"),&SR_ServerName,SR_MESSAGE_ID);
       
    62 
       
    63 	}
       
    64 
       
    65 /*
       
    66 Exec_SendReceive():
       
    67 	This Fn is called by the Child Thread
       
    68 1.	Create a session with the server
       
    69 2.	Test an SendReceive call
       
    70 3.	Informs the main thread about the status of the call using
       
    71 	a.	iSessionCreated, if the a connection is established
       
    72 	b.	iResult_Server, holds the return value for connection 
       
    73 	c.	iResult_SR, the return value of SendReceive	call
       
    74 */
       
    75 TInt CEDateIteratorCurrentElement1Step::Exec_SendReceive()
       
    76 	{
       
    77 	iResult_Server = CreateSession(SR_ServerName,Version(),2);
       
    78 
       
    79 	if (iResult_Server!=KErrNone)
       
    80 		{
       
    81 
       
    82 		iResult_Server=StartServer();
       
    83 		if (iResult_Server!=KErrNone)
       
    84 			return(iResult_Server);
       
    85 
       
    86 		iResult_Server = CreateSession(SR_ServerName, Version(),2);
       
    87 		}
       
    88 	if(iResult_Server == KErrNone)
       
    89 		{
       
    90 		iSessionCreated = ETrue;
       
    91 		if(SR_MESSAGE_ID >= 0)
       
    92 			{
       
    93 			if(SR_MESSAGE_TYPE == KSyncMessage)
       
    94 				{
       
    95 				iResult_SR	=	SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0));
       
    96 				}
       
    97 			else
       
    98 				{
       
    99 				TRequestStatus status;
       
   100 				SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0), status);
       
   101 				iResult_SR = WaitForSomeTimeAndDecide(status);
       
   102 				}
       
   103 			}
       
   104 		}
       
   105 
       
   106 	return iResult_Server;
       
   107 	}