stif/StifTFwIf/src/UIEngineError.cpp
changeset 36 813b186005b6
parent 30 86a2e675b80a
child 41 838cdffd57ce
equal deleted inserted replaced
30:86a2e675b80a 36:813b186005b6
     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: CUIEngineErrorPrinter handles error prints from 
       
    15 * test framework.
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <e32svr.h>
       
    22 #include <stifinternal/UIEngineContainer.h>
       
    23 #include "UIEngineError.h"
       
    24 #include "Logging.h"
       
    25 
       
    26 
       
    27 // EXTERNAL DATA STRUCTURES
       
    28 // None
       
    29 
       
    30 // EXTERNAL FUNCTION PROTOTYPES  
       
    31 // None
       
    32 
       
    33 // CONSTANTS
       
    34 // None
       
    35 
       
    36 // MACROS
       
    37 #ifdef LOGGER
       
    38 #undef LOGGER
       
    39 #endif
       
    40 #define LOGGER iUIEngine->iLogger
       
    41 
       
    42 
       
    43 // LOCAL CONSTANTS AND MACROS
       
    44 // None
       
    45 
       
    46 // MODULE DATA STRUCTURES
       
    47 // None
       
    48 
       
    49 // LOCAL FUNCTION PROTOTYPES
       
    50 // None
       
    51 
       
    52 // FORWARD DECLARATIONS
       
    53 // None
       
    54 
       
    55 
       
    56 // ==================== LOCAL FUNCTIONS ======================================= 
       
    57 // None
       
    58 
       
    59 // ================= MEMBER FUNCTIONS =========================================
       
    60 
       
    61 /*
       
    62 -------------------------------------------------------------------------------
       
    63 
       
    64     Class: CUIEngineErrorPrinter
       
    65 
       
    66     Method: NewL
       
    67 
       
    68     Description: Create a testcase runner.
       
    69 
       
    70     Parameters: CUIEngineContainer* aContainer: in: Pointer to testcase container
       
    71     
       
    72     Return Values: CUIEngineErrorPrinter* : pointer to created object
       
    73 
       
    74     Errors/Exceptions: Leaves if memory allocation for object fails
       
    75                        Leaves if ConstructL leaves
       
    76 
       
    77     Status: Draft
       
    78     
       
    79 -------------------------------------------------------------------------------
       
    80 */
       
    81 CUIEngineErrorPrinter* CUIEngineErrorPrinter::NewL( 
       
    82                                 CUIEngine* aUIEngine )
       
    83     {
       
    84 
       
    85     CUIEngineErrorPrinter* self = 
       
    86         new ( ELeave ) CUIEngineErrorPrinter( aUIEngine );
       
    87     CleanupStack::PushL( self );
       
    88     self->ConstructL();
       
    89     CleanupStack::Pop( self );
       
    90     return self;
       
    91 
       
    92     }
       
    93 
       
    94 /*
       
    95 -------------------------------------------------------------------------------
       
    96 
       
    97     Class: CUIEngineErrorPrinter
       
    98 
       
    99     Method: ConstructL
       
   100 
       
   101     Description: Second phase constructor.
       
   102 
       
   103     Parameters: None
       
   104 
       
   105     Return Values: None
       
   106 
       
   107     Errors/Exceptions: None
       
   108 
       
   109     Status: Draft
       
   110     
       
   111 -------------------------------------------------------------------------------
       
   112 */
       
   113 void CUIEngineErrorPrinter::ConstructL()
       
   114     {
       
   115 
       
   116     }
       
   117 
       
   118 /*
       
   119 -------------------------------------------------------------------------------
       
   120 
       
   121     Class: CUIEngineErrorPrinter
       
   122 
       
   123     Method: CUIEngineErrorPrinter
       
   124 
       
   125     Description: Constructor.
       
   126     
       
   127     Parameters: None
       
   128 
       
   129     Return Values: None
       
   130 
       
   131     Errors/Exceptions: None
       
   132 
       
   133     Status: Draft
       
   134     
       
   135 -------------------------------------------------------------------------------
       
   136 */
       
   137 CUIEngineErrorPrinter::CUIEngineErrorPrinter( CUIEngine* aUIEngine ): 
       
   138     CActive( EPriorityStandard ),
       
   139     iUIEngine( aUIEngine ),
       
   140     iErrorPckg( iError )
       
   141     {
       
   142     
       
   143      __TRACE( KPrint, ( _L( "CUIEngineErrorPrinter::CUIEngineErrorPrinter") ) );
       
   144     __ASSERT_ALWAYS( aUIEngine, User::Panic( _L("Null pointer"), KErrGeneral ) );
       
   145     
       
   146     CActiveScheduler::Add( this );
       
   147 
       
   148     }
       
   149 
       
   150 /*
       
   151 -------------------------------------------------------------------------------
       
   152 
       
   153     Class: CUIEngineErrorPrinter
       
   154 
       
   155     Method: ~CUIEngineErrorPrinter
       
   156 
       
   157     Description: Destructor.
       
   158 
       
   159     Parameters: None
       
   160 
       
   161     Return Values: None
       
   162 
       
   163     Errors/Exceptions: None
       
   164 
       
   165     Status: Draft
       
   166     
       
   167 -------------------------------------------------------------------------------
       
   168 */
       
   169 CUIEngineErrorPrinter::~CUIEngineErrorPrinter( )
       
   170     {
       
   171     
       
   172     __TRACE( KPrint, ( _L( "CUIEngineErrorPrinter::~CUIEngineErrorPrinter") ) );
       
   173     Cancel();
       
   174     
       
   175     }
       
   176 
       
   177 /*
       
   178 -------------------------------------------------------------------------------
       
   179 
       
   180     Class: CUIEngineErrorPrinter
       
   181 
       
   182     Method: StartL
       
   183 
       
   184     Description: Starts a test case and sets the active object to active.
       
   185 
       
   186     Parameters: RTestCase& aTestCase: in: Reference to the testcase object
       
   187 
       
   188     Return Values: None
       
   189 
       
   190     Errors/Exceptions: None
       
   191 
       
   192     Status: Draft
       
   193 
       
   194 -------------------------------------------------------------------------------
       
   195 */
       
   196 void CUIEngineErrorPrinter::StartL( RTestEngine& aEngine )
       
   197     {
       
   198     
       
   199     iTestEngine = aEngine;
       
   200  
       
   201     if ( IsActive() )
       
   202         User::Leave( KErrInUse );
       
   203 
       
   204     SetActive();   
       
   205     iTestEngine.ErrorNotification ( iErrorPckg, iStatus );
       
   206     
       
   207     }
       
   208 
       
   209 
       
   210 
       
   211 /*
       
   212 -------------------------------------------------------------------------------
       
   213 
       
   214     Class: CUIEngineErrorPrinter
       
   215 
       
   216     Method: RunL
       
   217 
       
   218     Parameters: None
       
   219 
       
   220     Return Values: None
       
   221 
       
   222     Errors/Exceptions: None
       
   223 
       
   224     Status: Draft
       
   225 
       
   226 -------------------------------------------------------------------------------
       
   227 */
       
   228 void CUIEngineErrorPrinter::RunL()
       
   229     {
       
   230 
       
   231     if( iStatus != KErrNone )
       
   232         {
       
   233         return;
       
   234         }
       
   235         
       
   236     iUIEngine->ErrorPrint( iError );
       
   237     
       
   238     // Set new request
       
   239     SetActive();   
       
   240     iTestEngine.ErrorNotification ( iErrorPckg, iStatus );
       
   241 
       
   242     }
       
   243 
       
   244 
       
   245 
       
   246 /*
       
   247 -------------------------------------------------------------------------------
       
   248 
       
   249     Class: CUIEngineErrorPrinter
       
   250 
       
   251     Method: DoCancel
       
   252 
       
   253     Description: Cancels the asynchronous request
       
   254 
       
   255     Parameters: None
       
   256 
       
   257     Return Values: None
       
   258 
       
   259     Errors/Exceptions: None
       
   260 
       
   261     Status: Draft
       
   262     
       
   263 -------------------------------------------------------------------------------
       
   264 */
       
   265 void CUIEngineErrorPrinter::DoCancel()
       
   266     {
       
   267 
       
   268     iTestEngine.CancelAsyncRequest ( ETestEngineErrorNotification );
       
   269 
       
   270     }
       
   271 
       
   272 // ================= OTHER EXPORTED FUNCTIONS ================================= 
       
   273 // None
       
   274 
       
   275 // End of File