/** Function : ExecuteActionL Description : Entry point for the this test action in the test framework @internalTechnology @param : none @return : void @pre none @post none */ void CMtfTestActionCountImapAccountsInArray::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCountImapAccountsInArray); TInt numberToMatch = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0)); CEmailAccounts *account = CEmailAccounts::NewLC(); RArray<TImapAccount> arrayImapAccounts; account->GetImapAccountsL(arrayImapAccounts); TInt count = arrayImapAccounts.Count(); CleanupStack::PopAndDestroy(account); arrayImapAccounts.Reset(); if (count != numberToMatch) { // failed TestCase().ERR_PRINTF3(_L("Number of IMAP accounts do not match ! expected = %d actual = %d"), numberToMatch, count ); TestCase().SetTestStepResult(EFail); } TestCase().INFO_PRINTF2(_L("Number of IMAP accounts matched value = %d !"), numberToMatch ); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCountImapAccountsInArray); TestCase().ActionCompletedL(*this); }
void CPerformance426Client::ConstructL() { //open the imap account that the test step has created CEmailAccounts* emailAccounts; emailAccounts = CEmailAccounts::NewLC(); RArray<TImapAccount> imapAccounts; CleanupClosePushL(imapAccounts); emailAccounts->GetImapAccountsL(imapAccounts); iImapAccount=imapAccounts[0]; //open the smtp account too RArray<TSmtpAccount> smtpAccounts; CleanupClosePushL(smtpAccounts); emailAccounts->GetSmtpAccountsL(smtpAccounts); iSmtpAccount=smtpAccounts[0]; CleanupStack::PopAndDestroy(3,emailAccounts); // Session observer. Needed to create a session iSessionObserver = new (ELeave) TDummySessionObserver; // Session. Needed to create a client registry. iSession=CMsvSession::OpenSyncL(*iSessionObserver); // Client registry. Needed to get the MTM component iClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32); //get the client mtm iClientMtm=iClientRegistry->NewMtmL(KUidMsgTypeIMAP4); // Load the serial comms device drivers. If this is not done, // connecting via NT-RAS returns KErrNotFound (-1). TInt driverErr; driverErr=User::LoadPhysicalDevice(PDD_NAME); if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists) { User::Leave(driverErr); } driverErr=User::LoadLogicalDevice(LDD_NAME); if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists) { User::Leave(driverErr); } //initialise package object TImImap4GetMailInfo imap4GetMailInfo; imap4GetMailInfo.iMaxEmailSize = KMaxTInt; imap4GetMailInfo.iDestinationFolder = KMsvGlobalInBoxIndexEntryIdValue; imap4GetMailInfo.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments; iPackage=imap4GetMailInfo; }
void CMtfTestActionDeleteImapAccounts::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeleteImapAccounts); TInt paramDefaultIndex = ObtainValueParameterL<TInt>( TestCase(),ActionParameters().Parameter(0) ,-1 ); CEmailAccounts* account = CEmailAccounts::NewLC(); RArray<TImapAccount> arrayImap4Accounts; CleanupClosePushL(arrayImap4Accounts); account->GetImapAccountsL(arrayImap4Accounts); if ( paramDefaultIndex >= 0 ) { // Delete the specified id. account->DeleteImapAccountL(arrayImap4Accounts[paramDefaultIndex]); // Just ensure that if we try to delete it again we hopefuly get an error // or can see that it has been deleted. arrayImap4Accounts.Remove(paramDefaultIndex); } else if (paramDefaultIndex == -1 ) { // Assume delete all the indexs TInt count=arrayImap4Accounts.Count(); TestCase().INFO_PRINTF2(_L("CMtfTestActionDeletePopAccounts deleting all accounts count = %d"), count ); for(TInt i=0; i<count; i++) { TImapAccount id = arrayImap4Accounts[i]; account->DeleteImapAccountL(id); } } else { // Bad value. TestCase().ERR_PRINTF1(_L("DeleteImapAccounts : Index value must be -1 or greater than 0\n")); TestCase().SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(2, account); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeleteImapAccounts); TestCase().ActionCompletedL(*this); }