common/tools/ats/smoketest/email/email/pop/src/T_VerifyPopAccountsCount.cpp
changeset 719 d5603c08781b
child 872 17498133d9ad
equal deleted inserted replaced
718:b18be44be852 719:d5603c08781b
       
     1 // Copyright (c) 2006-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 // VerifyPopAccountsCount
       
    16 // [Paramaters]
       
    17 // ExpectedCount		<input>	: Expected Number of the POP Accouts present
       
    18 // [Test Step Description]
       
    19 // If number of POP accounts present equals with the expected number of accounts then test step result is pass.
       
    20 // [APIs Used]
       
    21 // CEmailAccounts::GetPopAccountsL
       
    22 // 
       
    23 //
       
    24 
       
    25 
       
    26 
       
    27 /**
       
    28  @file
       
    29 */
       
    30 
       
    31 
       
    32 // User include
       
    33 #include "T_VerifyPopAccountsCount.h"
       
    34 
       
    35 
       
    36 // epoc inlcudes
       
    37 #include<cemailaccounts.h>
       
    38 
       
    39 
       
    40 // Literals used
       
    41 _LIT(KExpectedCount,"ExpectedCount");
       
    42 
       
    43 
       
    44 /**
       
    45 CT_MsgVerifyPopAccountsCount()
       
    46 Sets the teststep name to KCheckChildrenCountPop
       
    47 
       
    48 @param aSharedDataPOP
       
    49 Data shared across the POP test steps. Ex. Sessoin
       
    50 */
       
    51 CT_MsgVerifyPopAccountsCount::CT_MsgVerifyPopAccountsCount(CT_MsgSharedDataPop& aSharedDataPOP)
       
    52 :	CT_MsgSyncStepPOP(aSharedDataPOP) 
       
    53 	{
       
    54 	SetTestStepName(KVerifyPopAccountsCount);
       
    55 	}
       
    56 
       
    57 
       
    58 /**
       
    59 ~CT_MsgVerifyPopAccountsCount()
       
    60 Destructor
       
    61 */
       
    62 CT_MsgVerifyPopAccountsCount::~CT_MsgVerifyPopAccountsCount()
       
    63 	{
       
    64 	}
       
    65 
       
    66 
       
    67 /**
       
    68 doTestStepL()
       
    69 Reads the expected count from the ini file.
       
    70 Obtains the count of the POP accounts created and compares against the expected number.
       
    71 
       
    72 @return
       
    73 Returns the test step result.
       
    74 */
       
    75 TVerdict CT_MsgVerifyPopAccountsCount::doTestStepL()
       
    76 	{
       
    77 	INFO_PRINTF1(_L("Test Step: Verify Pop Accounts Count"));
       
    78 	TInt expectedCount = -1;
       
    79 	if(!GetIntFromConfig(ConfigSection(), KExpectedCount, expectedCount) && expectedCount < 0)
       
    80 		{
       
    81 		ERR_PRINTF1(_L("ExpectedCount is not Specified or < 0"));
       
    82 		SetTestStepResult(EFail);
       
    83 		}
       
    84 	else
       
    85 		{
       
    86 		CEmailAccounts *account = CEmailAccounts::NewLC();	
       
    87 		RArray<TPopAccount> arrayPopAccounts;
       
    88 		account->GetPopAccountsL(arrayPopAccounts);
       
    89 		TInt count = arrayPopAccounts.Count();
       
    90 		
       
    91 		CleanupStack::PopAndDestroy(account);
       
    92 		arrayPopAccounts.Reset();
       
    93 		
       
    94 		if (count != expectedCount)
       
    95 			{
       
    96 			ERR_PRINTF3(_L("Number of POP accounts do not match ! expected = %d actual = %d"), 
       
    97 									  expectedCount, count);
       
    98 			SetTestStepResult(EFail);
       
    99 			}
       
   100 		else
       
   101 			{
       
   102 			INFO_PRINTF2(_L("Number of POP accounts matched value = %d !"), expectedCount);	
       
   103 			}			
       
   104 		}
       
   105 	return TestStepResult();
       
   106 	}