messagingfw/msgtestfw/TestActions/Email/Pop3/src/CMtfTestActionPopulateDefaultPopSettings.cpp
changeset 22 bde600d88860
parent 0 8e480a14352b
equal deleted inserted replaced
21:08008ce8a6df 22:bde600d88860
       
     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 // PopulateDefaultPopSettings
       
    17 // [Action Parameters]
       
    18 // PopSettings			output		CImPop4Settings
       
    19 // PopIAP				output		CImIAPPreferences
       
    20 // SMTPSettings		output		CImSMTPSettings
       
    21 // SmtpIAP				output		CImIAPPreferences
       
    22 // [Action Description]
       
    23 // PopulateDefaultPopSettings Test Action is intended to fill the setting objects 
       
    24 // with default values from account 0.
       
    25 // [APIs Used]	
       
    26 // CEmailAccounts::PopulateDefaultPopSettingsL
       
    27 // __ACTION_INFO_END__
       
    28 // 
       
    29 //
       
    30 
       
    31 
       
    32 #include <pop3set.h>
       
    33 #include <smtpset.h>
       
    34 
       
    35 #include <cemailaccounts.h>
       
    36 #include <iapprefs.h>
       
    37 
       
    38 
       
    39 
       
    40 #include "CMtfTestActionPopulateDefaultPopSettings.h"
       
    41 #include "CMtfTestCase.h"
       
    42 #include "CMtfTestActionParameters.h"
       
    43 #include "CMtfTestActionUtilsPopScripts.h"
       
    44 
       
    45 
       
    46 
       
    47 /**
       
    48   Function : NewL
       
    49   Description : 
       
    50   @internalTechnology
       
    51   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    52   @param : aActionParams - CMtfTestActionParameters 
       
    53   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionPopulateDefaultPopSettings object
       
    54   @pre none
       
    55   @post none
       
    56 */
       
    57 CMtfTestAction* CMtfTestActionPopulateDefaultPopSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    58 	{
       
    59 	CMtfTestActionPopulateDefaultPopSettings* self = new (ELeave) CMtfTestActionPopulateDefaultPopSettings(aTestCase);
       
    60 	CleanupStack::PushL(self);
       
    61 	self->ConstructL(aActionParameters);
       
    62 	CleanupStack::Pop(self);
       
    63 	return self;
       
    64 	}
       
    65 
       
    66 /**
       
    67   Function : ~CMtfTestActionPopulateDefaultPopSettings
       
    68   Description : Destructor
       
    69   @internalTechnology
       
    70   @param :
       
    71   @return : 
       
    72   @pre 
       
    73   @post 
       
    74 */
       
    75 CMtfTestActionPopulateDefaultPopSettings::~CMtfTestActionPopulateDefaultPopSettings()
       
    76 	{
       
    77 	}
       
    78 
       
    79 /**
       
    80   Function : CMtfTestActionPopulateDefaultPopSettings
       
    81   Description : Constructor
       
    82   @internalTechnology
       
    83   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    84   @return : N/A
       
    85   @pre none
       
    86   @post none
       
    87 */
       
    88 CMtfTestActionPopulateDefaultPopSettings::CMtfTestActionPopulateDefaultPopSettings(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    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 CMtfTestActionPopulateDefaultPopSettings::ExecuteActionL()
       
   102 	{
       
   103 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionPopulateDefaultPopSettings);
       
   104 	CEmailAccounts* emailAccounts = CEmailAccounts::NewL();
       
   105 	CleanupStack::PushL(emailAccounts);
       
   106 	
       
   107 	CImIAPPreferences* smtpPrefs = CImIAPPreferences::NewLC();
       
   108 	
       
   109 	CImSmtpSettings* smtpSettings = new(ELeave) CImSmtpSettings();
       
   110 	CleanupStack::PushL(smtpSettings);
       
   111 	
       
   112 	CImIAPPreferences* popPrefs = CImIAPPreferences::NewLC();
       
   113 	
       
   114 	CImPop3Settings* popSettings = new(ELeave) CImPop3Settings();
       
   115 	CleanupStack::PushL(popSettings);
       
   116 	
       
   117 	emailAccounts->PopulateDefaultPopSettingsL(*popSettings, *popPrefs);
       
   118 	emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *smtpPrefs);
       
   119 	
       
   120 	StoreParameterL<CImPop3Settings>(TestCase(), *popSettings, ActionParameters().Parameter(0));
       
   121 	CleanupStack::Pop(popSettings);
       
   122 	
       
   123 	StoreParameterL<CImIAPPreferences>(TestCase(), *popPrefs, ActionParameters().Parameter(1));
       
   124 	CleanupStack::Pop(popPrefs);
       
   125 	
       
   126 	StoreParameterL<CImSmtpSettings>(TestCase(), *smtpSettings, ActionParameters().Parameter(2));
       
   127 	CleanupStack::Pop(smtpSettings);
       
   128 	
       
   129 	StoreParameterL<CImIAPPreferences>(TestCase(), *smtpPrefs, ActionParameters().Parameter(3));
       
   130 	CleanupStack::Pop(smtpPrefs);
       
   131 	
       
   132 	CleanupStack::PopAndDestroy(emailAccounts);
       
   133 
       
   134 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionPopulateDefaultPopSettings);
       
   135 	TestCase().ActionCompletedL(*this);
       
   136 	}
       
   137 
       
   138