messagingfw/msgtestfw/Framework/src/CMtfTestActionWait.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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include "CMtfTestActionWait.h"
       
    21 #include "CMtfTestCase.h"
       
    22 #include "CMtfTestActionParameters.h"
       
    23 
       
    24 /** Creates a new wait action. If there are no action ids then WaitForAll is created.
       
    25 Otherwise, the wait function will wait for the specified action ids to complete. 
       
    26 This function takes ownership of action ids at the END of the function. */
       
    27 CMtfTestActionWait* CMtfTestActionWait::NewL(CMtfTestCase& aTestCase, CMtfTestActionParameters* aActionIds)  
       
    28 {
       
    29 	TBool waitForAll(aActionIds->Count()==0);
       
    30 
       
    31 	CMtfTestActionWait* self = new (ELeave) CMtfTestActionWait(aTestCase,waitForAll);
       
    32 	CleanupStack::PushL(self);
       
    33 	self->ConstructL(aActionIds);
       
    34 	CleanupStack::Pop(self);
       
    35 	return self;
       
    36 }
       
    37 
       
    38 /** Creates a WaitForAll wait action. */
       
    39 CMtfTestActionWait* CMtfTestActionWait::NewL(CMtfTestCase& aTestCase)
       
    40 {
       
    41 	CMtfTestActionWait* self = new (ELeave) CMtfTestActionWait(aTestCase,ETrue);
       
    42 	CleanupStack::PushL(self);
       
    43 	
       
    44 	// dummy parameters are used
       
    45 	self->ConstructL(CMtfTestActionParameters::NewLC());
       
    46 	
       
    47 	CleanupStack::Pop(2,self);
       
    48 	return self;
       
    49 }
       
    50 
       
    51 CMtfTestActionWait::CMtfTestActionWait(CMtfTestCase& aTestCase, const TBool& aWaitForAll)
       
    52 : CMtfTestAction(aTestCase), iWaitForAll(aWaitForAll)
       
    53 {
       
    54 }
       
    55 		
       
    56 CMtfTestActionWait::~CMtfTestActionWait() 
       
    57 {
       
    58 }
       
    59 
       
    60 void CMtfTestActionWait::RunL()
       
    61 {
       
    62 }
       
    63 
       
    64 void CMtfTestActionWait::DoCancel()
       
    65 {
       
    66 }
       
    67 
       
    68 TBool CMtfTestActionWait::WaitAction() const
       
    69 {
       
    70 	return ETrue;
       
    71 }
       
    72 
       
    73 void CMtfTestActionWait::ExecuteActionL()
       
    74 {
       
    75 	if (iWaitForAll)
       
    76 	{
       
    77 		TestCase().WaitForAllActionsL();
       
    78 	}
       
    79 	else
       
    80 	{
       
    81 		TInt numberOfParameters = ActionParameters().Count();
       
    82 		
       
    83 		for (TInt count=0; count<numberOfParameters; count++)
       
    84 		{
       
    85 			TestCase().WaitForActionL(ActionParameters().Parameter(count));
       
    86 		}
       
    87 	}
       
    88 }