email/email/pop/src/t_cpop3clientmtm.cpp
author Maciej Seroka <maciejs@symbian.org>
Fri, 05 Mar 2010 11:15:10 +0000
branchSymbian3
changeset 18 147b85a37c23
permissions -rw-r--r--
Fixed Email Smoke Test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     7
//
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    10
//
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    11
// Contributors:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    12
//
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    13
// Description:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    14
// [TestStep Name]
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    15
// UnitTestCPop3ClientMtm
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    16
// [Paramaters]
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    17
// [TestStep Description]
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    18
// Invokes the API of the class CPop3ClientMtm for improving code coverage.
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    19
// 
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    20
//
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    21
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    22
#include "t_cpop3clientmtm.h"
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    23
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    24
#include <t_utilsreademailsettingsfromconfigfile.h>
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    25
#include <t_utilscentralrepository.h>
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    26
//#include <imapset.h>
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    27
#include <iapprefs.h>
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    28
#include <popcmtm.h>
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    29
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    30
/* Literals Used */
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    31
_LIT(KAccountName,"ImapAccountName");
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    32
_LIT8(KConfigFileName, "ImapConfigFileName");
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    33
_LIT(KDataComponentFilename, "c:\\system\\mtm\\testsmtm.dat");
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    34
_LIT(KDummyRealAddress,"test001@msexchange01.closedtest.intra");
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    35
_LIT(KDummyAlliasAddress,"subbutest");
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    36
const TInt KTempId = 10;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    37
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    38
const TUid KUidTestServerMtmType={0x10001304};
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    39
/**
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    40
	Function : CT_CPop3ClientMtm
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    41
	Description : Constructor
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    42
	@param : aSharedDataIMAP		Reference to CT_MsgSharedDataImap
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    43
	@return : N/A
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    44
*/
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    45
CT_CPop3ClientMtm::CT_CPop3ClientMtm(CT_MsgSharedDataPop& aSharedDataPOP)
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    46
:	CT_MsgSyncStepPOP(aSharedDataPOP)
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    47
	{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    48
	SetTestStepName(KUnitTestCPop3ClientMtm);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    49
	}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    50
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    51
/**
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    52
	Function : ~CT_CPop3ClientMtm
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    53
	Description : Destructor
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    54
	@return : N/A
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    55
*/
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    56
CT_CPop3ClientMtm::~CT_CPop3ClientMtm()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    57
	{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    58
	}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    59
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    60
void CT_CPop3ClientMtm::TestValidateMessageL()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    61
	{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    62
	TInt error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    63
	INFO_PRINTF1(_L("Testing: Validate Message -- started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    64
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    65
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    66
	TEST(error == KErrNone);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    67
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    68
	CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    69
	TEST(theClientRegistry != NULL);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    70
	TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    71
	CleanupStack::PushL(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    72
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    73
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    74
	CleanupStack::PushL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    75
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    76
	CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    77
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    78
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    79
	CleanupStack::PushL(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    80
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    81
	cEntry->SetEntryL(KMsvRootIndexEntryId);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    82
	TMsvEntry service;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    83
	service.iType=KUidMsvServiceEntry;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    84
	service.iMtm = KUidTestServerMtmType;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    85
	cEntry->CreateL(service);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    86
	cEntry->SetEntryL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    87
	selection->AppendL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    88
	CleanupStack::PopAndDestroy(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    89
	CleanupStack::Pop(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    90
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    91
	theClientMtm->SetCurrentEntryL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    92
	theClientMtm->SaveMessageL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    93
	INFO_PRINTF1(_L("Testing ValidateMessage with KMsvMessagePartRecipient"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    94
	theClientMtm->ValidateMessage(KMsvMessagePartRecipient);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    95
	INFO_PRINTF1(_L("Testing ValidateMessage with KMsvMessagePartOriginator"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    96
	theClientMtm->ValidateMessage(KMsvMessagePartOriginator);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    97
	CleanupStack::Pop(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    98
	delete iSession;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    99
	INFO_PRINTF1(_L("Testing: Validate Message -- ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   100
	}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   101
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   102
void CT_CPop3ClientMtm::TestKErrNotSupportedAPI()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   103
{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   104
	TInt error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   105
	INFO_PRINTF1(_L("Testing: Validate Message -- started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   106
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   107
	CMsvOperationWait *active = CMsvOperationWait::NewLC();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   108
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   109
	TEST(error == KErrNone);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   110
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   111
	CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   112
	TEST(theClientRegistry != NULL);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   113
	TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   114
	CleanupStack::PushL(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   115
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   116
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   117
	CleanupStack::PushL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   118
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   119
	CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   120
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   121
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   122
	CleanupStack::PushL(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   123
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   124
	cEntry->SetEntryL(KMsvRootIndexEntryId);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   125
	TMsvEntry service;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   126
	service.iType=KUidMsvServiceEntry;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   127
	service.iMtm = KUidTestServerMtmType;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   128
	cEntry->CreateL(service);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   129
	cEntry->SetEntryL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   130
	selection->AppendL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   131
	CleanupStack::PopAndDestroy(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   132
	CleanupStack::Pop(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   133
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   134
	theClientMtm->SetCurrentEntryL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   135
	theClientMtm->SaveMessageL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   136
	INFO_PRINTF1(_L("Testing: API - AddAttachmentL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   137
	TRAP(error, theClientMtm->AddAttachmentL(KAccountName,KConfigFileName, KTempId, active->iStatus));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   138
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   139
	INFO_PRINTF1(_L("Testing: API - AddAttachmentL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   140
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   141
	INFO_PRINTF1(_L("Testing: API - AddAttachmentL with FileSession : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   142
	RFile *tempFile = NULL;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   143
	TRAP(error, theClientMtm->AddAttachmentL(*tempFile,KConfigFileName, KTempId, active->iStatus));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   144
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   145
	INFO_PRINTF1(_L("Testing: API - AddAttachmentL with FileSession : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   146
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   147
	INFO_PRINTF1(_L("Testing: API - AddLinkedAttachmentL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   148
	TRAP(error, theClientMtm->AddLinkedAttachmentL(KAccountName,KConfigFileName, KTempId, active->iStatus));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   149
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   150
	INFO_PRINTF1(_L("Testing: API - AddLinkedAttachmentL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   151
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   152
	INFO_PRINTF1(_L("Testing: API - AddEntryAsAttachmentL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   153
	TRAP(error, theClientMtm->AddEntryAsAttachmentL(KTempId, active->iStatus));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   154
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   155
	INFO_PRINTF1(_L("Testing: API - AddEntryAsAttachmentL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   156
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   157
	INFO_PRINTF1(_L("Testing: API - CreateAttachmentL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   158
	TRAP(error, theClientMtm->CreateAttachmentL(KAccountName, *tempFile, KConfigFileName, KTempId, active->iStatus));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   159
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   160
	INFO_PRINTF1(_L("Testing: API - CreateAttachmentL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   161
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   162
	INFO_PRINTF1(_L("Testing: API - CreateMessageL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   163
	TRAP(error, theClientMtm->CreateMessageL(KTempId));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   164
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   165
	INFO_PRINTF1(_L("Testing: API - CreateMessageL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   166
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   167
	INFO_PRINTF1(_L("Testing: API - DefaultServiceL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   168
	TRAP(error, theClientMtm->DefaultServiceL());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   169
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   170
	INFO_PRINTF1(_L("Testing: API - DefaultServiceL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   171
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   172
	INFO_PRINTF1(_L("Testing: API - RemoveDefaultServiceL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   173
	TRAP(error, theClientMtm->RemoveDefaultServiceL());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   174
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   175
	INFO_PRINTF1(_L("Testing: API - RemoveDefaultServiceL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   176
	error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   177
	INFO_PRINTF1(_L("Testing: API - ChangeDefaultServiceL : started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   178
	TRAP(error, theClientMtm->ChangeDefaultServiceL(KTempId));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   179
	TEST(error == KErrNotSupported);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   180
	INFO_PRINTF1(_L("Testing: API - ChangeDefaultServiceL : ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   181
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   182
	CleanupStack::Pop(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   183
	CleanupStack::PopAndDestroy(active);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   184
	delete iSession;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   185
}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   186
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   187
void CT_CPop3ClientMtm::TestReplyL()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   188
	{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   189
	TInt error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   190
	INFO_PRINTF1(_L("Testing: ReplyL -- started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   191
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   192
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   193
	TEST(error == KErrNone);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   194
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   195
	CMsvOperationWait* active = CMsvOperationWait::NewLC();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   196
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   197
	CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   198
	TEST(theClientRegistry != NULL);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   199
	TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   200
	CleanupStack::PushL(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   201
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   202
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   203
	CleanupStack::PushL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   204
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   205
	CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   206
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   207
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   208
	CleanupStack::PushL(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   209
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   210
	cEntry->SetEntryL(KMsvRootIndexEntryId);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   211
	TMsvEntry service;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   212
	service.iType=KUidMsvServiceEntry;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   213
	service.iMtm = KUidTestServerMtmType;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   214
	cEntry->CreateL(service);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   215
	cEntry->SetEntryL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   216
	selection->AppendL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   217
	CleanupStack::PopAndDestroy(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   218
	CleanupStack::Pop(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   219
	TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   220
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   221
	theClientMtm->SetCurrentEntryL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   222
	CMsvOperation* operation = NULL;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   223
	active->Start();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   224
	operation = theClientMtm->ReplyL(KMsvDraftEntryId, partList, active->iStatus);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   225
	CActiveScheduler::Start();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   226
	TEST(operation->iStatus.Int()==KErrNone);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   227
	delete operation;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   228
	CleanupStack::Pop(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   229
	CleanupStack::Pop(active);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   230
	delete iSession;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   231
	INFO_PRINTF1(_L("Testing: ReplyL -- ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   232
	}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   233
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   234
void CT_CPop3ClientMtm::TestAddAddresseeL()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   235
{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   236
	TInt error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   237
	INFO_PRINTF1(_L("Testing: TestAddAddresseeL -- started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   238
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   239
	CMsvOperationWait *active = CMsvOperationWait::NewLC();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   240
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   241
	TEST(error == KErrNone);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   242
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   243
	CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   244
	TEST(theClientRegistry != NULL);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   245
	TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   246
	CleanupStack::PushL(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   247
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   248
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   249
	CleanupStack::PushL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   250
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   251
	CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   252
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   253
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   254
	CleanupStack::PushL(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   255
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   256
	cEntry->SetEntryL(KMsvRootIndexEntryId);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   257
	TMsvEntry service;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   258
	service.iType=KUidMsvServiceEntry;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   259
	service.iMtm = KUidTestServerMtmType;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   260
	cEntry->CreateL(service);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   261
	cEntry->SetEntryL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   262
	selection->AppendL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   263
	CleanupStack::PopAndDestroy(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   264
	CleanupStack::Pop(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   265
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   266
	theClientMtm->SetCurrentEntryL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   267
	theClientMtm->SaveMessageL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   268
	INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL with realaddress"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   269
	theClientMtm->AddAddresseeL(KDummyRealAddress);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   270
	INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL with realaddress"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   271
	theClientMtm->AddAddresseeL(KDummyRealAddress, KDummyAlliasAddress);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   272
	INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL -- ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   273
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   274
	CleanupStack::Pop(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   275
	CleanupStack::PopAndDestroy(active);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   276
	delete iSession;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   277
}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   278
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   279
void CT_CPop3ClientMtm::TestRemoveAddresseeL()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   280
{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   281
	TInt error = KErrGeneral;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   282
	INFO_PRINTF1(_L("Testing: TestAddAddresseeL -- started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   283
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   284
	CMsvOperationWait *active = CMsvOperationWait::NewLC();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   285
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   286
	TEST(error == KErrNone);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   287
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   288
	CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   289
	TEST(theClientRegistry != NULL);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   290
	TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   291
	CleanupStack::PushL(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   292
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   293
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   294
	CleanupStack::PushL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   295
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   296
	CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   297
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   298
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   299
	CleanupStack::PushL(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   300
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   301
	cEntry->SetEntryL(KMsvRootIndexEntryId);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   302
	TMsvEntry service;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   303
	service.iType=KUidMsvServiceEntry;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   304
	service.iMtm = KUidTestServerMtmType;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   305
	cEntry->CreateL(service);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   306
	cEntry->SetEntryL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   307
	selection->AppendL(service.Id());
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   308
	CleanupStack::PopAndDestroy(selection);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   309
	CleanupStack::Pop(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   310
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   311
	theClientMtm->SetCurrentEntryL(cEntry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   312
	theClientMtm->SaveMessageL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   313
	theClientMtm->AddAddresseeL(KDummyRealAddress);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   314
	INFO_PRINTF1(_L("Testing: API - RemoveAddressee with realaddress"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   315
	TInt firstAddress = 0;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   316
	theClientMtm->RemoveAddressee(firstAddress);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   317
	INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL -- ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   318
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   319
	CleanupStack::Pop(theClientRegistry);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   320
	CleanupStack::PopAndDestroy(active);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   321
	delete iSession;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   322
}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   323
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   324
void CT_CPop3ClientMtm::HandleSessionEventL(TMsvSessionEvent aEvent, TAny*, TAny*, TAny*)
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   325
	{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   326
	INFO_PRINTF1(_L("Entered Handlesession EventL"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   327
	switch(aEvent)
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   328
		{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   329
			case EMsvEntriesCreated:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   330
			INFO_PRINTF1(_L("Entries created"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   331
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   332
			case EMsvEntriesChanged:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   333
			INFO_PRINTF1(_L("Entries Changed"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   334
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   335
			case EMsvEntriesDeleted:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   336
			INFO_PRINTF1(_L("Entried Deleted"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   337
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   338
			case EMsvEntriesMoved:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   339
			INFO_PRINTF1(_L("Entried Moved"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   340
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   341
			case EMsvMtmGroupInstalled:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   342
			INFO_PRINTF1(_L("Mtm Group Installed"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   343
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   344
			case EMsvMtmGroupDeInstalled:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   345
			INFO_PRINTF1(_L("Mtm Group De-installed"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   346
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   347
			case EMsvGeneralError:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   348
			INFO_PRINTF1(_L("General Error occured"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   349
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   350
			case EMsvCloseSession:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   351
			INFO_PRINTF1(_L("Session Closed"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   352
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   353
			case EMsvServerReady:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   354
			INFO_PRINTF1(_L("Server Ready"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   355
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   356
			case EMsvServerFailedToStart:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   357
			INFO_PRINTF1(_L("Failed to start"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   358
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   359
			case EMsvCorruptedIndexRebuilt:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   360
			INFO_PRINTF1(_L("Corrupted Intex rebuilt"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   361
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   362
			case EMsvServerTerminated:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   363
			INFO_PRINTF1(_L("Server terminated"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   364
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   365
			case EMsvMediaChanged:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   366
			INFO_PRINTF1(_L("Media Changed"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   367
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   368
			EMsvMediaUnavailable:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   369
			INFO_PRINTF1(_L("Media Unavailable"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   370
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   371
			case EMsvMediaAvailable:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   372
			INFO_PRINTF1(_L("Media Available"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   373
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   374
			case EMsvMediaIncorrect:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   375
			INFO_PRINTF1(_L("Media Incorrect"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   376
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   377
			case EMsvCorruptedIndexRebuilding:
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   378
			INFO_PRINTF1(_L("Corrupted Index Rebuilding"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   379
			break;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   380
		}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   381
	INFO_PRINTF1(_L("Exited Handlesession EventL"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   382
	}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   383
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   384
/*TMsvId CT_CPop3ClientMtm::CreateMessageL()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   385
	{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   386
	// Handle command line arguments
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   387
	//CCommandLineArguments* cmdLineArg=CCommandLineArguments::NewLC();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   388
	//TInt count = cmdLineArg->Count();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   389
	//TBool isCmdLine=FALSE;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   390
	//if (count>2)	// Command line arguments?
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   391
//		{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   392
//		if ((!(cmdLineArg->Arg(EArgTestParams).Compare(KTestParams))) && count==EArgEnd)
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   393
//			isCmdLine=TRUE;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   394
//		}	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   395
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   396
//	testUtils->TestStart(testNo++);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   397
//	CTestActive* testActive = new (ELeave) CTestActive();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   398
//	CleanupStack::PushL(testActive);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   399
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   400
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   401
	TEST(error == KErrNone);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   402
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   403
	TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   404
	TMsvEmailTypeList msvEmailTypeList = 0;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   405
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   406
	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   407
	CMsvOperationWait* active = CMsvOperationWait::NewLC();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   408
	active->Start();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   409
	CImEmailOperation* emailOperation = CImEmailOperation::CreateNewL(active->iStatus, *iSession, KMsvGlobalOutBoxIndexEntryId, partList, msvEmailTypeList, KUidMsgTypeSMTP);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   410
	CleanupStack::PushL(emailOperation);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   411
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   412
//	TestUiTimer* testUiTimer = TestUiTimer::NewLC(test.Console(), emailOperation);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   413
//	testActive->StartL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   414
//	testUiTimer->IssueRequest();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   415
	CActiveScheduler::Start();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   416
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   417
	TMsvId temp;	
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   418
	TPckgC<TMsvId> paramPack(temp);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   419
	const TDesC8& progBuf = emailOperation->ProgressL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   420
	paramPack.Set(progBuf);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   421
	TMsvId messageId=paramPack();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   422
	TInt error = emailOperation->iStatus.Int();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   423
	CleanupStack::PopAndDestroy(emailOperation);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   424
	CleanupStack::PopAndDestroy(active);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   425
	//CleanupStack::PopAndDestroy(3, testActive); // testActive, emailOperation, testUiTimer
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   426
	//testUtils->TestFinish(testNo-1, error);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   427
	//log->AppendComment(_L8(" Messages created in the outbox"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   428
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   429
	// fill in details for email message
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   430
	testUtils->iMsvEntry->SetEntryL(messageId);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   431
	CMsvStore* store = testUtils->iMsvEntry->EditStoreL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   432
	CleanupStack::PushL(store);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   433
	CImHeader* header = CImHeader::NewLC();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   434
	header->RestoreL(*store);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   435
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   436
	if (isCmdLine)
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   437
		{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   438
		TBuf<100> buf;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   439
		TLex lex(cmdLineArg->Arg(EArgEmail));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   440
		buf=lex.NextToken();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   441
		header->ToRecipients().AppendL(buf);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   442
		}
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   443
	else
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   444
		header->ToRecipients().AppendL(_L("t_smtc@lon-msgtest06.intra"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   445
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   446
	header->SetSubjectL(_L("Message from T_SMTC Typhoon!!"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   447
	header->StoreL(*store);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   448
	store->CommitL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   449
 	CleanupStack::PopAndDestroy(3, cmdLineArg); // cmdLineArg, header, store
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   450
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   451
	//store some body text!!
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   452
	CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   453
	CleanupStack::PushL(paraFormatLayer);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   454
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   455
	CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); 
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   456
	CleanupStack::PushL(charFormatLayer);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   457
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   458
	CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   459
	CleanupStack::PushL(bodyText);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   460
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   461
	TBuf<100> bodyContents = _L("Test body contents so that we can test the store body text code.");
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   462
	bodyText->InsertL(0, bodyContents);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   463
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   464
	// store the body text
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   465
	testActive = new (ELeave) CTestActive();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   466
	CleanupStack::PushL(testActive);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   467
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   468
	CImEmailMessage* imEmailMessage = CImEmailMessage::NewLC(*(testUtils->iMsvEntry));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   469
	imEmailMessage->StoreBodyTextL(messageId, *bodyText, testActive->iStatus);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   470
	testActive->StartL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   471
	CActiveScheduler::Start();	// wait for the asynch operation to complete
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   472
	CleanupStack::PopAndDestroy(5, paraFormatLayer); // imEmailMessage, testActive, bodyText, charFormatLayer, paraFormatLayer
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   473
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   474
	// Add an attachment
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   475
	testActive = new (ELeave) CTestActive();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   476
	CleanupStack::PushL(testActive);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   477
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   478
	imEmailMessage = CImEmailMessage::NewLC(*(testUtils->iMsvEntry));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   479
	CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   480
	CleanupStack::PushL(attachmentInfo);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   481
	imEmailMessage->AttachmentManager().AddAttachmentL(KAttachment1,attachmentInfo,testActive->iStatus);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   482
	CleanupStack::Pop(attachmentInfo);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   483
	testActive->StartL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   484
	CActiveScheduler::Start();	// wait for the asynch operation to complete
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   485
	CleanupStack::PopAndDestroy(2, testActive);
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   486
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   487
	return messageId;
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   488
	}*/
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   489
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   490
/**
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   491
	Function : doTestStepL
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   492
	Description : 
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   493
	@return : TVerdict - Test step result
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   494
	@leave : KMsvNullIndexEntryId	Invalid IMAP account name specified
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   495
*/
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   496
TVerdict CT_CPop3ClientMtm::doTestStepL()
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   497
	{
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   498
	INFO_PRINTF1(_L("Test Step : CPop3ClientMtm Started"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   499
	TestValidateMessageL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   500
	//TestReplyL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   501
	TestKErrNotSupportedAPI();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   502
	TestAddAddresseeL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   503
	TestRemoveAddresseeL();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   504
	INFO_PRINTF1(_L("Test Step : CPop3ClientMtm Ended"));
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   505
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   506
	return TestStepResult();
147b85a37c23 Fixed Email Smoke Test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   507
	}