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