mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/src/videoplaylistutilitytest.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     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:  videoplaylistutility test class for STIF testing
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 2 %
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <Stiftestinterface.h>
       
    23 #include <ecom.h>
       
    24 #include "videoplaylistutilitytest.h"
       
    25 #include <SettingServerClient.h>
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // Cvideoplaylistutility_test::Cvideoplaylistutility_test
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 Cvideoplaylistutility_test::Cvideoplaylistutility_test( CTestModuleIf& aTestModuleIf )
       
    36     : CScriptBase( aTestModuleIf )
       
    37 {
       
    38 }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // Cvideoplaylistutility_test::ConstructL
       
    42 // Symbian 2nd phase constructor can leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void Cvideoplaylistutility_test::ConstructL()
       
    46 {
       
    47     //Read logger settings to check whether test case name is to be
       
    48     //appended to log file name.
       
    49     RSettingServer settingServer;
       
    50 
       
    51     TInt ret = settingServer.Connect();
       
    52 
       
    53     if ( ret != KErrNone )
       
    54     {
       
    55         User::Leave(ret);
       
    56     }
       
    57 
       
    58     // Struct to StifLogger settigs.
       
    59     TLoggerSettings loggerSettings;
       
    60 
       
    61     // Parse StifLogger defaults from STIF initialization file.
       
    62     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    63 
       
    64     if ( ret != KErrNone )
       
    65     {
       
    66         User::Leave(ret);
       
    67     }
       
    68 
       
    69     // Close Setting server session
       
    70     settingServer.Close();
       
    71 
       
    72     TFileName logFileName;
       
    73 
       
    74     if ( loggerSettings.iAddTestCaseTitle )
       
    75     {
       
    76         TName title;
       
    77         TestModuleIf().GetTestCaseTitleL(title);
       
    78         logFileName.Format(Kvideoplaylistutility_testLogFileWithTitle, &title);
       
    79     }
       
    80     else
       
    81     {
       
    82         logFileName.Copy(Kvideoplaylistutility_testLogFile);
       
    83     }
       
    84 
       
    85     iLog = CStifLogger::NewL( Kvideoplaylistutility_testLogPath,
       
    86                               logFileName,
       
    87                               CStifLogger::ETxt,
       
    88                               CStifLogger::EFile,
       
    89                               EFalse );
       
    90 
       
    91     SendTestClassVersion();
       
    92 }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // Cvideoplaylistutility_test::NewL
       
    96 // Two-phased constructor.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 Cvideoplaylistutility_test* Cvideoplaylistutility_test::NewL( CTestModuleIf& aTestModuleIf )
       
   100 {
       
   101     Cvideoplaylistutility_test* self = new (ELeave) Cvideoplaylistutility_test( aTestModuleIf );
       
   102 
       
   103     CleanupStack::PushL( self );
       
   104     self->ConstructL();
       
   105     CleanupStack::Pop();
       
   106 
       
   107     return self;
       
   108 }
       
   109 
       
   110 // Destructor
       
   111 Cvideoplaylistutility_test::~Cvideoplaylistutility_test()
       
   112 {
       
   113     // Delete resources allocated from test methods
       
   114     Delete();
       
   115 
       
   116     // Delete logger
       
   117     delete iLog;
       
   118 
       
   119     REComSession::FinalClose();
       
   120 }
       
   121 
       
   122 //-----------------------------------------------------------------------------
       
   123 // Cvideoplaylistutility_test::SendTestClassVersion
       
   124 // Method used to send version of test class
       
   125 //-----------------------------------------------------------------------------
       
   126 //
       
   127 void Cvideoplaylistutility_test::SendTestClassVersion()
       
   128 {
       
   129     TVersion moduleVersion;
       
   130     moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   131     moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   132     moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   133 
       
   134     TFileName moduleName;
       
   135     moduleName = _L("videoplaylistutility_test.dll");
       
   136 
       
   137     TBool newVersionOfMethod = ETrue;
       
   138     TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   139 }
       
   140 
       
   141 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // LibEntryL is a polymorphic Dll entry point.
       
   145 // Returns: CScriptBase: New CScriptBase derived object
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf )
       
   149 {
       
   150     return ( CScriptBase* ) Cvideoplaylistutility_test::NewL( aTestModuleIf );
       
   151 }
       
   152 
       
   153 //  End of File