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