stif/TestServer/src/Testexecution.cpp
changeset 26 4fde310f06fe
parent 0 a03f92240627
child 30 86a2e675b80a
equal deleted inserted replaced
21:f5d4820de50d 26:4fde310f06fe
   189     iPrintQueue = NULL;
   189     iPrintQueue = NULL;
   190 
   190 
   191     // Delete name buffer
   191     // Delete name buffer
   192     delete iConfigNameBuffer;
   192     delete iConfigNameBuffer;
   193     iConfigNameBuffer = NULL;
   193     iConfigNameBuffer = NULL;
   194     
   194 
       
   195     delete iTestCaseArgs;
       
   196     iTestCaseArgs = NULL;
       
   197         
   195     iStateEvents.ResetAndDestroy();
   198     iStateEvents.ResetAndDestroy();
   196     iStateEvents.Close();
   199     iStateEvents.Close();
   197 
   200 
   198     iEventArray.ResetAndDestroy();
   201     iEventArray.ResetAndDestroy();
   199     iEventArray.Close();
   202     iEventArray.Close();
   336 TInt CTestExecution::RunTestCase( const RMessage2& aMessage )
   339 TInt CTestExecution::RunTestCase( const RMessage2& aMessage )
   337     {
   340     {
   338 
   341 
   339     __TRACE ( KInit, ( _L( "CTestExecution::RunTestCase in" ) ) );
   342     __TRACE ( KInit, ( _L( "CTestExecution::RunTestCase in" ) ) );
   340 
   343 
       
   344     TInt ret = KErrNone;
       
   345     
   341     // Store message to be completed when case is finished
   346     // Store message to be completed when case is finished
   342     iTestExeMessage = aMessage;
   347     iTestExeMessage = aMessage;
   343 
   348 
   344     iFullResult.iStartTime.HomeTime();
   349     iFullResult.iStartTime.HomeTime();
       
   350 
       
   351     delete iTestCaseArgs;
       
   352     iTestCaseArgs = NULL;
       
   353     
       
   354     TInt testCaseArgsLength = iTestExeMessage.GetDesLength( 1 );
       
   355     if ( ( testCaseArgsLength != KErrArgument ) && ( testCaseArgsLength != KErrBadDescriptor ) )
       
   356         {
       
   357         iTestCaseArgs = HBufC::New( testCaseArgsLength );
       
   358         if ( iTestCaseArgs == NULL )
       
   359             {
       
   360             _LIT(KRunError,"Can't allocate memory for test case arguments");
       
   361             __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) );
       
   362             CompleteTestExecution( KErrNone,
       
   363                                    TFullTestResult::ECaseException,
       
   364                                    KErrNoMemory,
       
   365                                    KErrGeneral,
       
   366                                    KRunError );
       
   367             return KErrNone;        
       
   368             }
       
   369             
       
   370         TPtr testCaseArgsPtr( iTestCaseArgs->Des() );
       
   371         TRAP( ret, iTestExeMessage.Read( 1, testCaseArgsPtr ) );
       
   372         if ( ret != KErrNone )
       
   373             {
       
   374             _LIT(KRunError,"Can't read test case arguments");
       
   375             __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) );
       
   376             CompleteTestExecution( KErrNone,
       
   377                                    TFullTestResult::ECaseException,
       
   378                                    ret,
       
   379                                    KErrGeneral,
       
   380                                    KRunError );
       
   381             return KErrNone;
       
   382             }
       
   383         }
   345 
   384 
   346     // Get a test module, which executes the test case.
   385     // Get a test module, which executes the test case.
   347     // The test module will be freed either when the test case
   386     // The test module will be freed either when the test case
   348     // completes, or the test case is aborted.
   387     // completes, or the test case is aborted.
   349     TInt ret = iModuleSession->GetTestModule( iModuleContainer, iConfig );
   388     ret = iModuleSession->GetTestModule( iModuleContainer, iConfig );
   350     if ( ret != KErrNone || iModuleContainer == NULL )
   389     if ( ret != KErrNone || iModuleContainer == NULL )
   351         {
   390         {
   352         _LIT(KRunError,"Can't get test module");
   391         _LIT(KRunError,"Can't get test module");
   353         __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) );
   392         __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) );
   354         CompleteTestExecution( KErrNone,
   393         CompleteTestExecution( KErrNone,
  2115 /*
  2154 /*
  2116 -------------------------------------------------------------------------------
  2155 -------------------------------------------------------------------------------
  2117 
  2156 
  2118     Class: CTestExecution
  2157     Class: CTestExecution
  2119 
  2158 
       
  2159     Method: GetTestCaseArguments
       
  2160 
       
  2161     Description: Get test case arguments
       
  2162 
       
  2163     Parameters: None
       
  2164 
       
  2165     Return Values: Test case arguments
       
  2166 
       
  2167     Errors/Exceptions: None
       
  2168 
       
  2169     Status: Proposal
       
  2170 
       
  2171 -------------------------------------------------------------------------------
       
  2172 */
       
  2173 const TDesC& CTestExecution::GetTestCaseArguments() const
       
  2174     {
       
  2175     if ( iTestCaseArgs != NULL )
       
  2176         {
       
  2177         return *iTestCaseArgs;
       
  2178         }
       
  2179     return KNullDesC;
       
  2180     }
       
  2181 
       
  2182 /*
       
  2183 -------------------------------------------------------------------------------
       
  2184 
       
  2185     Class: CTestExecution
       
  2186 
  2120     Method: CancelTestRequest
  2187     Method: CancelTestRequest
  2121 
  2188 
  2122     Description: Cancel test execution request.
  2189     Description: Cancel test execution request.
  2123     If thread is not in OnGoing state, function does not do anything.
  2190     If thread is not in OnGoing state, function does not do anything.
  2124 
  2191