usbmgmt/usbmgrtest/t_charging_arm/inc/testbase.h
changeset 0 c9bc50fca66e
equal deleted inserted replaced
-1:000000000000 0:c9bc50fca66e
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __TESTBASE_H__
       
    19 #define __TESTBASE_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32keys.h>
       
    23 
       
    24 class MTestManager;
       
    25 
       
    26 #define LeaveIfErrorL(aError) \
       
    27 	{ \
       
    28 	if ( aError ) \
       
    29 		{ \
       
    30 		iManager.Write(_L8("LEAVE: line %d, code %d"), __LINE__, aError); \
       
    31 		User::Leave(aError); \
       
    32 		} \
       
    33 	} 
       
    34 
       
    35 class CTestBase : public CBase
       
    36 /**
       
    37  * Abstract base class for tests.
       
    38  */
       
    39 	{
       
    40 public:
       
    41 	CTestBase(MTestManager& aManager);
       
    42 	~CTestBase();
       
    43 
       
    44 public:
       
    45 	// Tests may implement either of these to pick up user selections. 
       
    46 	// Single-key entries require you to implement the TKeyCode overload; 
       
    47 	// multi-key selections require you to implement the descriptor overload.
       
    48 	virtual void ProcessKeyL(TKeyCode aKeyCode);
       
    49 	virtual void ProcessKeyL(const TDesC8& aString);
       
    50 
       
    51 	virtual void DisplayTestSpecificMenu() = 0;
       
    52 
       
    53 protected: // unowned
       
    54 	MTestManager& iManager;
       
    55 	};
       
    56 
       
    57 #endif // __TESTBASE_H__