messagingfw/msgtestfw/TestActions/Sms/src/CMtfTestActionChangeDefaultSmsService.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     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 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // ChangeDefaultSmsService
       
    17 // [Action Parameters]
       
    18 // serviceId	<input>:	TMsvId. Service ID to set as default.
       
    19 // smsClientMtm	<input>:	CSmsClientMtm	
       
    20 // [Action Description]
       
    21 // ChangeDefaultSmsService Test Action is intended to change the default SMS
       
    22 // service to serviceId.
       
    23 // [APIs Used]	
       
    24 // CSmsClientMtm::ChangeDefaultServiceL
       
    25 // __ACTION_INFO_END__
       
    26 // 
       
    27 //
       
    28 
       
    29 // system #includes
       
    30 #include <smsclnt.h>
       
    31 
       
    32 //user #includes
       
    33 #include "CMtfTestActionChangeDefaultSmsService.h"
       
    34 #include "TMtfTestParameterType.h"
       
    35 #include "CMtfTestCase.h"
       
    36 #include "CMtfTestActionParameters.h"
       
    37 
       
    38 /**
       
    39   Function : NewL
       
    40   Description : 
       
    41   @internalTechnology
       
    42   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    43   @param : aActionParams - CMtfTestActionParameters 
       
    44   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionChangeDefaultSmsService object
       
    45   @pre none
       
    46   @post none
       
    47 */
       
    48 CMtfTestAction* CMtfTestActionChangeDefaultSmsService::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    49 	{
       
    50 	CMtfTestActionChangeDefaultSmsService* self = new (ELeave) CMtfTestActionChangeDefaultSmsService(aTestCase);
       
    51 	CleanupStack::PushL(self);
       
    52 	self->ConstructL(aActionParameters);
       
    53 	CleanupStack::Pop(self);
       
    54 	return self;
       
    55 	}
       
    56 
       
    57 /**
       
    58   Function : CMtfTestActionChangeDefaultSmsService
       
    59   Description : Constructor
       
    60   @internalTechnology
       
    61   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    62   @return : N/A
       
    63   @pre none
       
    64   @post none
       
    65 */
       
    66 CMtfTestActionChangeDefaultSmsService::CMtfTestActionChangeDefaultSmsService(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    67 	{
       
    68 	}
       
    69 	
       
    70 /**
       
    71   Function : ~CMtfTestActionChangeDefaultSmsService
       
    72   Description : Destructor
       
    73   @internalTechnology
       
    74   @param :
       
    75   @return : 
       
    76   @pre 
       
    77   @post 
       
    78 */
       
    79 CMtfTestActionChangeDefaultSmsService::~CMtfTestActionChangeDefaultSmsService()
       
    80 	{
       
    81 	}
       
    82 
       
    83 /**
       
    84   Function : ExecuteActionL
       
    85   Description : Entry point for the this test action in the test framework
       
    86   @internalTechnology
       
    87   @param : none
       
    88   @return : void
       
    89   @pre none 
       
    90   @post none
       
    91 */
       
    92 void CMtfTestActionChangeDefaultSmsService::ExecuteActionL()
       
    93 	{
       
    94 	
       
    95 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionChangeDefaultSmsService);
       
    96 	TMsvId serviceId = ObtainValueParameterL<TMsvId>(TestCase(), ActionParameters().Parameter(0));
       
    97 	CSmsClientMtm* smsClientMtm = reinterpret_cast<CSmsClientMtm*> 
       
    98 		( ObtainParameterReferenceL<CBaseMtm>(TestCase(), ActionParameters().Parameter(1)));
       
    99 	
       
   100 	TRAPD( error, smsClientMtm->ChangeDefaultServiceL(serviceId) );
       
   101 	
       
   102 	if (error != KErrNone)
       
   103 		{
       
   104 		// Failed
       
   105 		TestCase().ERR_PRINTF2(_L("Failed to change SMS default service error(%d)"), error);
       
   106 		TestCase().SetTestStepResult(EFail);
       
   107 		}
       
   108 		
       
   109 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionChangeDefaultSmsService);
       
   110 	TestCase().ActionCompletedL(*this);	
       
   111 	}
       
   112 
       
   113