testexecfw/stf/stffw/testengine/src/TestEngineClient.cpp
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     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 module contains implementation of 
       
    15 * RTestEngineServer class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32svr.h>
       
    21 
       
    22 #include "TestEngineClient.h"
       
    23 #include "TestEngineClientServer.h"
       
    24 
       
    25 // EXTERNAL DATA STRUCTURES
       
    26 // None
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES  
       
    29 // None
       
    30 
       
    31 // CONSTANTS
       
    32 const TInt KServerRetryCount = 5;
       
    33 
       
    34 // MACROS
       
    35 // None
       
    36 
       
    37 // LOCAL CONSTANTS AND MACROS
       
    38 // None
       
    39 
       
    40 // MODULE DATA STRUCTURES
       
    41 // None
       
    42 
       
    43 // LOCAL FUNCTION PROTOTYPES
       
    44 // None
       
    45 
       
    46 // FORWARD DECLARATIONS
       
    47 // None
       
    48 
       
    49 // ==================== LOCAL FUNCTIONS =======================================
       
    50 // None
       
    51 
       
    52 // ================= MEMBER FUNCTIONS =========================================
       
    53 
       
    54 /**
       
    55  * Starts TestEngine server process and waits untill TestEngineServer ir ready
       
    56  */
       
    57 static TInt StartTestEngineServer()
       
    58     {
       
    59     const TUidType testEngineServerUid( KNullUid, KNullUid, KTestEngineServerUid3 );
       
    60     RProcess testEngineServerProcess;
       
    61     TInt ret = testEngineServerProcess.Create( KTestEngineServerExe,
       
    62             KNullDesC, testEngineServerUid );
       
    63     if ( ret != KErrNone )
       
    64         return ret;
       
    65     
       
    66     TRequestStatus status;
       
    67     testEngineServerProcess.Rendezvous( status );
       
    68     if ( status != KRequestPending )
       
    69         {
       
    70         testEngineServerProcess.Kill(0);     // abort startup
       
    71         }
       
    72     else
       
    73         {
       
    74         testEngineServerProcess.Resume();    // logon OK - start the server
       
    75         }
       
    76     
       
    77     User::WaitForRequest( status );     // wait for start or death
       
    78     // we can't use the 'exit reason' if the server panicked as this
       
    79     // is the panic 'reason' and may be '0' which cannot be distinguished
       
    80     // from KErrNone
       
    81     ret = ( testEngineServerProcess.ExitType() == EExitPanic ) ? KErrGeneral : status.Int();
       
    82     testEngineServerProcess.Close();
       
    83     
       
    84     return ret;
       
    85     }
       
    86 
       
    87 /*
       
    88 -------------------------------------------------------------------------------
       
    89 
       
    90     Class: RTestEngineServer
       
    91 
       
    92     Method: Connect
       
    93 
       
    94     Description: Connect method creates new RTestEngineServer session.
       
    95 
       
    96     RTestEngineServer session is used to manage the test case execution.
       
    97 
       
    98     Parameters: None
       
    99 
       
   100     Return Values: TInt KErrNone : TestEngineServer created successfully
       
   101 
       
   102     Errors/Exceptions: None
       
   103 
       
   104     Status: Approved
       
   105 
       
   106 -------------------------------------------------------------------------------
       
   107 */
       
   108 EXPORT_C TInt RTestEngine::Connect()
       
   109     {
       
   110     TInt retry = KServerRetryCount;
       
   111     for (;;)
       
   112         {
       
   113         TInt ret = CreateSession( KTestEngineServerName, Version() );
       
   114         if ( ret != KErrNotFound && ret != KErrServerTerminated )
       
   115             {
       
   116             return ret;
       
   117             }
       
   118 
       
   119         if ( --retry == 0 )
       
   120             {
       
   121             return ret;
       
   122             }
       
   123         
       
   124         ret = StartTestEngineServer();
       
   125         if ( ret != KErrNone && ret != KErrAlreadyExists )
       
   126             {
       
   127             return ret;
       
   128             }
       
   129         }
       
   130     }
       
   131 
       
   132 /*
       
   133 -------------------------------------------------------------------------------
       
   134 
       
   135     Class: RTestEngineServer
       
   136 
       
   137     Method: Version
       
   138 
       
   139     Description: Return client side version number from RTestEngineServer.
       
   140 
       
   141     Parameters: None
       
   142 
       
   143     Return Values: TVersion : Version number from RTestEngineServer
       
   144 
       
   145     Errors/Exceptions: None
       
   146 
       
   147     Status: Approved
       
   148 
       
   149 -------------------------------------------------------------------------------
       
   150 */
       
   151 EXPORT_C TVersion RTestEngine::Version() const
       
   152     {
       
   153     return ( TVersion( KTestEngineMajorVersionNumber,
       
   154         KTestEngineMinorVersionNumber, KTestEngineBuildVersionNumber ) );
       
   155 
       
   156     }
       
   157 
       
   158 /*
       
   159 -------------------------------------------------------------------------------
       
   160 
       
   161     Class: RTestEngineServer
       
   162 
       
   163     Method: Close
       
   164 
       
   165     Description: Closes the RTestEngineServer session.
       
   166 
       
   167     Parameters: None
       
   168 
       
   169     Return Values: None
       
   170 
       
   171     Errors/Exceptions: None
       
   172 
       
   173     Status: Approved
       
   174 
       
   175 -------------------------------------------------------------------------------
       
   176 */
       
   177 EXPORT_C void RTestEngine::Close()
       
   178     {
       
   179     RSessionBase::Close();
       
   180     }
       
   181 
       
   182 /*
       
   183 -------------------------------------------------------------------------------
       
   184 
       
   185     DESCRIPTION
       
   186 
       
   187     This module contains implementation of RTestEngine class member functions.
       
   188 
       
   189 -------------------------------------------------------------------------------
       
   190 */
       
   191 
       
   192 // ================= MEMBER FUNCTIONS =========================================
       
   193 
       
   194 /*
       
   195 -------------------------------------------------------------------------------
       
   196 
       
   197     Class: RTestEngine
       
   198 
       
   199     Method: Open
       
   200 
       
   201     Description: Open creates a subsession to TestEngine.
       
   202 
       
   203     Parameters: RTestEngineServer& aServer : Handle to Test Engine Server
       
   204                 const TFileName& aIniFile : Ini file to be used for 
       
   205                  initialization of the Test Engine
       
   206 
       
   207     Return Values: TInt: Symbian OS error code
       
   208 
       
   209     Errors/Exceptions: None
       
   210 
       
   211     Status: Approved
       
   212 
       
   213 -------------------------------------------------------------------------------
       
   214 */
       
   215 EXPORT_C TInt RTestEngine::LoadConfiguration( const TFileName& aIniFile )
       
   216     {
       
   217     TIpcArgs args( &aIniFile, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   218     return SendReceive( ETestEngineLoadConfiguration, args );
       
   219     }
       
   220 
       
   221 
       
   222 
       
   223 EXPORT_C TInt RTestEngine::UpdateLogConfiguration(TDesC& aLogConfigList)
       
   224     {
       
   225     TIpcArgs args( &aLogConfigList, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   226     return SendReceive( ETestEngineUpdateLogConfiguration, args );
       
   227     }
       
   228 
       
   229 EXPORT_C TInt RTestEngine::UpdateEngineConfiguration(TDesC& aEngineConfigList)
       
   230     {
       
   231     TIpcArgs args( &aEngineConfigList, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   232     return SendReceive( ETestEngineUpdateEngineConfiguration, args );
       
   233     }
       
   234 
       
   235 
       
   236 /*
       
   237 -------------------------------------------------------------------------------
       
   238 
       
   239     Class: RTestEngine
       
   240 
       
   241     Method: SetAttribute
       
   242 
       
   243     Description: Sets attributes to Test Framework
       
   244 
       
   245     Parameters: TAttribute aAttribute: in: Attribute type
       
   246                 const TDesC& aValue: in: Attribute value
       
   247 
       
   248     Return Values: TInt: Symbian OS error code
       
   249 
       
   250     Errors/Exceptions: None
       
   251 
       
   252     Status: Proposal
       
   253 
       
   254 -------------------------------------------------------------------------------
       
   255 */
       
   256 EXPORT_C TInt RTestEngine::SetAttribute( TAttribute aAttribute,
       
   257                                           const TDesC& aValue )
       
   258     {
       
   259     TIpcArgs args( aAttribute, &aValue, TIpcArgs::ENothing );
       
   260     return SendReceive( ETestEngineSetAttribute, args );
       
   261     }
       
   262 
       
   263 /*
       
   264 -------------------------------------------------------------------------------
       
   265 
       
   266     Class: RTestEngine
       
   267 
       
   268     Method: AddTestModule
       
   269 
       
   270     Description: Load dynamically a new Test Module to the Test Framework.
       
   271 
       
   272     Parameters: const TName& aTestModule : Name of the Test Module to be added
       
   273                 const TFileName& aIniFile : Initialization file of Test Module
       
   274 
       
   275     Return Values: TInt: Symbian OS error code
       
   276 
       
   277     Errors/Exceptions: None
       
   278 
       
   279     Status: Approved
       
   280 
       
   281 -------------------------------------------------------------------------------
       
   282 */
       
   283 EXPORT_C TInt RTestEngine::AddTestModule( const TName& aTestModule,
       
   284                                           const TFileName& aIniFile )
       
   285     {
       
   286     TIpcArgs args( &aTestModule, &aIniFile, TIpcArgs::ENothing );
       
   287     return SendReceive( ETestEngineAddTestModule, args );
       
   288     }
       
   289 
       
   290 /*
       
   291 -------------------------------------------------------------------------------
       
   292 
       
   293     Class: RTestEngine
       
   294 
       
   295     Method: RemoveTestModule
       
   296 
       
   297     Description: Remove the existing Test Module from the Test Framework.
       
   298 
       
   299     Parameters: const TName& aTestModule : Name of the Test Module to be 
       
   300                                            removed
       
   301 
       
   302     Return Values: TInt: Symbian OS error code
       
   303 
       
   304     Errors/Exceptions: None
       
   305 
       
   306     Status: Approved
       
   307 
       
   308 -------------------------------------------------------------------------------
       
   309 */
       
   310 EXPORT_C TInt RTestEngine::RemoveTestModule( const TName& aTestModule )
       
   311     {
       
   312     TIpcArgs args( &aTestModule, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   313     return SendReceive( ETestEngineRemoveTestModule, args );
       
   314 
       
   315     }
       
   316 
       
   317 /*
       
   318 -------------------------------------------------------------------------------
       
   319 
       
   320     Class: RTestEngine
       
   321 
       
   322     Method: AddConfigFile
       
   323 
       
   324     Description: Add new config file to Test Module.
       
   325 
       
   326     Parameters: const TName& aTestModule : Name of Test Module where the config
       
   327                  file will be added
       
   328                 const TFileName& aConfigFile : Name of config file to be added
       
   329 
       
   330     Return Values: TInt: Symbian OS error code
       
   331 
       
   332     Errors/Exceptions: None
       
   333 
       
   334     Status: Approved
       
   335 
       
   336 -------------------------------------------------------------------------------
       
   337 */
       
   338 EXPORT_C TInt RTestEngine::AddConfigFile( const TName& aTestModule,
       
   339                                           const TFileName& aConfigFile )
       
   340     {
       
   341     TIpcArgs args( &aTestModule, &aConfigFile, TIpcArgs::ENothing );
       
   342     return SendReceive( ETestEngineAddConfigFile, args );
       
   343 
       
   344     }
       
   345 
       
   346 /*
       
   347 -------------------------------------------------------------------------------
       
   348 
       
   349     Class: RTestEngine
       
   350 
       
   351     Method: RemoveConfigFile
       
   352 
       
   353     Description: Remove config file from Test Module.
       
   354 
       
   355     Parameters: const TName& aTestModule : Test Module name
       
   356                 const TFileName& aConfigFile : Name of config file to be removed
       
   357 
       
   358     Return Values: TInt: Symbian OS error code
       
   359 
       
   360     Errors/Exceptions: None
       
   361 
       
   362     Status: Proposal
       
   363 
       
   364 -------------------------------------------------------------------------------
       
   365 */
       
   366 EXPORT_C TInt RTestEngine::RemoveConfigFile( const TName& aTestModule,
       
   367                                              const TFileName& aConfigFile )
       
   368     {
       
   369     TIpcArgs args( &aTestModule, &aConfigFile, TIpcArgs::ENothing );
       
   370     return SendReceive( ETestEngineRemoveConfigFile, args );
       
   371     }
       
   372 
       
   373 /*
       
   374 -------------------------------------------------------------------------------
       
   375 
       
   376     Class: RTestEngine
       
   377 
       
   378     Method: EnumerateTestCases
       
   379 
       
   380     Description: First phase of two-phased test case query operation.
       
   381 
       
   382     Test cases are inquired by two-phased operation calling first the 
       
   383     EnumerateTestCases method and then the GetTestCases. 
       
   384 
       
   385     Parameters: TInt& aCount : Test case count
       
   386                 TRequestStatus& aStatus : Request status
       
   387 
       
   388     Return Values: None
       
   389 
       
   390     Errors/Exceptions: None
       
   391 
       
   392     Status: Approved
       
   393 
       
   394 -------------------------------------------------------------------------------
       
   395 */
       
   396 EXPORT_C void RTestEngine::EnumerateTestCases( TCaseCount& aCount,
       
   397                                               TRequestStatus& aStatus )
       
   398     {
       
   399     TIpcArgs args( &aCount, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   400     SendReceive( ETestEngineEnumerateTestCases, args, aStatus );
       
   401     }
       
   402 
       
   403 /*
       
   404 -------------------------------------------------------------------------------
       
   405 
       
   406     Class: RTestEngine
       
   407 
       
   408     Method: GetTestCases
       
   409 
       
   410     Description: Second phase of two-phased test case query operation.
       
   411 
       
   412     GetTestCases retrieves test cases from Test Modules to aTestCases that is
       
   413     a list consisting of several TTestInfo objects.
       
   414 
       
   415     Parameters: CArrayFixFlat<TTestInfo>& aTestCaseBuffer : Test case array
       
   416 
       
   417     Return Values: TInt: Symbian OS error code
       
   418 
       
   419     Errors/Exceptions: None
       
   420 
       
   421     Status: Approved
       
   422 
       
   423 -------------------------------------------------------------------------------
       
   424 */
       
   425 EXPORT_C TInt RTestEngine::GetTestCases( 
       
   426                      CFixedFlatArray<TTestInfo>& aTestCaseBuffer )
       
   427     {
       
   428     // Construct and send message
       
   429     TIpcArgs args( &aTestCaseBuffer.Des(), TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   430     return SendReceive( ETestEngineGetTestCases, args );
       
   431 
       
   432     }
       
   433 
       
   434 /*
       
   435 -------------------------------------------------------------------------------
       
   436 
       
   437     Class: RTestEngine
       
   438 
       
   439     Method: ErrorNotification
       
   440 
       
   441     Description: Obtains error notifications from Test Engine and Test
       
   442     Servers via Test Engine.
       
   443 
       
   444     Parameters: TTestProgressPckg& aError : Error package
       
   445                 TRequestStatus& aStatus : Request status
       
   446 
       
   447     Return Values: None
       
   448 
       
   449     Errors/Exceptions: None
       
   450 
       
   451     Status: Approved
       
   452 
       
   453 -------------------------------------------------------------------------------
       
   454 */ 
       
   455 EXPORT_C void RTestEngine::ErrorNotification( TErrorNotificationPckg& aError,
       
   456                                               TRequestStatus& aStatus )
       
   457     {
       
   458     TIpcArgs args( &aError, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   459     SendReceive( ETestEngineErrorNotification, args, aStatus );
       
   460 
       
   461     }
       
   462 
       
   463 /*
       
   464 -------------------------------------------------------------------------------
       
   465 
       
   466     Class: RTestEngine
       
   467 
       
   468     Method: CancelAsyncRequest
       
   469 
       
   470     Description: Asynchronous requests can be canceled by this function.
       
   471 
       
   472     Parameters: TInt aReqToCancel : Request to be cancelled
       
   473 
       
   474     Return Values: TInt: Symbian OS error code
       
   475 
       
   476     Errors/Exceptions: None
       
   477 
       
   478     Status: Approved
       
   479 
       
   480 -------------------------------------------------------------------------------
       
   481 */
       
   482 EXPORT_C TInt RTestEngine::CancelAsyncRequest( TTestEngineAsyncRequest aReqToCancel )
       
   483     {
       
   484     TIpcArgs args;
       
   485     switch( aReqToCancel )
       
   486         {
       
   487         case EErrorNotification:
       
   488             args.Set( 0, ETestEngineErrorNotification );
       
   489             break;
       
   490         case EEvent:
       
   491             args.Set( 0, ETestEngineEvent );
       
   492             break;            
       
   493         default:
       
   494             return KErrUnknown;        
       
   495         }
       
   496     return SendReceive( ETestEngineCancelAsyncRequest, args );
       
   497     }
       
   498 
       
   499 /*
       
   500 -------------------------------------------------------------------------------
       
   501 
       
   502     Class: RTestEngine
       
   503 
       
   504     Method: Event
       
   505 
       
   506     Description: Used to control STIF Test Framework event system.
       
   507 
       
   508     Parameters: TEventIfPckg& aEvent : in : Event information
       
   509                  TRequestStatus& aStatus : in :  Request status
       
   510 
       
   511     Return Values: TInt KErrNone : No errors occurred
       
   512 
       
   513     Errors/Exceptions: None
       
   514 
       
   515     Status: Approved
       
   516 
       
   517 -------------------------------------------------------------------------------
       
   518 */
       
   519 EXPORT_C void RTestEngine::Event( TEventIfPckg& aEvent, 
       
   520                                   TRequestStatus& aStatus )
       
   521     {
       
   522     TIpcArgs args( &aEvent, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   523     SendReceive( ETestEngineEvent, args, aStatus );
       
   524 
       
   525     }
       
   526 
       
   527 /*
       
   528 -------------------------------------------------------------------------------
       
   529 
       
   530     Class: RTestEngine
       
   531 
       
   532     Method: OpenLoggerSession
       
   533 
       
   534     Description: Open created subsession to TestEngine.
       
   535 
       
   536     Parameters: RTestEngineServer& aServer : Handle to Test Engine Server
       
   537                 TLoggerSettings& aLoggerSettings: in: Logger's overwrite struct
       
   538 
       
   539     Return Values: TInt KErrNone: TestEngine opened and initialized
       
   540                                   succesfully
       
   541 
       
   542     Errors/Exceptions: None
       
   543 
       
   544     Status: Approved
       
   545 
       
   546 -------------------------------------------------------------------------------
       
   547 */
       
   548 EXPORT_C TInt RTestEngine::OpenLoggerSession( TLoggerSettings& aLoggerSettings )
       
   549     {
       
   550     // Package
       
   551     TPckg<TLoggerSettings> loggerSettingsPckg( aLoggerSettings );
       
   552 
       
   553     TIpcArgs args( &loggerSettingsPckg, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   554     // Goes to CTestEngine's DispatchMessageL() method
       
   555     
       
   556     return SendReceive( ETestEngineLoggerSettings, args );
       
   557     }
       
   558 
       
   559 /*
       
   560 -------------------------------------------------------------------------------
       
   561 
       
   562     Class: RTestEngine
       
   563 
       
   564     Method: AddTestCaseResultToTestReport
       
   565 
       
   566     Description: Sends info about executed test cases to test engine, which
       
   567                  will forward it to test report.
       
   568                  This is used when after reboot UIStore reads info about 
       
   569                  executed test cases before reboot.
       
   570 
       
   571     Parameters: TTestIngo& aTestInfo : test info structure
       
   572                 TFullTestResult& aTestResult: test result structure
       
   573                 TInt aError: error
       
   574 
       
   575     Return Values: TInt error code returned by test engine
       
   576 
       
   577     Errors/Exceptions: None
       
   578 
       
   579     Status: Approved
       
   580 
       
   581 -------------------------------------------------------------------------------
       
   582 */
       
   583 EXPORT_C TInt RTestEngine::AddTestCaseResultToTestReport(const TTestInfo& aTestInfo,
       
   584                                                          const TFullTestResult& aTestResult,
       
   585                                                          const TInt aError)
       
   586     {
       
   587     // Create packages
       
   588     TTestInfoPckg testInfoPckg(aTestInfo);
       
   589     TFullTestResultPckg fullTestResultPckg(aTestResult);
       
   590 
       
   591     // Create argument list
       
   592     TIpcArgs args(&testInfoPckg, &fullTestResultPckg, aError);
       
   593 
       
   594     // Send it to test engine
       
   595     TInt res = SendReceive(ETestEngineReportTestCase, args);
       
   596 
       
   597     return res;
       
   598     }
       
   599 
       
   600 
       
   601 /*
       
   602 -------------------------------------------------------------------------------
       
   603 
       
   604     DESCRIPTION
       
   605 
       
   606     This module contains implementation of RTestCase class member functions.
       
   607 
       
   608 -------------------------------------------------------------------------------
       
   609 */
       
   610 
       
   611 // ================= MEMBER FUNCTIONS =========================================
       
   612 
       
   613 /*
       
   614 -------------------------------------------------------------------------------
       
   615 
       
   616     Class: RTestCase
       
   617 
       
   618     Method: Open
       
   619 
       
   620     Description: Open creates a subsession to TestCase.
       
   621 
       
   622     Parameters: RTestEngineServer& aServer : Handle to Test Engine Server
       
   623                 const TTestInfoPckg& aTestCaseInfo : TTestInfoPckg : Test info
       
   624                                                                      package
       
   625 
       
   626     Return Values: TInt: Symbian OS error code
       
   627 
       
   628     Errors/Exceptions: None
       
   629 
       
   630     Status: Approved
       
   631 
       
   632 -------------------------------------------------------------------------------
       
   633 */
       
   634 EXPORT_C TInt RTestCase::Open( RTestEngine& aServer,
       
   635                               const TTestInfoPckg& aTestCaseInfo )
       
   636     {
       
   637     TIpcArgs args( &aTestCaseInfo, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   638     return CreateSubSession( aServer, ETestCaseCreateSubSession, args );
       
   639     }
       
   640 
       
   641 /*
       
   642 -------------------------------------------------------------------------------
       
   643 
       
   644     Class: RTestCase
       
   645 
       
   646     Method: Close
       
   647 
       
   648     Description: Close the RTestCase subsession.
       
   649 
       
   650     Parameters: None
       
   651 
       
   652     Return Values: None
       
   653 
       
   654     Errors/Exceptions: None
       
   655 
       
   656     Status: Approved
       
   657 
       
   658 -------------------------------------------------------------------------------
       
   659 */
       
   660 EXPORT_C void RTestCase::Close()
       
   661     {
       
   662     RSubSessionBase::CloseSubSession( ETestCaseCloseSubSession );
       
   663     }
       
   664 
       
   665 /*
       
   666 -------------------------------------------------------------------------------
       
   667 
       
   668     Class: RTestCase
       
   669 
       
   670     Method: RunTestCase
       
   671 
       
   672     Description: Run a test case asynchronously.
       
   673 
       
   674     Parameters: TFullTestResultPckg& aTestResult : TFullTestResult :
       
   675                  Test Result package
       
   676                 TRequestStatus& aStatus : Request status
       
   677 
       
   678     Return Values: TInt KErrNone : Test case could be run
       
   679                         Other error code : Reason the test case couldn't be run
       
   680 
       
   681     Errors/Exceptions: None
       
   682 
       
   683     Status: Approved
       
   684 
       
   685 -------------------------------------------------------------------------------
       
   686 */
       
   687 EXPORT_C void RTestCase::RunTestCase( TFullTestResultPckg& aTestResult,
       
   688                                      TRequestStatus& aStatus )
       
   689     {
       
   690     TIpcArgs args( &aTestResult, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   691     SendReceive( ETestCaseRunTestCase, args, aStatus );
       
   692     }
       
   693 
       
   694 /*
       
   695 -------------------------------------------------------------------------------
       
   696 
       
   697     Class: RTestCase
       
   698 
       
   699     Method: Pause
       
   700 
       
   701     Description: Pause suspends the execution of the test case.
       
   702 
       
   703     Parameters: None
       
   704 
       
   705     Return Values: TInt: Symbian OS error code
       
   706 
       
   707     Errors/Exceptions: None
       
   708 
       
   709     Status: Approved
       
   710 
       
   711 -------------------------------------------------------------------------------
       
   712 */
       
   713 EXPORT_C TInt RTestCase::Pause()
       
   714     {
       
   715     TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   716     return SendReceive( ETestCasePause, args );
       
   717     }
       
   718 
       
   719 /*
       
   720 -------------------------------------------------------------------------------
       
   721 
       
   722     Class: RTestCase
       
   723 
       
   724     Method: Resume
       
   725 
       
   726     Description: Resume the test case suspended previously.
       
   727 
       
   728     Parameters: None
       
   729 
       
   730     Return Values: TInt: Symbian OS error code
       
   731 
       
   732     Errors/Exceptions: None
       
   733 
       
   734     Status: Approved
       
   735 
       
   736 -------------------------------------------------------------------------------
       
   737 */
       
   738 EXPORT_C TInt RTestCase::Resume()
       
   739     {
       
   740     TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   741     return SendReceive( ETestCaseResume, args );
       
   742     }
       
   743 
       
   744 /*
       
   745 -------------------------------------------------------------------------------
       
   746 
       
   747     Class: RTestCase
       
   748 
       
   749     Method: NotifyProgress
       
   750 
       
   751     Description: Request different progress information from the test case.
       
   752 
       
   753     Parameters: TTestProgressPckg& aProgress : TTestProgress : Test Progress
       
   754                                                                package
       
   755                 TRequestStatus& aStatus : Request status
       
   756 
       
   757     Return Values: None
       
   758 
       
   759     Errors/Exceptions: None
       
   760 
       
   761     Status: Approved
       
   762 
       
   763 -------------------------------------------------------------------------------
       
   764 */
       
   765 EXPORT_C void RTestCase::NotifyProgress( TTestProgressPckg& aProgress,
       
   766                                          TRequestStatus& aStatus )
       
   767     {
       
   768     TIpcArgs args( &aProgress, TIpcArgs::ENothing, TIpcArgs::ENothing );
       
   769     SendReceive( ETestCaseNotifyProgress, args, aStatus );
       
   770     }
       
   771     
       
   772 /*
       
   773 -------------------------------------------------------------------------------
       
   774 
       
   775     Class: RTestCase
       
   776 
       
   777     Method: NotifyRemoteType
       
   778 
       
   779     Description: Request remote commands information from the test case.
       
   780 
       
   781     Parameters: TRemoteCommandPckg& aType: in: Request type
       
   782                 TRequestStatus& aStatus : Request status
       
   783 
       
   784     Return Values: None
       
   785 
       
   786     Errors/Exceptions: None
       
   787 
       
   788     Status: Proposal
       
   789 
       
   790 -------------------------------------------------------------------------------
       
   791 */
       
   792 EXPORT_C void RTestCase::NotifyRemoteType( TStifCommandPckg& aType,
       
   793                                            TPckg<TInt>& aMsgSize,
       
   794                                            TRequestStatus& aStatus )
       
   795     {
       
   796     TIpcArgs args( &aType, &aMsgSize, TIpcArgs::ENothing );
       
   797     SendReceive( ETestCaseNotifyRemoteType, args, aStatus );
       
   798     }
       
   799 
       
   800 /*
       
   801 -------------------------------------------------------------------------------
       
   802 
       
   803     Class: RTestCase
       
   804 
       
   805     Method: NotifyRemoteMsg
       
   806 
       
   807     Description: Request remote commands information from the test case.
       
   808 
       
   809     Parameters: TDesC& aMessage: in: Message buffer
       
   810                 TRemoteCmdType aType: in: Message direction
       
   811 
       
   812     Return Values: None
       
   813 
       
   814     Errors/Exceptions: None
       
   815 
       
   816     Status: Proposal
       
   817 
       
   818 -------------------------------------------------------------------------------
       
   819 */
       
   820 EXPORT_C TInt RTestCase::NotifyRemoteMsg( TDes8& aMessage,
       
   821                                           TStifCommand aType )
       
   822     {
       
   823     TIpcArgs args( &aMessage, aType, aMessage.Length() );
       
   824     return SendReceive( ETestCaseNotifyRemoteMsg, args );
       
   825     }
       
   826 
       
   827 /*
       
   828 -------------------------------------------------------------------------------
       
   829 
       
   830     Class: RTestCase
       
   831 
       
   832     Method: CancelAsyncRequest
       
   833 
       
   834     Description: Asynchronous requests can be canceled by this function.
       
   835 
       
   836     Parameters: TInt aReqToCancel : Request to be cancelled
       
   837 
       
   838     Return Values: TInt: Symbian OS error code
       
   839 
       
   840     Errors/Exceptions: None
       
   841 
       
   842     Status: Approved
       
   843 
       
   844 -------------------------------------------------------------------------------
       
   845 */
       
   846 EXPORT_C TInt RTestCase::CancelAsyncRequest( TTestCaseAsyncRequest aReqToCancel )
       
   847     {
       
   848     TIpcArgs args;
       
   849     switch( aReqToCancel )
       
   850         {
       
   851         case ERunTestCase:
       
   852             args.Set( 0, ETestCaseRunTestCase );
       
   853             break;
       
   854         case ENotifyProgress:
       
   855             args.Set( 0, ETestCaseNotifyProgress );
       
   856             break;
       
   857         case ENotifyRemoteType:
       
   858             args.Set( 0, ETestCaseNotifyRemoteType );
       
   859             break;
       
   860         default:
       
   861             return KErrUnknown;        
       
   862         }
       
   863     return SendReceive( ETestCaseCancelAsyncRequest, args );
       
   864     }
       
   865 
       
   866 
       
   867 // ================= OTHER EXPORTED FUNCTIONS =================================
       
   868 
       
   869 // None
       
   870 
       
   871 // End of File