startupservices/Startup/syserrcmd/tsrc/syserrcmdtest/inc/syserrcmdtest.h
branchRCL_3
changeset 62 924385140d98
parent 58 0818dd463d41
child 63 c2c61fdca848
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
     1 /*
       
     2 * Copyright (c) 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 * Csyserrcmdtest class declaration.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef SYSERRCMDTEST_H
       
    21 #define SYSERRCMDTEST_H
       
    22 
       
    23 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
       
    24 #pragma once
       
    25 #endif
       
    26 
       
    27 // SYSTEM INCLUDES
       
    28 #include <testscripterinternal.h>
       
    29 
       
    30 #include "asyncrequesthandler.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class TCaseInfo;
       
    34 class CSysErrCmdTest;
       
    35 class MSsmCustomCommand;
       
    36 class CSsmCustomCommandEnv;
       
    37 
       
    38 // DESCRIPTION
       
    39 // This a Test Module interface template
       
    40 // that does not really do anything.
       
    41 typedef TInt ( CSysErrCmdTest::*TestFunction )( TTestResult& );
       
    42 
       
    43 NONSHARABLE_CLASS( CSysErrCmdTest ) : public CScriptBase
       
    44     {
       
    45 public: // Constructors and destructor
       
    46 
       
    47     /**
       
    48     * Two-phased constructor.
       
    49     */
       
    50     static CSysErrCmdTest* NewL( CTestModuleIf& aTestModuleIf );
       
    51 
       
    52     /**
       
    53     * Destructor.
       
    54     */
       
    55     virtual ~CSysErrCmdTest();
       
    56 
       
    57 public: // Functions from base classes
       
    58 
       
    59     TInt RunMethodL( CStifItemParser& aItem );
       
    60 
       
    61 protected: // New functions
       
    62 
       
    63     TInt CreateAndDestroyL( CStifItemParser& aItem );
       
    64     TInt InitAndCloseL( CStifItemParser& aItem );
       
    65     TInt ExecuteL( CStifItemParser& aItem );
       
    66     TInt ExecuteCancelL( CStifItemParser& aItem );
       
    67     TInt ShowAfterAknGlobalNoteL( CStifItemParser& aItem );
       
    68     TInt ShowAfterUiServerGlobalNoteL( CStifItemParser& aItem );
       
    69     
       
    70     /** HandleIssueRequest callback */
       
    71     void HandleIssueRequest( TRequestStatus& );
       
    72        
       
    73     /** HandleRunL callback */
       
    74     void HandleRunL( TInt );
       
    75        
       
    76     /** HandleRunError callback */
       
    77     TInt HandleRunError( TInt );
       
    78        
       
    79     /** HandleDoCancel callback */
       
    80     void HandleDoCancel();
       
    81 
       
    82 private:
       
    83 
       
    84     /**
       
    85     * C++ default constructor.
       
    86     */
       
    87     CSysErrCmdTest( CTestModuleIf& aTestModuleIf );
       
    88 
       
    89     /**
       
    90     * By default Symbian OS constructor is private.
       
    91     */
       
    92     void ConstructL();
       
    93 
       
    94     /**
       
    95     * Function returning test case name and pointer to test case function
       
    96     */
       
    97     const TCaseInfo Case( const TInt aCaseNumber ) const;
       
    98 
       
    99 private: // Data
       
   100 
       
   101     TestFunction iMethod;
       
   102     
       
   103     CAsyncRequestHandler<CSysErrCmdTest>*  iExecuteHandler;
       
   104     
       
   105     RFs                                    iFs;
       
   106     
       
   107     MSsmCustomCommand*                     iSysErrCmd;
       
   108     
       
   109     CSsmCustomCommandEnv*                  iCustCmdEnvStub;
       
   110     
       
   111     TInt                                   iExecutionResult;
       
   112     };
       
   113 
       
   114 // Function pointer related internal definitions
       
   115 
       
   116 // Hack around known GCC bug.
       
   117 #ifndef __GCC32__
       
   118     #define GETPTR
       
   119 #else
       
   120     #define GETPTR &
       
   121 #endif
       
   122 
       
   123 
       
   124 // An internal structure containing a test case name and
       
   125 // the pointer to function doing the test
       
   126 class TCaseInfoInternal
       
   127     {
       
   128     public:
       
   129         const TText* iCaseName;
       
   130         TestFunction iMethod;
       
   131     };
       
   132 
       
   133 // An internal structure containing a test case name and
       
   134 // the pointer to function doing the test
       
   135 class TCaseInfo
       
   136     {
       
   137     public:
       
   138         TPtrC iCaseName;
       
   139         TestFunction iMethod;
       
   140 
       
   141     TCaseInfo( const TText* a ) : iCaseName( ( TText* ) a )
       
   142         {
       
   143         };
       
   144     };
       
   145 
       
   146 #endif // SYSERRCMDTEST_H
       
   147