messagingfw/msgtestfw/TestActions/Sms/src/CMtfTestActionInitialiseDefaultScheduleSettings.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 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // InitialiseDefaultScheduleSettings
       
    17 // [Action Parameters]
       
    18 // ScheduleSettings		output		CMsvScheduleSettings
       
    19 // OffPeakTimes			output		CMsvOffPeakTimes
       
    20 // ErrorActions			output		CMsvSendErrorActions
       
    21 // SysAgentActions			output		CMsvSysAgentActions
       
    22 // [Action Description]
       
    23 // InitialiseDefaultScheduleSettings Test Action is intended to set the member 
       
    24 // variables of CMsvScheduleSettings, CMsvOffPeakTimes, CMsvSendErrorActions, 
       
    25 // CMsvSysAgentActions classes with the default values.
       
    26 // [APIs Used]	
       
    27 // CSMSAccount::InitialiseDefaultScheduleSettingsL 
       
    28 // __ACTION_INFO_END__
       
    29 // 
       
    30 //
       
    31 
       
    32 #include <msvsenderroraction.h>
       
    33 #include <msvsysagentaction.h>
       
    34 #include <msvoffpeaktime.h>
       
    35 #include <msvschedulesettings.h>
       
    36 #include <csmsaccount.h>
       
    37 
       
    38 #include "CMtfTestCase.h"
       
    39 #include "CMtfTestActionParameters.h"
       
    40 #include "CMtfTestActionInitialiseDefaultScheduleSettings.h"
       
    41 
       
    42 
       
    43 
       
    44 
       
    45 /**
       
    46   Function : NewL
       
    47   Description : 
       
    48   @internalTechnology
       
    49   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    50   @param : aActionParams - CMtfTestActionParameters 
       
    51   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionInitialiseDefaultScheduleSettings object
       
    52   @pre none
       
    53   @post none
       
    54 */
       
    55 CMtfTestAction* CMtfTestActionInitialiseDefaultScheduleSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    56 	{
       
    57 	CMtfTestActionInitialiseDefaultScheduleSettings* self = new (ELeave) CMtfTestActionInitialiseDefaultScheduleSettings(aTestCase);
       
    58 	CleanupStack::PushL(self);
       
    59 	self->ConstructL(aActionParameters);
       
    60 	CleanupStack::Pop(self);
       
    61 	return self;
       
    62 	}
       
    63 
       
    64 /**
       
    65   Function : CMtfTestActionInitialiseDefaultScheduleSettings
       
    66   Description : Constructor
       
    67   @internalTechnology
       
    68   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    69   @return : N/A
       
    70   @pre none
       
    71   @post none
       
    72 */
       
    73 	
       
    74 CMtfTestActionInitialiseDefaultScheduleSettings::CMtfTestActionInitialiseDefaultScheduleSettings(CMtfTestCase& aTestCase)
       
    75 	: CMtfSynchronousTestAction(aTestCase)
       
    76 	{
       
    77 	}
       
    78 	
       
    79 /**
       
    80   Function : ~CMtfTestActionInitialiseDefaultScheduleSettings
       
    81   Description : Destructor
       
    82   @internalTechnology
       
    83   @param :
       
    84   @return : 
       
    85   @pre 
       
    86   @post 
       
    87 */
       
    88 CMtfTestActionInitialiseDefaultScheduleSettings::~CMtfTestActionInitialiseDefaultScheduleSettings()
       
    89 	{
       
    90 	}
       
    91 
       
    92 /**
       
    93   Function : ExecuteActionL
       
    94   Description : Entry point for the this test action in the test framework
       
    95   @internalTechnology
       
    96   @param : none
       
    97   @return : void
       
    98   @pre none 
       
    99   @post none
       
   100 */
       
   101 void CMtfTestActionInitialiseDefaultScheduleSettings::ExecuteActionL()
       
   102 	{
       
   103 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionInitialiseDefaultScheduleSettings);
       
   104 	CSmsAccount	*smsAccount = CSmsAccount::NewL();
       
   105 	CleanupStack::PushL( smsAccount );
       
   106 	
       
   107 	CMsvSysAgentActions *sysAgtActions = new (ELeave) CMsvSysAgentActions;
       
   108 	CleanupStack::PushL( sysAgtActions );
       
   109 	
       
   110 	CMsvSendErrorActions *sendErrorActions = CMsvSendErrorActions::NewL();
       
   111 	CleanupStack::PushL(sendErrorActions);
       
   112 	
       
   113 	CMsvOffPeakTimes *offPeakTimes = new (ELeave) CMsvOffPeakTimes;
       
   114 	CleanupStack::PushL( offPeakTimes );
       
   115 	
       
   116 	CMsvScheduleSettings *scheduleSettings = CMsvScheduleSettings::NewL();
       
   117 	CleanupStack::PushL( scheduleSettings );
       
   118 	
       
   119 	smsAccount->InitialiseDefaultSettingsL( *scheduleSettings, *offPeakTimes, *sendErrorActions, *sysAgtActions );
       
   120 		
       
   121 	StoreParameterL<CMsvScheduleSettings>(TestCase(), *scheduleSettings, ActionParameters().Parameter(0));
       
   122 	CleanupStack::Pop(scheduleSettings);
       
   123 	
       
   124 	StoreParameterL<CMsvOffPeakTimes>(TestCase(), *offPeakTimes, ActionParameters().Parameter(1));
       
   125 	CleanupStack::Pop(offPeakTimes);
       
   126 	
       
   127 	StoreParameterL<CMsvSendErrorActions>(TestCase(), *sendErrorActions, ActionParameters().Parameter(2));
       
   128 	CleanupStack::Pop(sendErrorActions);
       
   129 
       
   130 //	CleanupStack::PopAndDestroy(sendErrorActions);
       
   131 
       
   132 
       
   133 	
       
   134 	StoreParameterL<CMsvSysAgentActions>(TestCase(), *sysAgtActions, ActionParameters().Parameter(3));
       
   135 	CleanupStack::Pop(sysAgtActions);
       
   136 	
       
   137 //	CleanupStack::PopAndDestroy(sysAgtActions);
       
   138 //
       
   139 	
       
   140 	CleanupStack::PopAndDestroy( smsAccount );
       
   141 	
       
   142 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionInitialiseDefaultScheduleSettings );
       
   143 	TestCase().ActionCompletedL(*this);
       
   144 	
       
   145 	}
       
   146 
       
   147