messagingfw/msgtestfw/TestActions/Sms/src/CMtfTestActionSetDefaultSmsSettings.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2003-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 // SetDefaultSmsSettings
       
    17 // [Action Parameters]
       
    18 // HBufC& FilePath(s) <input>: Name of the file paths to be set as the SMS settings script for this test case.
       
    19 // There can be more than one parameter, each identifying one SMS settings file
       
    20 // [Action Description]
       
    21 // Sets the default SMS settings files for the test case.
       
    22 // [APIs Used]
       
    23 // none.
       
    24 // __ACTION_INFO_END__
       
    25 // 
       
    26 //
       
    27 
       
    28 /**
       
    29  @file
       
    30 */
       
    31 
       
    32 #include "CMtfTestActionSetDefaultSmsSettings.h"
       
    33 #include "CMtfTestCase.h"
       
    34 #include "CMtfTestActionParameters.h"
       
    35 
       
    36 #include <s32file.h>
       
    37 
       
    38 
       
    39 CMtfTestAction* CMtfTestActionSetDefaultSmsSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    40 	{
       
    41 	CMtfTestActionSetDefaultSmsSettings* self = new (ELeave) CMtfTestActionSetDefaultSmsSettings(aTestCase);
       
    42 	CleanupStack::PushL(self);
       
    43 	self->ConstructL(aActionParameters);
       
    44 	CleanupStack::Pop();
       
    45 	return self;
       
    46 	}
       
    47 	
       
    48 
       
    49 CMtfTestActionSetDefaultSmsSettings::CMtfTestActionSetDefaultSmsSettings(CMtfTestCase& aTestCase)
       
    50 	: CMtfSynchronousTestAction(aTestCase)
       
    51 	{
       
    52 	}
       
    53 
       
    54 
       
    55 CMtfTestActionSetDefaultSmsSettings::~CMtfTestActionSetDefaultSmsSettings()
       
    56 	{
       
    57 	}
       
    58 
       
    59 void CMtfTestActionSetDefaultSmsSettings::ExecuteActionL()
       
    60 	{
       
    61 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetDefaultSmsSettings);
       
    62 	HBufC* paramFilePath = NULL;
       
    63 	
       
    64 	// Create a ConfigurationType object of type SMS settings
       
    65 	CMtfConfigurationType* smsSettingsConfiguration = CMtfConfigurationType::NewL(CMtfConfigurationType::EMtfSmsSettings);
       
    66 	CleanupStack::PushL(smsSettingsConfiguration);
       
    67 	
       
    68 	// loop through the parameters and add the files as configuration files to the object
       
    69 	TInt numFiles = ActionParameters().Count();
       
    70 	
       
    71 	if(numFiles <= 0) // panic if we don't have any parameters
       
    72 		TestCase().Panic(CMtfTestCase::EMtfMissingParameters);
       
    73 
       
    74 	for (TInt i=0; i<numFiles; i++)
       
    75 		{
       
    76 		paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(i));
       
    77 
       
    78 		smsSettingsConfiguration->AddConfigurationFilenameL(paramFilePath->Des());
       
    79 		} 
       
    80 
       
    81 	// Pop it, since the test case will take ownership of it.
       
    82 	CleanupStack::Pop(smsSettingsConfiguration); // smsSettingsConfiguration
       
    83 	
       
    84 	TestCase().SetTestCaseDefaultConfigurationTypeL(smsSettingsConfiguration);
       
    85 	 
       
    86 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetDefaultSmsSettings);
       
    87 	TestCase().ActionCompletedL(*this);
       
    88 	}
       
    89 
       
    90 
       
    91