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