gstreamer_core/tsrc/gstreamertestcases/src/GstreamerTestCases.cpp
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
equal deleted inserted replaced
29:567bb019e3e3 30:7e817e7e631c
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
       
     3 *
       
     4 * This library is free software; you can redistribute it and/or
       
     5 * modify it under the terms of the GNU Lesser General Public
       
     6 * License as published by the Free Software Foundation; either
       
     7 * version 2 of the License, or (at your option) any later version.
       
     8 *
       
     9 * This library is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12 * Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public
       
    15 * License along with this library; if not, write to the
       
    16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    17 * Boston, MA 02111-1307, USA.
       
    18 *
       
    19 * Description: This file contains testclass implementation.
       
    20 *
       
    21 */
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <StifTestInterface.h>
       
    25 #include "GstreamerTestCases.h"
       
    26 #include <SettingServerClient.h>
       
    27 
       
    28 // EXTERNAL DATA STRUCTURES
       
    29 //extern  ?external_data;
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 //extern ?external_function( ?arg_type,?arg_type );
       
    33 
       
    34 // CONSTANTS
       
    35 //const ?type ?constant_var = ?constant;
       
    36 
       
    37 // MACROS
       
    38 //#define ?macro ?macro_def
       
    39 
       
    40 // LOCAL CONSTANTS AND MACROS
       
    41 //const ?type ?constant_var = ?constant;
       
    42 //#define ?macro_name ?macro_def
       
    43 
       
    44 // MODULE DATA STRUCTURES
       
    45 //enum ?declaration
       
    46 //typedef ?declaration
       
    47 
       
    48 // LOCAL FUNCTION PROTOTYPES
       
    49 //?type ?function_name( ?arg_type, ?arg_type );
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 //class ?FORWARD_CLASSNAME;
       
    53 
       
    54 // ============================= LOCAL FUNCTIONS ===============================
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // ?function_name ?description.
       
    58 // ?description
       
    59 // Returns: ?value_1: ?description
       
    60 //          ?value_n: ?description_line1
       
    61 //                    ?description_line2
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 /*
       
    65 ?type ?function_name(
       
    66     ?arg_type arg,  // ?description
       
    67     ?arg_type arg)  // ?description
       
    68     {
       
    69 
       
    70     ?code  // ?comment
       
    71 
       
    72     // ?comment
       
    73     ?code
       
    74     }
       
    75 */
       
    76 
       
    77 // ============================ MEMBER FUNCTIONS ===============================
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CGstreamerTestCases::CGstreamerTestCases
       
    81 // C++ default constructor can NOT contain any code, that
       
    82 // might leave.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CGstreamerTestCases::CGstreamerTestCases( 
       
    86     CTestModuleIf& aTestModuleIf ):
       
    87         CScriptBase( aTestModuleIf )
       
    88     {
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CGstreamerTestCases::ConstructL
       
    93 // Symbian 2nd phase constructor can leave.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CGstreamerTestCases::ConstructL()
       
    97     {
       
    98     //Read logger settings to check whether test case name is to be
       
    99     //appended to log file name.
       
   100     RSettingServer settingServer;
       
   101     TInt ret = settingServer.Connect();
       
   102     if(ret != KErrNone)
       
   103         {
       
   104         User::Leave(ret);
       
   105         }
       
   106     // Struct to StifLogger settigs.
       
   107     TLoggerSettings loggerSettings; 
       
   108     // Parse StifLogger defaults from STIF initialization file.
       
   109     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   110     if(ret != KErrNone)
       
   111         {
       
   112         User::Leave(ret);
       
   113         } 
       
   114     // Close Setting server session
       
   115     settingServer.Close();
       
   116 
       
   117     TFileName logFileName;
       
   118     
       
   119     if(loggerSettings.iAddTestCaseTitle)
       
   120         {
       
   121         TName title;
       
   122         TestModuleIf().GetTestCaseTitleL(title);
       
   123         logFileName.Format(KGstreamerTestCasesLogFileWithTitle, &title);
       
   124         }
       
   125     else
       
   126         {
       
   127         logFileName.Copy(KGstreamerTestCasesLogFile);
       
   128         }
       
   129 
       
   130     iLog = CStifLogger::NewL( KGstreamerTestCasesLogPath, 
       
   131                           logFileName,
       
   132                           CStifLogger::ETxt,
       
   133                           CStifLogger::EFile,
       
   134                           EFalse );
       
   135     
       
   136     SendTestClassVersion();
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CGstreamerTestCases::NewL
       
   141 // Two-phased constructor.
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 CGstreamerTestCases* CGstreamerTestCases::NewL( 
       
   145     CTestModuleIf& aTestModuleIf )
       
   146     {
       
   147     CGstreamerTestCases* self = new (ELeave) CGstreamerTestCases( aTestModuleIf );
       
   148 
       
   149     CleanupStack::PushL( self );
       
   150     self->ConstructL();
       
   151     CleanupStack::Pop();
       
   152 
       
   153     return self;
       
   154 
       
   155     }
       
   156 
       
   157 // Destructor
       
   158 CGstreamerTestCases::~CGstreamerTestCases()
       
   159     { 
       
   160 
       
   161     // Delete resources allocated from test methods
       
   162     Delete();
       
   163 
       
   164     // Delete logger
       
   165     delete iLog; 
       
   166 
       
   167     }
       
   168 
       
   169 //-----------------------------------------------------------------------------
       
   170 // CGstreamerTestCases::SendTestClassVersion
       
   171 // Method used to send version of test class
       
   172 //-----------------------------------------------------------------------------
       
   173 //
       
   174 void CGstreamerTestCases::SendTestClassVersion()
       
   175 	{
       
   176 	TVersion moduleVersion;
       
   177 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   178 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   179 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   180 	
       
   181 	TFileName moduleName;
       
   182 	moduleName = _L("GstreamerTestCases.dll");
       
   183 
       
   184 	TBool newVersionOfMethod = ETrue;
       
   185 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   186 	}
       
   187 
       
   188 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // LibEntryL is a polymorphic Dll entry point.
       
   192 // Returns: CScriptBase: New CScriptBase derived object
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 EXPORT_C CScriptBase* LibEntryL( 
       
   196     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   197     {
       
   198 
       
   199     return ( CScriptBase* ) CGstreamerTestCases::NewL( aTestModuleIf );
       
   200 
       
   201     }
       
   202 
       
   203 
       
   204 //  End of File