commsprocess/commsrootserverconfig/te_cap_rootserver/RSDbgSetMbufPoolLimit1_CStep.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     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 
       
    17 
       
    18 //Test Step header
       
    19 #include "RSDbgSetMbufPoolLimit1_CStep.h"
       
    20 
       
    21 //TO BE SAFE
       
    22 IMPORT_C TInt StartDialogThread();
       
    23 
       
    24 /**
       
    25  Each test step initialises it's own name
       
    26 */
       
    27 CRSDbgSetMbufPoolLimit1Step::CRSDbgSetMbufPoolLimit1Step()
       
    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("CRSDbgSetMbufPoolLimit1Step");
       
    32 
       
    33 	//The server name and IPC number is obtained and all messages are checked Sync
       
    34 	SR_ServerName		= _L("!RootServer");
       
    35 	SR_MESSAGE_TYPE		=	2;
       
    36 	SR_MESSAGE_ID		= RootServer::RSDbgSetMbufPoolLimit;
       
    37 	SR_MESSAGE_MASK		= 1024;
       
    38 
       
    39 	// Added to support SID/VID testing
       
    40 	SR_MESSAGE_SID		= TSecureId (0x00000000);
       
    41 	SR_MESSAGE_VID		= TVendorId (0x70000001);
       
    42 
       
    43 	//The iServer_Panic is a unique name from Server,but always truncated to KMaxExitCategoryName
       
    44 	
       
    45 	iServer_Panic		=	_L("Root Server Test");
       
    46 
       
    47 	TCapability cap[] = {ECapabilityNetworkControl, ECapability_Limit};
       
    48 	
       
    49 	TSecurityInfo info;
       
    50 	info.Set(RProcess());
       
    51 	TBool result = EFalse;
       
    52 	
       
    53 	// Skip check if no caps are required
       
    54 	if (cap[0] != ECapability_None)
       
    55 		{
       
    56 		for (TInt i = 0; cap[i] != ECapability_Limit; i++) 
       
    57 			{
       
    58 			if (!(info.iCaps.HasCapability(cap[i])))
       
    59 				{
       
    60 				// this process doesn't have required caps - expect fail
       
    61 				result=ETrue;
       
    62 				break;
       
    63 				}
       
    64 			
       
    65 			}
       
    66 		}
       
    67 
       
    68 	if (!result && SR_MESSAGE_SID != 0)
       
    69 		{
       
    70 		if (info.iSecureId != SR_MESSAGE_SID)
       
    71 			{
       
    72 			// this process doesn't have the required SID - expect fail
       
    73 			result=ETrue;
       
    74 			}
       
    75 		}
       
    76 		
       
    77 	if (!result && SR_MESSAGE_VID != 0)
       
    78 		{
       
    79 		if (info.iVendorId != SR_MESSAGE_VID)
       
    80 			{
       
    81 			// this process doesn't have the required SID - expect fail
       
    82 			result=ETrue;
       
    83 			}
       
    84 		}
       
    85 	
       
    86 	iExpect_Rejection = result;
       
    87 	
       
    88 	iStepCap			= 1024;
       
    89 
       
    90 	//Get a unique thread name
       
    91 	ChildThread_SR.Format(_L("ChildThread_%S_%d"),&SR_ServerName,SR_MESSAGE_ID);
       
    92 
       
    93 	}
       
    94 
       
    95 /**
       
    96 	This Fn is called by the Child Thread
       
    97 1.	Create a session with the server
       
    98 2.	Test an SendReceive call
       
    99 3.	Informs the main thread about the status of the call using
       
   100 	a.	iSessionCreated, if the a connection is established
       
   101 	b.	iResult_Server, holds the return value for connection 
       
   102 	c.	iResult_SR, the return value of SendReceive	call
       
   103 */
       
   104 TInt CRSDbgSetMbufPoolLimit1Step::Exec_SendReceive()
       
   105 	{
       
   106 	iResult_Server = CreateSession(SR_ServerName,Version(),2);
       
   107 
       
   108 	if (iResult_Server!=KErrNone)
       
   109 		{
       
   110 		iResult_Server=StartServer();
       
   111 		if (iResult_Server!=KErrNone)
       
   112 			{
       
   113 			return(iResult_Server);
       
   114 			}
       
   115 
       
   116 		iResult_Server = CreateSession(SR_ServerName,TVersion(),2);
       
   117 		}
       
   118 		
       
   119 	if(iResult_Server == 0)
       
   120 		{
       
   121 		iSessionCreated = ETrue;
       
   122 		if(SR_MESSAGE_ID >= 0)
       
   123 			{
       
   124 			iResult_SR	=	SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0));
       
   125 			}
       
   126 		}
       
   127 
       
   128 	return iResult_Server;
       
   129 	}
       
   130