mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/src/playbackhelpertest.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     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:  Description
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 4 %
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <Stiftestinterface.h>
       
    25 #include <SettingServerClient.h>
       
    26 #include <mediarecognizer.h>
       
    27 #include <streaminglinkmodel.h>
       
    28 #include <devsoundif.h>
       
    29 
       
    30 #include "playbackhelpertest.h"
       
    31 
       
    32 // EXTERNAL DATA STRUCTURES
       
    33 //extern  ?external_data;
       
    34 
       
    35 // EXTERNAL FUNCTION PROTOTYPES  
       
    36 //extern ?external_function( ?arg_type,?arg_type );
       
    37 
       
    38 // CONSTANTS
       
    39 //const ?type ?constant_var = ?constant;
       
    40 
       
    41 // MACROS
       
    42 //#define ?macro ?macro_def
       
    43 
       
    44 // LOCAL CONSTANTS AND MACROS
       
    45 //const ?type ?constant_var = ?constant;
       
    46 //#define ?macro_name ?macro_def
       
    47 
       
    48 // MODULE DATA STRUCTURES
       
    49 //enum ?declaration
       
    50 //typedef ?declaration
       
    51 
       
    52 // LOCAL FUNCTION PROTOTYPES
       
    53 //?type ?function_name( ?arg_type, ?arg_type );
       
    54 
       
    55 // FORWARD DECLARATIONS
       
    56 //class ?FORWARD_CLASSNAME;
       
    57 
       
    58 // ============================= LOCAL FUNCTIONS ===================================================
       
    59 
       
    60 // -------------------------------------------------------------------------------------------------
       
    61 // ?function_name ?description.
       
    62 // ?description
       
    63 // Returns: ?value_1: ?description
       
    64 //          ?value_n: ?description_line1
       
    65 //                    ?description_line2
       
    66 // -------------------------------------------------------------------------------------------------
       
    67 //
       
    68 /*
       
    69 ?type ?function_name(
       
    70     ?arg_type arg,  // ?description
       
    71     ?arg_type arg)  // ?description
       
    72     {
       
    73 
       
    74     ?code  // ?comment
       
    75 
       
    76     // ?comment
       
    77     ?code
       
    78     }
       
    79 */
       
    80 
       
    81 // ============================ MEMBER FUNCTIONS ===================================================
       
    82 
       
    83 // -------------------------------------------------------------------------------------------------
       
    84 // CPlaybackHelperTest::CPlaybackHelperTest
       
    85 // C++ default constructor can NOT contain any code, that
       
    86 // might leave.
       
    87 // -------------------------------------------------------------------------------------------------
       
    88 //
       
    89 CPlaybackHelperTest::CPlaybackHelperTest( CTestModuleIf& aTestModuleIf )
       
    90 : CScriptBase( aTestModuleIf )  
       
    91 {
       
    92 //      iFileMan = NULL;
       
    93 }
       
    94 
       
    95 // -------------------------------------------------------------------------------------------------
       
    96 // CPlaybackHelperTest::ConstructL
       
    97 // Symbian 2nd phase constructor can leave.
       
    98 // -------------------------------------------------------------------------------------------------
       
    99 //
       
   100 void CPlaybackHelperTest::ConstructL()
       
   101 {
       
   102     //Read logger settings to check whether test case name is to be
       
   103     //appended to log file name.
       
   104     RSettingServer settingServer;
       
   105     TInt ret = settingServer.Connect();
       
   106     if(ret != KErrNone)
       
   107     {
       
   108         User::Leave(ret);
       
   109     }
       
   110     // Struct to StifLogger settigs.
       
   111     TLoggerSettings loggerSettings; 
       
   112     // Parse StifLogger defaults from STIF initialization file.
       
   113     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   114     if(ret != KErrNone)
       
   115     {
       
   116         User::Leave(ret);
       
   117     } 
       
   118     // Close Setting server session
       
   119     settingServer.Close();
       
   120 
       
   121     TFileName logFileName;
       
   122     
       
   123     if(loggerSettings.iAddTestCaseTitle)
       
   124     {
       
   125         TName title;
       
   126         TestModuleIf().GetTestCaseTitleL(title);
       
   127         logFileName.Format(KPlaybackHelperTestLogFileWithTitle, &title);
       
   128     }
       
   129     else
       
   130     {
       
   131         logFileName.Copy(KPlaybackHelperTestLogFile);
       
   132     }
       
   133 
       
   134     iLog = CStifLogger::NewL( KPlaybackHelperTestLogPath, 
       
   135                               logFileName,
       
   136                               CStifLogger::ETxt,
       
   137                               CStifLogger::EFile,
       
   138                               EFalse );
       
   139 
       
   140     iMediaRecognizer = CMediaRecognizer::NewL();
       
   141     iStreamingLinkModel = CStreamingLinkModel::NewL();
       
   142 	iDevSoundIf = CDevSoundIf::NewL();
       
   143 
       
   144     SendTestClassVersion();
       
   145 }
       
   146 
       
   147 // -------------------------------------------------------------------------------------------------
       
   148 // CPlaybackHelperTest::NewL
       
   149 // Two-phased constructor.
       
   150 // -------------------------------------------------------------------------------------------------
       
   151 //
       
   152 CPlaybackHelperTest* CPlaybackHelperTest::NewL( CTestModuleIf& aTestModuleIf )
       
   153 {
       
   154     CPlaybackHelperTest* self = new (ELeave) CPlaybackHelperTest( aTestModuleIf );
       
   155 
       
   156     CleanupStack::PushL( self );
       
   157     self->ConstructL();
       
   158     CleanupStack::Pop();
       
   159 
       
   160     return self;
       
   161 
       
   162 }
       
   163 
       
   164 // Destructor
       
   165 CPlaybackHelperTest::~CPlaybackHelperTest()
       
   166 { 
       
   167     if ( iMediaRecognizer )
       
   168     {
       
   169         delete iMediaRecognizer;
       
   170         iMediaRecognizer = NULL;
       
   171     }
       
   172 
       
   173     if ( iStreamingLinkModel )
       
   174     {
       
   175         delete iStreamingLinkModel;
       
   176         iStreamingLinkModel = NULL;
       
   177     }
       
   178 
       
   179     if ( iDevSoundIf )
       
   180     {
       
   181         delete iDevSoundIf;
       
   182         iDevSoundIf = NULL;
       
   183     }
       
   184 
       
   185     REComSession::FinalClose();
       
   186 
       
   187     // Delete resources allocated from test methods
       
   188     Delete();
       
   189 
       
   190     // Delete logger
       
   191     if ( iLog )
       
   192     {
       
   193         delete iLog;
       
   194         iLog = NULL;
       
   195     }
       
   196 }
       
   197 
       
   198 //--------------------------------------------------------------------------------------------------
       
   199 // CPlaybackHelperTest::SendTestClassVersion
       
   200 // Method used to send version of test class
       
   201 //--------------------------------------------------------------------------------------------------
       
   202 //
       
   203 void CPlaybackHelperTest::SendTestClassVersion()
       
   204 {
       
   205 	TVersion moduleVersion;
       
   206 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   207 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   208 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   209 	
       
   210 	TFileName moduleName;
       
   211 	moduleName = _L("playbackhelpertest.dll");
       
   212 
       
   213 	TBool newVersionOfMethod = ETrue;
       
   214 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   215 }
       
   216 
       
   217 // ========================== OTHER EXPORTED FUNCTIONS =============================================
       
   218 
       
   219 // -------------------------------------------------------------------------------------------------
       
   220 // LibEntryL is a polymorphic Dll entry point.
       
   221 // Returns: CScriptBase: New CScriptBase derived object
       
   222 // -------------------------------------------------------------------------------------------------
       
   223 //
       
   224 EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf )
       
   225 {
       
   226     return ( CScriptBase* ) CPlaybackHelperTest::NewL( aTestModuleIf );
       
   227 }
       
   228 
       
   229 //  End of File