messagingfw/msgtestfw/TestActions/Mms/src/CMtfTestActionCreateMmsMtm.cpp
changeset 0 8e480a14352b
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 // CreateMmsMtm
       
    17 // [Action Parameters]
       
    18 // Session     <input>: Reference to the session.
       
    19 // ServiceId   <input>: Value of the the service id.
       
    20 // MtmRegistry <input>: Reference to the client MTM registry.
       
    21 // Mtm        <output>: Reference to the created MMS client MTM.
       
    22 // [Action Description]
       
    23 // Creates MMS client MTM.
       
    24 // [APIs Used]
       
    25 // CClientMtmRegistry::NewMtmL
       
    26 // CMsvSession::GetEntryL
       
    27 // CBaseMtm::SetCurrentEntryL
       
    28 // __ACTION_INFO_END__
       
    29 // 
       
    30 //
       
    31 
       
    32 /**
       
    33  @file
       
    34 */
       
    35 
       
    36 
       
    37 #include "CMtfTestActionCreateMmsMtm.h"
       
    38 #include "CMtfTestCase.h"
       
    39 #include "CMtfTestActionParameters.h"
       
    40 
       
    41 #include <msvapi.h>
       
    42 #include <mmsclientmtm.h>
       
    43 #include <mmsutils.h>
       
    44 #include <mtclreg.h>
       
    45 #include <mtclbase.h>
       
    46 
       
    47 
       
    48 CMtfTestAction* CMtfTestActionCreateMmsMtm::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    49 	{
       
    50 	CMtfTestActionCreateMmsMtm* self = new (ELeave) CMtfTestActionCreateMmsMtm(aTestCase);
       
    51 	CleanupStack::PushL(self);
       
    52 	self->ConstructL(aActionParameters);
       
    53 	CleanupStack::Pop();
       
    54 	return self;
       
    55 	}
       
    56 	
       
    57 
       
    58 CMtfTestActionCreateMmsMtm::CMtfTestActionCreateMmsMtm(CMtfTestCase& aTestCase)
       
    59 	: CMtfSynchronousTestAction(aTestCase)
       
    60 	{
       
    61 	}
       
    62 
       
    63 
       
    64 CMtfTestActionCreateMmsMtm::~CMtfTestActionCreateMmsMtm()
       
    65 	{
       
    66 	}
       
    67 
       
    68 
       
    69 void CMtfTestActionCreateMmsMtm::ExecuteActionL()
       
    70 	{
       
    71 	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    72 	TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
       
    73 	CClientMtmRegistry* paramMtmRegistry = ObtainParameterReferenceL<CClientMtmRegistry>(TestCase(),ActionParameters().Parameter(2));;
       
    74 
       
    75 	CBaseMtm* paramMtm = paramMtmRegistry->NewMtmL(KUidMsgTypeMMS);
       
    76 	CleanupStack::PushL(paramMtm);
       
    77 	CMsvEntry* entry = paramSession->GetEntryL(paramServiceId);
       
    78 	CleanupStack::PushL(entry);
       
    79 	paramMtm->SetCurrentEntryL(entry);
       
    80 
       
    81 	StoreParameterL<CMmsClientMtm>(TestCase(),*(reinterpret_cast<CMmsClientMtm*>(paramMtm)),ActionParameters().Parameter(3));
       
    82 	CleanupStack::Pop(entry);
       
    83 	CleanupStack::Pop(paramMtm);
       
    84 	
       
    85 	TestCase().ActionCompletedL(*this);
       
    86 	}
       
    87