messagingfw/msgtestfw/TestActions/Email/Pop3/src/CMtfTestActionConnectPop3Server.cpp
changeset 0 8e480a14352b
child 58 6c34d0baa0b1
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2003-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 // ConnectPop3Server
       
    17 // [Action Parameters]
       
    18 // ServiceId  <input>: Value of the POP3 service id.
       
    19 // Mtm        <input>: Reference to POP3 client MTM.
       
    20 // [Action Description]
       
    21 // Connects to the POP3 server.
       
    22 // [APIs Used]
       
    23 // CMsvEntry::SetEntryL
       
    24 // CMsvEntrySelection::AppendL
       
    25 // CPop3ClientMtm::InvokeAsyncFunctionL
       
    26 // __ACTION_INFO_END__
       
    27 // 
       
    28 //
       
    29 
       
    30 /**
       
    31  @file
       
    32 */
       
    33 
       
    34 
       
    35 #include <popcmtm.h>
       
    36 
       
    37 #include <cemailaccounts.h>
       
    38 
       
    39 #include "CMtfTestActionConnectPop3Server.h"
       
    40 #include "CMtfTestCase.h"
       
    41 #include "CMtfTestActionParameters.h"
       
    42 #include "MtfTestActionUtilsUser.h"
       
    43 
       
    44 CMtfTestAction* CMtfTestActionConnectPop3Server::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    45 	{
       
    46 	CMtfTestActionConnectPop3Server* self = new (ELeave) CMtfTestActionConnectPop3Server(aTestCase);
       
    47 	CleanupStack::PushL(self);
       
    48 	self->ConstructL(aActionParameters);
       
    49 	CleanupStack::Pop();
       
    50 	return self;
       
    51 	}
       
    52 	
       
    53 
       
    54 CMtfTestActionConnectPop3Server::CMtfTestActionConnectPop3Server(CMtfTestCase& aTestCase)
       
    55 	: CMtfTestAction(aTestCase)
       
    56 	{
       
    57 	}
       
    58 
       
    59 
       
    60 CMtfTestActionConnectPop3Server::~CMtfTestActionConnectPop3Server()
       
    61 	{
       
    62 	}
       
    63 
       
    64 
       
    65 void CMtfTestActionConnectPop3Server::ExecuteActionL()
       
    66 	{	
       
    67 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionConnectPop3Server);
       
    68 	TMsvId popServiceIdParam = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0)); 
       
    69 	CPop3ClientMtm* paramMtm  = ObtainParameterReferenceL<CPop3ClientMtm>(TestCase(),ActionParameters().Parameter(1));
       
    70 
       
    71 	CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
       
    72 	CleanupStack::PushL(selection);
       
    73 	selection->AppendL(popServiceIdParam);
       
    74 	TBuf8<1> param;
       
    75 	iOperation = paramMtm->InvokeAsyncFunctionL(KPOP3MTMConnect,*selection,param,iStatus);
       
    76 	CleanupStack::PopAndDestroy(selection);
       
    77 	CActiveScheduler::Add(this);
       
    78 	SetActive();
       
    79 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionConnectPop3Server);
       
    80 	}
       
    81 
       
    82 
       
    83 void CMtfTestActionConnectPop3Server::DoCancel()
       
    84 	{
       
    85 	iOperation->Cancel();
       
    86 	}
       
    87 
       
    88 
       
    89 void CMtfTestActionConnectPop3Server::RunL()
       
    90 	{
       
    91 	TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation,iStatus);
       
    92 
       
    93 	delete iOperation;
       
    94 
       
    95 	User::LeaveIfError(err);
       
    96 	TestCase().ActionCompletedL(*this);
       
    97 	}
       
    98