messagingfw/msgtestfw/TestActions/Capabilities/src/CMtfTestActionSendEMsvServiceProgress.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2004-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 "CMtfTestActionSendEMsvServiceProgress.h"
       
    17 
       
    18 #include <e32std.h>
       
    19 #include <e32base.h>
       
    20 
       
    21 #include <msvipc.h>
       
    22 #include <impcmtm.h>
       
    23 
       
    24 #include "MCLIENT.H"
       
    25 #include "MSERVER.H"
       
    26 #include "CMtfTestCase.h"
       
    27 #include "CMtfTestActionParameters.h"
       
    28 
       
    29 #include "IPCCommandForCapsPermissions.h"
       
    30 #include "SendProxyClient.h"
       
    31 #include "SendProxyserver.h"
       
    32 
       
    33 
       
    34 /**
       
    35   Function : NewL
       
    36   Description : 
       
    37   @internalTechnology
       
    38   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    39   @param : aActionParams - CMtfTestActionParameters 
       
    40   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSendEMsvServiceProgress object
       
    41   @pre none
       
    42   @post none
       
    43 */
       
    44 CMtfTestAction* CMtfTestActionSendEMsvServiceProgress::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    45 	{
       
    46 	CMtfTestActionSendEMsvServiceProgress* self = new (ELeave) CMtfTestActionSendEMsvServiceProgress(aTestCase);
       
    47 	CleanupStack::PushL(self);
       
    48 	self->ConstructL(aActionParameters);
       
    49 	CleanupStack::Pop(self);
       
    50 	return self;
       
    51 	}
       
    52 
       
    53 /**
       
    54   Function : CMtfTestActionSendEMsvServiceProgress
       
    55   Description : Constructor
       
    56   @internalTechnology
       
    57   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    58   @return : N/A
       
    59   @pre none
       
    60   @post none
       
    61 */
       
    62 CMtfTestActionSendEMsvServiceProgress::CMtfTestActionSendEMsvServiceProgress(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    63 	{
       
    64 	}
       
    65 	
       
    66 /**
       
    67   Function : ~CMtfTestActionSendEMsvServiceProgress
       
    68   Description : Destructor
       
    69   @internalTechnology
       
    70   @param :
       
    71   @return : 
       
    72   @pre 
       
    73   @post 
       
    74 */
       
    75 CMtfTestActionSendEMsvServiceProgress::~CMtfTestActionSendEMsvServiceProgress()
       
    76 	{
       
    77 	}
       
    78 
       
    79 /**
       
    80   Function : ExecuteActionL
       
    81   Description : Entry point for the this test action in the test framework
       
    82   @internalTechnology
       
    83   @param : none
       
    84   @return : void
       
    85   @pre none 
       
    86   @post none
       
    87 */
       
    88 
       
    89 void CMtfTestActionSendEMsvServiceProgress::ExecuteActionL()
       
    90 	{
       
    91 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvServiceProgress);
       
    92 	// for this test action we need a pending operation on the MTM
       
    93 	// we will create a spurious imap4 disconnect operation
       
    94 	TMsvId serviceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0));
       
    95 	CImap4ClientMtm* paramMtm = ObtainParameterReferenceL<CImap4ClientMtm>(TestCase(),ActionParameters().Parameter(1));
       
    96 	TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2) );
       
    97 	
       
    98 	CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
       
    99 	CleanupStack::PushL( selection );
       
   100 	selection->AppendL( serviceId );
       
   101 	TBuf8<1> param;
       
   102 
       
   103 	CMsvOperation* operation = paramMtm->InvokeAsyncFunctionL(KIMAP4MTMDisconnect,*selection,param,iStatus);
       
   104 	CleanupStack::PushL( operation );
       
   105 	
       
   106 	RProxyServerSession RPSS;
       
   107 	// Will auto start the server if not started.
       
   108 	
       
   109 	if ( RPSS.Connect() != KErrNone )
       
   110 		{
       
   111 		TestCase().ERR_PRINTF2(_L("%S :: Unable to start proxy server. !"), &KTestActionSendEMsvServiceProgress);
       
   112 		TestCase().SetTestStepResult(EFail);
       
   113 		}
       
   114 	else
       
   115 		{
       
   116 		TInt32 serverCaps;
       
   117 		RPSS.GetServerCapabilities(serverCaps);
       
   118 		TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps);
       
   119 				
       
   120 		HBufC8* buffer = HBufC8::NewLC(KMsvSessionBufferLength);
       
   121 		if (buffer==NULL)
       
   122 			{
       
   123 			TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvServiceProgress :: Unable to allocate mem. !"));
       
   124 			TestCase().SetTestStepResult(EFail);
       
   125 			}
       
   126 		else
       
   127 			{
       
   128 			TPtr8 pProgress = buffer->Des();
       
   129 			TInt retVal = RPSS.SendReceive(EMsvServiceProgress , TIpcArgs(serviceId, &pProgress));		
       
   130 			// there is no policing of the EMsvServiceProgress request so just pass the test 
       
   131 			// independent of what is returned
       
   132 			
       
   133 			TestCase().INFO_PRINTF2(_L("%S :: PASS :: Test Always Expected to Pass and Always Passes") , &KTestActionSendEMsvServiceProgress );
       
   134 			TestCase().SetTestStepResult(EPass);			
       
   135 			CleanupStack::PopAndDestroy(buffer);	
       
   136 			}
       
   137 		}
       
   138 
       
   139 	CleanupStack::PopAndDestroy( 2, selection ); // buffer, selection
       
   140 			
       
   141 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendEMsvServiceProgress);
       
   142 	TestCase().ActionCompletedL(*this);
       
   143 	}