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