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