stif/stif_plat/inc/UIStoreIf.h
branchRCL_3
changeset 59 8ad140f3dd41
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     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: This file contains the header file of the CUIStore.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef UISTOREIF_H
       
    19 #define UISTOREIF_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32keys.h>
       
    24 
       
    25 #include <StifTestInterface.h>
       
    26 
       
    27 #include <stifinternal/RRefArray.h>
       
    28 
       
    29 // EXTERNAL DATA STRUCTURES
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 // MACROS
       
    36 
       
    37 // LOCAL CONSTANTS AND MACROS
       
    38 
       
    39 // MODULE DATA STRUCTURES
       
    40 
       
    41 // LOCAL FUNCTION PROTOTYPES
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 class CUIStore;
       
    45 class CStartedTestCase;
       
    46 class CTestInfo;
       
    47 
       
    48 // CONSTANTS
       
    49 
       
    50 // CLASS DECLARATION
       
    51 
       
    52 /**
       
    53 * UI Store class interface. UI must derive this to use UI Store.
       
    54 */
       
    55 class CUIStoreIf 
       
    56     :public CBase
       
    57     {
       
    58     public: // Enumerations
       
    59         // Updated flags
       
    60         enum TUpdateFlags
       
    61             {
       
    62             // Test case status updates 
       
    63             EStatusRunning  = 0x00000001,
       
    64             EStatusExecuted = 0x00000002,
       
    65             EStatusPassed   = 0x00000004,
       
    66             EStatusFailed   = 0x00000008,
       
    67             EStatusAborted  = 0x00000010,
       
    68             EStatusCrashed  = 0x00000020,
       
    69             EStatusAll      = 0x000000ff,
       
    70             // Test set updates
       
    71             ESetRunning     = 0x00000100,
       
    72             ESetExecuted    = 0x00000200,
       
    73             ESetPassed      = 0x00000400,
       
    74             ESetFailed      = 0x00000800,
       
    75             ESetAll         = 0x0000ff00,
       
    76             // Other updates
       
    77             EPrintUpdate    = 0x00010000,                              
       
    78             };
       
    79             
       
    80     private: // Enumerations
       
    81         // None
       
    82         
       
    83     public: // Constructors and destructor
       
    84     
       
    85         /**
       
    86         * Destructor.
       
    87         */      
       
    88         IMPORT_C ~CUIStoreIf();
       
    89         
       
    90     protected:
       
    91         /**
       
    92         * Constructor
       
    93         */
       
    94         IMPORT_C CUIStoreIf();
       
    95 
       
    96         /**
       
    97         * Symbian OS second phase constructor. This must be called 
       
    98         * from derived class ConstructL.
       
    99         */      
       
   100         IMPORT_C void ConstructL();
       
   101         
       
   102     public: // New functions
       
   103         /**
       
   104         * Returns reference to CUIStore object, 
       
   105         * which handles test cases and test modules.
       
   106         */
       
   107         IMPORT_C CUIStore& UIStore();
       
   108 
       
   109         /**
       
   110         * Receives output update notification from CUIStore.
       
   111         * UI implements this to get update notifications. 
       
   112         * aFlags are from 
       
   113         */
       
   114         virtual void Update( CStartedTestCase* /*aTestCase*/, 
       
   115                              TInt /* aFlags */ ){};
       
   116                                    
       
   117                                    
       
   118         /**
       
   119         * Function is called when test framework prints error.
       
   120         */
       
   121         virtual void Error( TErrorNotification& /*aError*/ ){};
       
   122         
       
   123         /**
       
   124         * Function is called to print message to UI.
       
   125         */
       
   126         virtual TInt PopupMsg( const TDesC& /* aLine1 */, 
       
   127                                const TDesC& /* aLine2 */, 
       
   128                                TInt /* aTimeInSecs */ )
       
   129             { return KErrNotSupported; };
       
   130             
       
   131         /**
       
   132         * Function is called to print message to UI
       
   133         * and wait key pressing.
       
   134         */
       
   135         virtual TInt PopupMsg( const TDesC& /* aLine1 */, 
       
   136                                const TDesC& /* aLine2 */, 
       
   137                                TInt /* aTimeInSecs */,
       
   138                                TKeyCode& /* aKey */,
       
   139                                TRequestStatus& /* aStatus */ )
       
   140             { return KErrNotSupported; };
       
   141        
       
   142        /**
       
   143         * Function is called to close instances.
       
   144         */
       
   145         virtual void Close( TInt /* aHandle */ ){};
       
   146 
       
   147     public: // Functions from base classes
       
   148 
       
   149     private: 
       
   150 
       
   151     private:
       
   152     
       
   153     private: // Data
       
   154 		CUIStore*					    iUIStore;
       
   155 		
       
   156     };
       
   157     
       
   158 // CLASS DECLARATION
       
   159 
       
   160 // DESCRIPTION
       
   161 // CTestSetInfo contains test set information
       
   162 class CTestSetInfo 
       
   163     :public CBase  
       
   164     {
       
   165     public: // Enumerations
       
   166 
       
   167     private: // Enumerations
       
   168 
       
   169     public:  // Constructors and destructor
       
   170 
       
   171         /**
       
   172         * NewL is first phase of two-phased constructor.
       
   173         */
       
   174         static CTestSetInfo* NewL( const TDesC& aName );
       
   175 
       
   176         /**
       
   177         * Destructor of CStartedTestCase.
       
   178         */
       
   179         virtual ~CTestSetInfo();
       
   180 
       
   181     public: // New functions
       
   182         
       
   183         /**
       
   184         * Get test set name.
       
   185         */
       
   186         inline const TDesC& Name() const 
       
   187             { return *iName; };
       
   188         
       
   189         /**
       
   190         * Get test cases.
       
   191         */
       
   192         inline const RRefArray<const CTestInfo>& TestCases() const
       
   193             { return iTestCaseRefs; };
       
   194         
       
   195         /**
       
   196         * Add test case to set.
       
   197         */
       
   198         TInt AddTestCase( const CTestInfo& aTestInfo );
       
   199         
       
   200         /**
       
   201         * Insert test case to specific location.
       
   202         */
       
   203         TInt InsertTestCase( const CTestInfo& aTestInfo, TInt aPos );
       
   204      
       
   205         /**
       
   206         * Remove test case from set.
       
   207         */
       
   208         TInt RemoveTestCase( const CTestInfo& aTestInfo );
       
   209         
       
   210         /**
       
   211         * NewL is first phase of two-phased constructor.
       
   212         */
       
   213         void CopyL( const CTestSetInfo& aTestSetInfo );
       
   214         
       
   215         /**
       
   216         * Sets the info which test case has been started lately.
       
   217         */
       
   218         void SetLastStartedCaseIndex(TUint aLastStartedCaseIndex);
       
   219 
       
   220         /**
       
   221         * Gets the info which test case has been started lately.
       
   222         */
       
   223         TUint GetLastStartedCaseIndex(void);
       
   224         /**
       
   225         * rename test set
       
   226         */
       
   227         void RenameTestSet(const TDesC& aTestSetName);
       
   228                 
       
   229     public: // Functions from base classes
       
   230 
       
   231     protected:  // New functions
       
   232 
       
   233     protected:  // Functions from base classes
       
   234 
       
   235     private:   // Functions from base classes
       
   236         /** 
       
   237         * C++ default constructor.
       
   238         */
       
   239         CTestSetInfo();       
       
   240 
       
   241         /**
       
   242         * By default Symbian OS constructor is private.
       
   243         */
       
   244         void ConstructL( const TDesC& aName );
       
   245 
       
   246     public:     // Data
       
   247     
       
   248     protected:  // Data
       
   249         // None
       
   250 
       
   251     private:    // Data
       
   252         RRefArray<const CTestInfo>      iTestCaseRefs;
       
   253         RPointerArray<CTestInfo>        iTestCases;
       
   254         HBufC*                          iName;
       
   255         // Which test case was started as a last one (index)
       
   256         TUint                           iLastStartedCaseIndex;
       
   257         
       
   258     public:     // Friend classes
       
   259         // None
       
   260 
       
   261     protected:  // Friend classes
       
   262         // None
       
   263 
       
   264     private:    // Friend classes
       
   265         // None
       
   266 
       
   267     };
       
   268 
       
   269 #endif // UISTOREIF_H
       
   270 
       
   271 // End of File