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