usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h
changeset 34 7858bc6ead78
parent 31 dfdd8240f7c8
child 35 9d8b04ca6939
equal deleted inserted replaced
31:dfdd8240f7c8 34:7858bc6ead78
     1 /*
       
     2 * Copyright (c) 2008-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 
       
    19 
       
    20 
       
    21 #ifndef USBUINOTIFAPITEST_H
       
    22 #define USBUINOTIFAPITEST_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <StifLogger.h>
       
    26 #include <TestScripterInternal.h>
       
    27 #include <StifTestModule.h>
       
    28 #include <TestclassAssert.h>
       
    29 
       
    30 #include <usbuinotif.h>
       
    31 #include <usbpersonalityids.h>
       
    32 #include <centralrepository.h>
       
    33 #include <UsbWatcherInternalCRKeys.h>
       
    34 #include <usbman.h>
       
    35 #include <usbwatcher.h>
       
    36 #include <usb/hostms/srverr.h> 
       
    37 // CONSTANTS
       
    38 //const ?type ?constant_var = ?constant;
       
    39 
       
    40 // MACROS
       
    41 //#define ?macro ?macro_def
       
    42 #define TEST_CLASS_VERSION_MAJOR 0
       
    43 #define TEST_CLASS_VERSION_MINOR 0
       
    44 #define TEST_CLASS_VERSION_BUILD 0
       
    45 
       
    46 // Logging path
       
    47 //_LIT( KUsbUiNotifApiTestLogPath, "\\logs\\testframework\\UsbUiNotifApiTest\\" );
       
    48 
       
    49 // Logging path for ATS - for phone builds comment this line
       
    50 _LIT( KUsbUiNotifApiTestLogPath, "e:\\testing\\stiflogs\\" ); 
       
    51 
       
    52 // Log file
       
    53 _LIT( KUsbUiNotifApiTestLogFile, "UsbUiNotifApiTest.txt" ); 
       
    54 _LIT( KUsbUiNotifApiTestLogFileWithTitle, "UsbUiNotifApiTest_[%S].txt" );
       
    55 
       
    56 // FUNCTION PROTOTYPES
       
    57 //?type ?function_name(?arg_list);
       
    58 
       
    59 // FORWARD DECLARATIONS
       
    60 //class ?FORWARD_CLASSNAME;
       
    61 class CUsbUiNotifApiTest;
       
    62 
       
    63 // DATA TYPES
       
    64 //enum ?declaration
       
    65 
       
    66 enum TUsbUiNotifApiTestResult
       
    67     {
       
    68     ETestCasePassed,
       
    69     ETestCaseFailed
       
    70     };
       
    71 
       
    72 enum TTestOption
       
    73     {
       
    74     EQueryDiscarded = 0,
       
    75     EQueryAccepted,
       
    76     EQueryCanceled
       
    77     };
       
    78 //typedef ?declaration
       
    79 //extern ?data_type;
       
    80 
       
    81 // CLASS DECLARATION
       
    82 
       
    83 NONSHARABLE_CLASS( TUsbUiNotifApiTestBlockParams )
       
    84     {
       
    85     public:
       
    86         TPtrC iTestBlockName;
       
    87         
       
    88         TPtrC iTestOption1;
       
    89         TPtrC iTestOption2;
       
    90         TPtrC iTestOption3;
       
    91         
       
    92         TInt iTestIntOption1;
       
    93         TInt iTestIntOption2;
       
    94         
       
    95         TChar iTestCharOption1;
       
    96         TChar iTestCharOption2;
       
    97     };
       
    98 
       
    99 /**
       
   100 *  CUsbUiNotifApiTest test class for STIF Test Framework TestScripter.
       
   101 *  ?other_description_lines
       
   102 *
       
   103 *  @lib ?library
       
   104 *  @since ?Series60_version
       
   105 */
       
   106 NONSHARABLE_CLASS( CUsbUiNotifApiTest ) : public CScriptBase
       
   107     {
       
   108     public:  // Constructors and destructor
       
   109 
       
   110         /**
       
   111         * Two-phased constructor.
       
   112         */
       
   113         static CUsbUiNotifApiTest* NewL( CTestModuleIf& aTestModuleIf );
       
   114 
       
   115         /**
       
   116         * Destructor.
       
   117         */
       
   118         virtual ~CUsbUiNotifApiTest();
       
   119 
       
   120     public: // New functions
       
   121 
       
   122         /**
       
   123         * ?member_description.
       
   124         * @since ?Series60_version
       
   125         * @param ?arg1 ?description
       
   126         * @return ?description
       
   127         */
       
   128         //?type ?member_function( ?type ?arg1 );
       
   129 
       
   130     public: // Functions from base classes
       
   131 
       
   132         /**
       
   133         * From CScriptBase Runs a script line.
       
   134         * @since ?Series60_version
       
   135         * @param aItem Script line containing method name and parameters
       
   136         * @return Symbian OS error code
       
   137         */
       
   138         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   139 
       
   140     protected:  // New functions
       
   141 
       
   142         /**
       
   143         * ?member_description.
       
   144         * @since ?Series60_version
       
   145         * @param ?arg1 ?description
       
   146         * @return ?description
       
   147         */
       
   148         //?type ?member_function( ?type ?arg1 );
       
   149 
       
   150     protected:  // Functions from base classes
       
   151 
       
   152         /**
       
   153         * From ?base_class ?member_description
       
   154         */
       
   155         //?type ?member_function();
       
   156 
       
   157     private:
       
   158 
       
   159         /**
       
   160         * C++ default constructor.
       
   161         */
       
   162         CUsbUiNotifApiTest( CTestModuleIf& aTestModuleIf );
       
   163 
       
   164         /**
       
   165         * By default Symbian 2nd phase constructor is private.
       
   166         */
       
   167         void ConstructL();
       
   168 
       
   169         // Prohibit copy constructor if not deriving from CBase.
       
   170         // ?classname( const ?classname& );
       
   171         // Prohibit assigment operator if not deriving from CBase.
       
   172         // ?classname& operator=( const ?classname& );
       
   173 
       
   174         /**
       
   175         * Frees all resources allocated from test methods.
       
   176         * @since ?Series60_version
       
   177         */
       
   178         void Delete();
       
   179 
       
   180         /**
       
   181         * Test methods are listed below. 
       
   182         */
       
   183 
       
   184         virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem );
       
   185         virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem );
       
   186         virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem );
       
   187         
       
   188         
       
   189         
       
   190         /**
       
   191          * Method used to log version of test class
       
   192          */
       
   193         void SendTestClassVersion();
       
   194 
       
   195         //ADD NEW METHOD DEC HERE
       
   196         //[TestMethods] - Do not remove
       
   197 
       
   198         void GetTestBlockParamsL( CStifItemParser& aItem );
       
   199         
       
   200     	void DoExecuteApiTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult );    	
       
   201     	void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult );    
       
   202     	void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult );
       
   203     	
       
   204         void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption, 
       
   205                  TInt aTestIntOption, TInt aTestCharOption, TUsbUiNotifApiTestResult& aTestResult );
       
   206 
       
   207         void CableConnectedNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   208         void ConnectionNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   209         void UsbQueriesNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   210         void UsbOTGErrorNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   211         void UsbOTGWarningNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   212         TInt FinishQuery( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   213         void LoadNotifiersL( TUsbUiNotifApiTestResult& aTestResult );
       
   214         void UnLoadNotifiers ( TUsbUiNotifApiTestResult& aTestResult );
       
   215         void Update( TUsbUiNotifApiTestResult& aTestResult );
       
   216         //void Cancelnotifier( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); 
       
   217         void Notifierstart( TUsbUiNotifApiTestResult& aTestResult );
       
   218         //void AsyncConnectionNotifier ( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   219         void UsbMSMMNotifierTests ( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
       
   220 
       
   221         TInt GetTestOption( TPtrC aOptionString, TTestOption& aOption );
       
   222         TInt GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId );
       
   223         TInt GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType );        
       
   224         TInt GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType );
       
   225         TInt GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType );
       
   226         TInt GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType );
       
   227 
       
   228         inline void Trace(TRefByValue<const TDesC8> aFmt, ...);
       
   229         inline void Trace(TRefByValue<const TDesC16> aFmt, ...);
       
   230 	
       
   231     public:     // Data
       
   232         // ?one_line_short_description_of_data
       
   233         //?data_declaration;
       
   234 
       
   235     protected:  // Data
       
   236         // ?one_line_short_description_of_data
       
   237         //?data_declaration;
       
   238 
       
   239     private:    // Data
       
   240         TUsbUiNotifApiTestBlockParams iTestBlockParams;
       
   241 
       
   242         RNotifier *iNotifier;
       
   243         RUsbWatcher* iUsbWatcher;
       
   244  
       
   245         CRepository* iRepository;
       
   246         
       
   247         TUSBConnectionNotifierParamsPckg iConnectionNotifierResponseParamsPckg;
       
   248         TRequestStatus iReqStatus;
       
   249         TInt iPersonalityIdBackup;
       
   250         TBool iCompleteQuery;        
       
   251         TPckg<TInt> iRes;
       
   252         CArrayPtr<MEikSrvNotifierBase2>* iNotifierArray;
       
   253         TUid iInstanceUid;
       
   254         THostMsErrData iErrData;
       
   255         THostMsErrorDataPckg iErrPckg ;
       
   256 
       
   257         // Reserved pointer for future extension
       
   258         //TAny* iReserved;
       
   259 
       
   260     public:     // Friend classes
       
   261         //?friend_class_declaration;
       
   262     protected:  // Friend classes
       
   263         //?friend_class_declaration;
       
   264     private:    // Friend classes
       
   265         //?friend_class_declaration;
       
   266         
       
   267     };
       
   268 
       
   269 #include "UsbUiNotifApiTestDebug.inl"
       
   270 
       
   271 #endif      // USBUINOTIFAPITEST_H
       
   272 
       
   273 // End of File