videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtest.cpp
changeset 0 96612d01cf9f
child 23 8f0df5c82986
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Test Harness for VideoHelix Playback Plugin
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 6 %
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include "stifutilities.h"
       
    24 #include "mpxvideoprivatecrkeys.h"
       
    25 #include "videohelixtest.h"
       
    26 #include "mpxvideoplayerutility_stub.h"
       
    27 #include "mpxvideohelixplayback.h"
       
    28 #include "mpxvideo_debug.h"
       
    29 
       
    30 #include <stiftestinterface.h>
       
    31 #include <settingserverclient.h>
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CVHPPTestClass::CVHPPTestClass
       
    37 // C++ default constructor can NOT contain any code, that
       
    38 // might leave.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CVHPPTestClass::CVHPPTestClass( CTestModuleIf& aTestModuleIf )
       
    42     : CScriptBase( aTestModuleIf )
       
    43     , iTestModuleIf( aTestModuleIf )
       
    44     , iFirstPlayCmd( ETrue )
       
    45 {
       
    46 }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CVHPPTestClass::ConstructL
       
    50 // Symbian 2nd phase constructor can leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 void CVHPPTestClass::ConstructL()
       
    54 {
       
    55     MPX_DEBUG(_L("CVHPPTestClass::ConstructL"));
       
    56 
       
    57     //
       
    58     //  Read logger settings to check whether test case name is to be
       
    59     //  appended to log file name.
       
    60     //
       
    61     RSettingServer settingServer;
       
    62 
       
    63     User::LeaveIfError( settingServer.Connect() );
       
    64 
       
    65     //
       
    66     //  Struct to StifLogger settigs.
       
    67     //
       
    68     TLoggerSettings loggerSettings;
       
    69 
       
    70     //
       
    71     //  Parse StifLogger defaults from STIF initialization file.
       
    72     //
       
    73     User::LeaveIfError( settingServer.GetLoggerSettings(loggerSettings) );
       
    74 
       
    75     //
       
    76     //  Close Setting server session
       
    77     //
       
    78     settingServer.Close();
       
    79 
       
    80     TFileName logFileName;
       
    81 
       
    82     if ( loggerSettings.iAddTestCaseTitle )
       
    83     {
       
    84         _LIT( KVHPPTestClassLogFileWithTitle, "VHPPTestClass_[%S].txt" );
       
    85 
       
    86         TName title;
       
    87         TestModuleIf().GetTestCaseTitleL(title);
       
    88         logFileName.Format( KVHPPTestClassLogFileWithTitle, &title );
       
    89     }
       
    90     else
       
    91     {
       
    92         _LIT( KVHPPTestClassLogFile, "VHPPTestClass.txt" );
       
    93 
       
    94         logFileName.Copy( KVHPPTestClassLogFile );
       
    95     }
       
    96 
       
    97     _LIT( KVHPPTestClassLogPath, "\\logs\\testframework\\VHPPTestClass\\" );
       
    98 
       
    99 
       
   100     iLog = CStifLogger::NewL( KVHPPTestClassLogPath,
       
   101                               logFileName,
       
   102                               CStifLogger::ETxt,
       
   103                               CStifLogger::EFile,
       
   104                               EFalse );
       
   105 
       
   106     TVersion moduleVersion;
       
   107 
       
   108     moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   109     moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   110     moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   111 
       
   112     TFileName moduleName;
       
   113 
       
   114     moduleName = _L("CVHPPTestClass.dll");
       
   115 
       
   116     TBool newVersionOfMethod = ETrue;
       
   117 
       
   118     TestModuleIf().SendTestModuleVersion( moduleVersion,
       
   119                                           moduleName,
       
   120                                           newVersionOfMethod );
       
   121 
       
   122     StifUtilities::CreateStifUtility();
       
   123 
       
   124     iAccObserver = CMPXVideoAccessoryObserver::NewL( NULL );
       
   125 
       
   126     iTimeoutController = CSimpleTimeout::NewL (this, iLog);
       
   127 
       
   128     iExpectedCallbackArray = new (ELeave) CArrayPtrFlat<TCallbackEvent>( 1 );
       
   129 
       
   130     //
       
   131     //  CenRep volume range is 0 - number of steps (either 10 or 20).
       
   132     //  Set default CenRep values as volume(4), mute(0)
       
   133     //
       
   134     CRepository* volCenRep = CRepository::NewL( KCRUidMPXVideoSettings );
       
   135     volCenRep->Set( KMPXVideoPlaybackVolume, 4 );
       
   136     volCenRep->Set( KMPXVideoPlaybackMute, 0 );
       
   137     delete volCenRep;
       
   138 
       
   139     //
       
   140     //  Create VideoHelix Playback Plugin for STIF testing
       
   141     //
       
   142     iPlaybackPlugin = CMPXVideoHelixPlayback::NewL( iLog );
       
   143 
       
   144     iPlayerUtility = CMpxVideoPlayerUtility::NewL( NULL );
       
   145     iPlayerUtility->AddStifObserver( this );
       
   146 }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CVHPPTestClass::NewL
       
   150 // Two-phased constructor.
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 CVHPPTestClass*
       
   154 CVHPPTestClass::NewL( CTestModuleIf& aTestModuleIf )
       
   155 {
       
   156     CVHPPTestClass* self =
       
   157         new (ELeave) CVHPPTestClass( aTestModuleIf );
       
   158 
       
   159     CleanupStack::PushL( self );
       
   160     self->ConstructL();
       
   161     CleanupStack::Pop();
       
   162 
       
   163     return self;
       
   164 }
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 //  Destructor
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 CVHPPTestClass::~CVHPPTestClass()
       
   171 {
       
   172     MPX_DEBUG(_L("CVHPPTestClass::~CVHPPTestClass()"));
       
   173 
       
   174     CleanupTempFiles();
       
   175 
       
   176     if ( iTimeoutController->IsActive() )
       
   177     {
       
   178         _LIT( KPanic, "Event Pending" );
       
   179         User::Panic( KPanic, -33 );
       
   180     }
       
   181 
       
   182     delete iTimeoutController;
       
   183 
       
   184     delete iPlaybackPlugin;
       
   185 
       
   186     REComSession::FinalClose();
       
   187 
       
   188     delete iLog;
       
   189 
       
   190     StifUtilities* utility = reinterpret_cast<StifUtilities*>( Dll::Tls() );
       
   191     delete utility;
       
   192     Dll::SetTls( NULL );
       
   193 }
       
   194 
       
   195 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   196 
       
   197 // -----------------------------------------------------------------------------
       
   198 //  LibEntryL is a polymorphic Dll entry point.
       
   199 //  Returns: CScriptBase: New CScriptBase derived object
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf )
       
   203 {
       
   204     return ( CScriptBase* ) CVHPPTestClass::NewL( aTestModuleIf );
       
   205 }
       
   206 
       
   207 //  End of File