common/tools/ats/smoketest/email/email/pop/src/T_CheckPopBMSetting.cpp
changeset 719 d5603c08781b
child 872 17498133d9ad
equal deleted inserted replaced
718:b18be44be852 719:d5603c08781b
       
     1 // Copyright (c) 2007-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // [TestStep Name]
       
    15 // CheckPopBMSetting
       
    16 // [Paramaters]
       
    17 // PopAccountName			:Name of the Pop account.
       
    18 // ExpectedBMSupport		:ETrue => Bearer mobility is expected to be supported by the POP service.
       
    19 // EFalse => Bearer mobility is not expected to be supported by the POP service.
       
    20 // Checks if bearer mobility is supported by the POP service.
       
    21 // 
       
    22 //
       
    23 
       
    24 //User includes
       
    25 #include "T_CheckPopBMSetting.h"
       
    26 #include <t_utils.h>
       
    27 #include <t_utilsenumconverter.h>
       
    28 #include <t_utilscentralrepository.h>
       
    29 
       
    30 //Epoc include
       
    31 #include <iapprefs.h>
       
    32 
       
    33 //Literals used
       
    34 _LIT(KPopAccountName,"PopAccountName");
       
    35 _LIT(KExpectedBMSupport,"ExpectedBMSupport");
       
    36 
       
    37 /**
       
    38   Function : CT_MsgCheckPopBMSetting
       
    39   Description : Constructor 
       
    40   @param : aSharedDataPOP Reference to CT_MsgSharedDataPop
       
    41   @return : N/A
       
    42 */
       
    43 CT_MsgCheckPopBMSetting::CT_MsgCheckPopBMSetting(CT_MsgSharedDataPop& aSharedDataPOP)
       
    44 :CT_MsgSyncStepPOP(aSharedDataPOP)
       
    45 	{
       
    46 	SetTestStepName(KCheckPopBMSetting);
       
    47 	}
       
    48 	
       
    49 /**
       
    50   Function : ReadIni
       
    51   Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
       
    52   @return : TBool
       
    53 */
       
    54 TBool CT_MsgCheckPopBMSetting::ReadIni()
       
    55 	{
       
    56 	TBool result = ETrue;
       
    57 	
       
    58 	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, iPopAccountName))
       
    59 		{
       
    60 		ERR_PRINTF1(_L("Pop account name is not specified"));
       
    61 		SetTestStepResult(EFail);
       
    62 		result = EFalse;
       
    63 		}
       
    64 		
       
    65 	if(!GetBoolFromConfig(ConfigSection(), KExpectedBMSupport, iExpectedBMSupport))
       
    66 		{
       
    67 		ERR_PRINTF1(_L("An expected \"ETrue\" or \"EFalse\" boolean value is not specified for BM support"));
       
    68 		SetTestStepResult(EFail);
       
    69 		result = EFalse;
       
    70 		}
       
    71 	
       
    72 	return result;
       
    73 	}
       
    74 
       
    75 /**
       
    76   Function : doTestStepL
       
    77   Description : Checks the provisioned BM support for the POP account settings of a test case.
       
    78   @return : TVerdict - Test step result
       
    79 */		
       
    80 TVerdict CT_MsgCheckPopBMSetting::doTestStepL()
       
    81 	{
       
    82 	INFO_PRINTF1(_L("Test Step : CheckPopBMSetting"));
       
    83 	if(ReadIni())
       
    84 		{
       
    85 		CEmailAccounts* accounts = CEmailAccounts::NewL();
       
    86 		CleanupStack::PushL(accounts);
       
    87 		
       
    88 		CImPop3Settings* popSettings = new(ELeave) CImPop3Settings();
       
    89 		CleanupStack::PushL(popSettings);
       
    90 					
       
    91 		TPopAccount popAccountId;
       
    92 		CT_MsgUtilsCentralRepository::GetPopAccountL((TDes&)iPopAccountName, popAccountId);
       
    93 				
       
    94 		accounts->LoadPopSettingsL(popAccountId, *popSettings);
       
    95 		
       
    96 		TBool actualBMSupport = popSettings->BearerMobility();
       
    97 		
       
    98 		if (actualBMSupport == iExpectedBMSupport)
       
    99 			{
       
   100 			INFO_PRINTF3(_L("Actual Bearer Mobility Support [%d] does equals Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport);
       
   101 			}
       
   102 		else
       
   103 			{
       
   104 			ERR_PRINTF3(_L("Actual Bearer Mobility Support [%d] does not equal Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport);
       
   105 			SetTestStepResult(EFail);
       
   106 			}
       
   107 	
       
   108 		CleanupStack::PopAndDestroy(2,accounts); // popSettings, accounts
       
   109 		}
       
   110 	return TestStepResult();
       
   111 	}