messagingfw/msgtestfw/Framework/src/CMtfTestAction.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include "CMtfTestAction.h"
       
    21 #include <e32std.h>
       
    22 #include "CMtfTestCase.h"
       
    23 #include "CMtfTestActionParameters.h"
       
    24 
       
    25 _LIT(KMtfTestActionPanic,"Messaging Test Action");
       
    26 
       
    27 void CMtfTestAction::Panic(TMtfTestActionPanic aPanic)
       
    28 {
       
    29 	User::Panic(KMtfTestActionPanic,aPanic);
       
    30 }
       
    31  		  		
       
    32 CMtfTestAction::CMtfTestAction(CMtfTestCase& aTestCase) 
       
    33 	: CActive(EPriorityStandard), iTestCase(aTestCase), iCurrentlyBeingWaitedFor(EFalse) 
       
    34 {
       
    35 	// don't take ownership of parameters
       
    36 }
       
    37 
       
    38 /** Ownership is taken at the END of the function.
       
    39 @param aActionParameters Action parameters, must not be NULL */
       
    40 void CMtfTestAction::ConstructL(CMtfTestActionParameters* aActionParameters)
       
    41 {
       
    42 	__ASSERT_ALWAYS(aActionParameters != NULL, CMtfTestAction::Panic(CMtfTestAction::EMtfNonReferenceParameter));
       
    43 	
       
    44 	iTestCase.QueueTestActionL(this);
       
    45 	// now you can take ownership, we must not leave after this point
       
    46 	iActionParams = aActionParameters;
       
    47 }
       
    48 		
       
    49 CMtfTestAction::~CMtfTestAction() 
       
    50 {
       
    51 	delete iActionParams;
       
    52 	delete iActionId;
       
    53 };
       
    54 	
       
    55 const CMtfTestActionParameters& CMtfTestAction::ActionParameters() const 
       
    56 {
       
    57 	// guaranteed not to be NULL
       
    58 	return *iActionParams;
       
    59 }
       
    60 
       
    61 const TDesC& CMtfTestAction::ActionIdL() const
       
    62 {
       
    63 	if (!iActionId)
       
    64 	{
       
    65 		User::Leave(KErrNotFound);
       
    66 	}
       
    67 	
       
    68 	return *iActionId;
       
    69 }
       
    70 
       
    71 void CMtfTestAction::SetActionIdL(const TDesC& aActionId)
       
    72 {
       
    73 	iActionId = aActionId.AllocL();
       
    74 }
       
    75 
       
    76 CMtfTestCase& CMtfTestAction::TestCase()
       
    77 {
       
    78 	return iTestCase;
       
    79 }
       
    80 
       
    81 TBool CMtfTestAction::WaitAction() const
       
    82 {
       
    83 	return EFalse;
       
    84 }
       
    85 
       
    86 TBool CMtfTestAction::SectionCompleteAction() const
       
    87 {
       
    88 	return EFalse;
       
    89 }
       
    90 
       
    91 TBool CMtfTestAction::CurrentlyBeingWaitedFor() const
       
    92 {
       
    93 	return iCurrentlyBeingWaitedFor;
       
    94 }
       
    95 
       
    96 void CMtfTestAction::SetCurrentlyBeingWaitedFor(const TBool& aWaitedFor)
       
    97 {
       
    98 	iCurrentlyBeingWaitedFor = aWaitedFor;
       
    99 }
       
   100 
       
   101 TInt CMtfTestAction::RunError(TInt aErr) 
       
   102 {
       
   103 	TestCase().INFO_PRINTF2(_L("RunError aErr = %d"), aErr);
       
   104     return aErr;
       
   105 }
       
   106