tsrc/testtools/stubsrv/inc/apibehavior.h
branchRCL_3
changeset 92 dde4619868dc
parent 86 703a2b94c06c
child 95 55a3258355ea
equal deleted inserted replaced
86:703a2b94c06c 92:dde4619868dc
     1 /*
       
     2 * Copyright (c) 2010 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 APIBEHAVIOR_H
       
    19 #define APIBEHAVIOR_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 const TInt KApiOutputSize = 512;
       
    24 
       
    25 /**
       
    26  * The specification of the behavior of an API.
       
    27  */
       
    28 NONSHARABLE_CLASS(TApiBehavior)
       
    29 {
       
    30 public:
       
    31 
       
    32     /**
       
    33      * Constructs by default.
       
    34      * Members are initialized to:
       
    35      *	iLib: 0
       
    36      *	iApi:  0
       
    37      *	iCompleteCode:  0.
       
    38      *  iAsyncCompleteCode:  0.
       
    39      *	iOutput: KNullDes8.
       
    40      */
       
    41     IMPORT_C TApiBehavior();
       
    42 
       
    43     /**
       
    44      * Constructs by specified.
       
    45      * @param aLib the library identifier
       
    46      * @param aApi the API identifier
       
    47      *
       
    48      * Other members are initialized to:
       
    49      *	iCompleteCode:  0.
       
    50      *  iAsyncCompleteCode:  0.
       
    51      *	iOutput: KNullDes8.
       
    52      */
       
    53     IMPORT_C TApiBehavior(TUint aLib, TUint aApi);
       
    54 
       
    55     /**
       
    56      * Construct by specified.
       
    57      *
       
    58      * @param aLib the library identifier
       
    59      * @param aApi the API identifier
       
    60      * @param aCompleteCode the expected completion code of the API call
       
    61      * @param aAsyncCompleteCode the expected asynchronous completion code of the API call
       
    62      * @param aOutput the expected output
       
    63      */
       
    64     IMPORT_C TApiBehavior(TUint aLib, TUint aApi, 
       
    65         TInt aCompleteCode, TInt aAsyncCompleteCode,
       
    66         const TDesC8& aOutput);
       
    67 
       
    68     /**
       
    69      * Compares if the identifiers of this API match with the specified.
       
    70      * @param aLib the library identifier
       
    71      * @param aApi the APi identifier
       
    72      *
       
    73      * @return ETrue if the ids match; EFalse otherwise.
       
    74      */
       
    75     IMPORT_C TBool MatchId(TUint aLib, TUint aApi) const;
       
    76     
       
    77     /**
       
    78      * Compares if the identifiers of this API match with the identifiers of the specified.
       
    79      * @param aLib the library identifier
       
    80      * @param aApi the APi identifier
       
    81      *
       
    82      * @return ETrue if the ids match; EFalse otherwise.
       
    83      */
       
    84     IMPORT_C TBool MatchId(const TApiBehavior& aBeh) const;
       
    85     
       
    86     /**
       
    87      * Operator ==
       
    88      *
       
    89      * @return ETrue if if the content of this is identical with the specified; EFalse otherwise.
       
    90      */
       
    91     IMPORT_C TBool operator==(const TApiBehavior& aBeh) const;
       
    92     
       
    93     /**
       
    94      * Operator !=
       
    95      *
       
    96      * @return ETrue if if the content of this is different with the specified; EFalse otherwise.
       
    97      */
       
    98     IMPORT_C TBool operator!=(const TApiBehavior& aBeh) const;
       
    99 
       
   100 public:
       
   101     
       
   102     /** 
       
   103      * The identifier of the library that provides this API
       
   104      */
       
   105 	TUint iLib;
       
   106 	
       
   107     /** 
       
   108      * The identifier of this API in the library.
       
   109      *
       
   110      * iLib and iApi identify a unique API in the scope of testing framework.
       
   111      */
       
   112 	TUint iApi;
       
   113 	
       
   114 	/**
       
   115 	 * The completion code of the API call, either the return error code if 
       
   116 	 * the function returns one or the leave code if the function is leavable.
       
   117 	 * This should be ignored by void type APIs.
       
   118 	 */
       
   119 	TInt iCompleteCode;
       
   120 	
       
   121     /** 
       
   122      * The completion code of asynchronous service provided by this API.
       
   123      * This should be ignored by synchronous API.
       
   124      */
       
   125     TInt iAsyncCompleteCode;
       
   126     
       
   127     /**
       
   128      * The expected output of this API.
       
   129      */
       
   130 	TBuf8<KApiOutputSize> iOutput;
       
   131 	};
       
   132 
       
   133 typedef TPckgBuf<TApiBehavior> TApiBehaviorPckgBuf;
       
   134 typedef TPckg<TApiBehavior> TApiBehaviorPckg;
       
   135 
       
   136 #endif
       
   137