telephonyprotocols/pdplayer/umts/test/mbufgobblerlayer/inc/mbufgobblertestflags.h
branchRCL_3
changeset 82 042fd2753b8f
equal deleted inserted replaced
74:9200f38b1324 82:042fd2753b8f
       
     1 // Copyright (c) 2010 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 // Test flags. Lightweight functions to provide basic coverage test
       
    15 //
       
    16 
       
    17 /**
       
    18  @file
       
    19  @internalComponent
       
    20 */
       
    21 
       
    22 #ifndef MBUFGOBBLERTESTFLAGS_H_
       
    23 #define MBUFGOBBLERTESTFLAGS_H_
       
    24 
       
    25 
       
    26 #include <e32property.h>
       
    27 
       
    28 #ifdef _DEBUG
       
    29 #define MBUFGOBBLER_TEST_POINT(flag,result) if(iTestFlags) {MbufGobblerTestFlags::SetResult(MbufGobblerTestFlags::flag,result);}
       
    30 #define MBUFGOBBLER_TEST_DATA TBool iTestFlags;
       
    31 #define MBUFGOBBLER_TEST_DATA_INIT iTestFlags = MbufGobblerTestFlags::TestFlagsActive();
       
    32 
       
    33 
       
    34 namespace MbufGobblerTestFlags
       
    35 {
       
    36 const TUid KPubSubUid = {0x00285DAC};
       
    37 
       
    38 enum
       
    39 	{
       
    40 	// set by test library, read by binder
       
    41 	KFlagsActive = 100,
       
    42 	
       
    43 	// set by binder, read by test library
       
    44 	KTierUp = 101,
       
    45 	
       
    46 	KMCPrUp = 111,
       
    47 	
       
    48 	KCPrUp = 121,
       
    49 	
       
    50 	KSCPrUp = 131,
       
    51 	
       
    52 	KBind = 141,
       
    53 	KBinderSend = 142,
       
    54 	KBinderReceive = 143,
       
    55 	};
       
    56 
       
    57 
       
    58 // used by client test library
       
    59 static TInt ActivateTestFlags()
       
    60 	{
       
    61 	return RProperty::Define(KPubSubUid, KFlagsActive, RProperty::EInt);
       
    62 	}
       
    63 
       
    64 // used by client test library
       
    65 static TInt GetResult(TInt aFlag)
       
    66 	{
       
    67 	TInt value=0;
       
    68 	TInt retcode=RProperty::Get(KPubSubUid, aFlag, value);
       
    69 	return (retcode==KErrNone) ? value : retcode;
       
    70 	}
       
    71 	
       
    72 // used by binder
       
    73 static TBool TestFlagsActive()
       
    74 	{
       
    75 	return GetResult(KFlagsActive) == KErrNone;
       
    76 	}
       
    77 
       
    78 // used by binder
       
    79 static void SetResult(TInt aFlag, TInt aValue)
       
    80 	{
       
    81 	// Yes it is very inefficient making these calls
       
    82 	//  on e.g. each packet send but we only do this when
       
    83 	//  the test is running i.e. if it was explicitly
       
    84 	//  switched on, so it won't affect "normal" operation.
       
    85 	RProperty::Define(KPubSubUid, aFlag, RProperty::EInt);
       
    86 	RProperty::Set(KPubSubUid, aFlag, aValue);
       
    87 	}
       
    88 } // namespace MbufGobblerTestFlags
       
    89 
       
    90 #else // _DEBUG
       
    91 #define MBUFGOBBLER_TEST_POINT(flag,result)
       
    92 // It's better to make the urel and udeb objects the same size,
       
    93 //  at the expense of 4 bytes:
       
    94 #define MBUFGOBBLER_TEST_DATA TBool iTestFlags_unused;
       
    95 #define MBUFGOBBLER_TEST_DATA_INIT
       
    96 #endif // _DEBUG
       
    97 
       
    98 #endif /* MBUFGOBBLERTESTFLAGS_H_ */