os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/DataLoggerTest/DataLoggerUnitTest.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/DataLoggerTest/DataLoggerUnitTest.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,403 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// The unit test class definitions for the CDataLogger class.
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __DATALOGGERUNITTEST_H__
1.22 +#define __DATALOGGERUNITTEST_H__
1.23 +
1.24 +#include <ecom/test_bed/testbeddefinitions.h>
1.25 +#include "DataLoggerStateAccessor.h"
1.26 +#include "DataLoggerTransitionValidation.h"
1.27 +#include "DataLoggerTransitions.h"
1.28 +
1.29 +// ______________________________________________________________________________
1.30 +//
1.31 +/**
1.32 + @internalComponent
1.33 +
1.34 + Comments : Unit Test for CreateAndDestroy on CDataLogger, the class under test.
1.35 + */
1.36 +class CDataLogger_CreateAndDestroy_UnitTest : public CUnitTest
1.37 + {
1.38 +public:
1.39 + /**
1.40 + @fn NewL(CDataLogger& aDataLogger,
1.41 + MUnitTestObserver& aObserver)
1.42 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.43 + cleanup stack.
1.44 + Error Condition : Leaves with the error code.
1.45 + @leave KErrNoMemory
1.46 + @since 7.0
1.47 + @param aDataLogger The output logging object.
1.48 + @param aObserver The observer of this UnitTest.
1.49 + @return CDataLogger_CreateAndDestroy_UnitTest* The constructed object.
1.50 + @pre None.
1.51 + @post CDataLogger_CreateAndDestroy_UnitTest is fully constructed, and initialised.
1.52 + */
1.53 + static CDataLogger_CreateAndDestroy_UnitTest* NewL(CDataLogger& aDataLogger,
1.54 + MUnitTestObserver& aObserver);
1.55 +
1.56 + /**
1.57 + @fn RunError(TInt aError)
1.58 + Intended Usage : Intercept the panic caused by a RunL leave,
1.59 + to restore the CDataLogger_CreateAndDestroy_UnitTest
1.60 + object to a sensible state.
1.61 + (called by the Active Scheduler immediately before the Panic).
1.62 + Error Condition : @see CUnitTest::RunError().
1.63 + @since 7.0
1.64 + @return TInt KErrNone if cleanup successful, otherwise
1.65 + @see CUnitTest::RunError()
1.66 + @pre CDataLogger_CreateAndDestroy_UnitTest is fully constructed, and initialised.
1.67 + @post The object has been restored to a sensible state.
1.68 + */
1.69 + inline TInt RunError(TInt aError);
1.70 +
1.71 + /**
1.72 + @fn ~CDataLogger_CreateAndDestroy_UnitTest()
1.73 + Intended Usage : Standard Destructor.
1.74 + Error Condition : None.
1.75 + @since 7.0
1.76 + @pre CDataLogger_CreateAndDestroy_UnitTest is fully constructed.
1.77 + @post CDataLogger_CreateAndDestroy_UnitTest is fully destroyed.
1.78 + */
1.79 + ~CDataLogger_CreateAndDestroy_UnitTest();
1.80 +
1.81 +private:
1.82 + /**
1.83 + @fn CDataLogger_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
1.84 + MUnitTestObserver& aObserver)
1.85 + Intended Usage : Default constructor.
1.86 + Error Condition : None.
1.87 + @since 7.0
1.88 + @param aDataLogger The output logging object.
1.89 + @param aObserver The observer of this UnitTest.
1.90 + @param aStateAccessor WhiteBox state access to the CDataLogger class.
1.91 + @pre None.
1.92 + @post CDataLogger_CreateAndDestroy_UnitTest is fully constructed.
1.93 + */
1.94 + inline CDataLogger_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
1.95 + MUnitTestObserver& aObserver);
1.96 +
1.97 + /**
1.98 + @fn void ConstructL()
1.99 + Intended Usage : Second phase of safe two phase construction,
1.100 + to complete the object initialisation.
1.101 + Error Condition : Leaves with an error code.
1.102 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.103 + @since 7.0
1.104 + @return None
1.105 + @pre CDataLogger_CreateAndDestroy_UnitTest is fully constructed.
1.106 + @post CDataLogger_CreateAndDestroy_UnitTest is fully initialised.
1.107 + */
1.108 + void ConstructL();
1.109 +
1.110 + /**
1.111 + The context of the Unit Test.
1.112 + i.e The CDataLogger class tested by this UnitTest's transitions.
1.113 + */
1.114 + CDataLogger_UnitTestContext* iUTContext;
1.115 + TDataLogger_StateAccessor* iStateAccessor;
1.116 + // C'tor, d'tor, and method transition validators
1.117 + TDataLogger_Ctor_TransitionValidator* iCtorValidator;
1.118 + TDataLogger_Dtor_TransitionValidator* iDtorValidator;
1.119 + }; // CDataLogger_CreateAndDestroy_UnitTest
1.120 +
1.121 +// ______________________________________________________________________________
1.122 +//
1.123 +/**
1.124 + @internalComponent
1.125 +
1.126 + Comments : Unit Test for DumpMemoryBlock on CDataLogger, the class under test.
1.127 + */
1.128 +class CDataLogger_DumpMemoryBlock_UnitTest : public CUnitTest
1.129 + {
1.130 +public:
1.131 + /**
1.132 + @fn NewL(CDataLogger& aDataLogger,
1.133 + MUnitTestObserver& aObserver)
1.134 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.135 + cleanup stack.
1.136 + Error Condition : Leaves with the error code.
1.137 + @leave KErrNoMemory
1.138 + @since 7.0
1.139 + @param aDataLogger The output logging object.
1.140 + @param aObserver The observer of this UnitTest.
1.141 + @return CDataLogger_DumpMemoryBlock_UnitTest* The constructed object.
1.142 + @pre None.
1.143 + @post CDataLogger_DumpMemoryBlock_UnitTest is fully constructed, and initialised.
1.144 + */
1.145 + static CDataLogger_DumpMemoryBlock_UnitTest* NewL(CDataLogger& aDataLogger,
1.146 + MUnitTestObserver& aObserver);
1.147 +
1.148 + /**
1.149 + @fn RunError(TInt aError)
1.150 + Intended Usage : Intercept the panic caused by a RunL leave,
1.151 + to restore the CDataLogger_DumpMemoryBlock_UnitTest
1.152 + object to a sensible state.
1.153 + (called by the Active Scheduler immediately before the Panic).
1.154 + Error Condition : @see CUnitTest::RunError().
1.155 + @since 7.0
1.156 + @return KErrNone if cleanup successful, otherwise
1.157 + @see CUnitTest::RunError()
1.158 + @pre CDataLogger_DumpMemoryBlock_UnitTest is fully constructed, and initialised.
1.159 + @post The object has been restored to a sensible state.
1.160 + */
1.161 + inline TInt RunError(TInt aError);
1.162 +
1.163 + /**
1.164 + @fn ~CDataLogger_DumpMemoryBlock_UnitTest()
1.165 + Intended Usage : Standard Destructor.
1.166 + Error Condition : None.
1.167 + @since 7.0
1.168 + @pre CDataLogger_DumpMemoryBlock_UnitTest is fully constructed.
1.169 + @post CDataLogger_DumpMemoryBlock_UnitTest is fully destroyed.
1.170 + */
1.171 + ~CDataLogger_DumpMemoryBlock_UnitTest();
1.172 +
1.173 +private:
1.174 + /**
1.175 + @fn CDataLogger_DumpMemoryBlock_UnitTest(CDataLogger& aDataLogger,
1.176 + MUnitTestObserver& aObserver)
1.177 + Intended Usage : Default constructor.
1.178 + Error Condition : None.
1.179 + @since 7.0
1.180 + @param aDataLogger The output logging object.
1.181 + @param aObserver The observer of this UnitTest.
1.182 + @param aStateAccessor WhiteBox state access to the CDataLogger class.
1.183 + @pre None.
1.184 + @post CDataLogger_DumpMemoryBlock_UnitTest is fully constructed.
1.185 + */
1.186 + inline CDataLogger_DumpMemoryBlock_UnitTest(CDataLogger& aDataLogger,
1.187 + MUnitTestObserver& aObserver);
1.188 +
1.189 + /**
1.190 + @fn void ConstructL()
1.191 + Intended Usage : Second phase of safe two phase construction,
1.192 + to complete the object initialisation.
1.193 + Error Condition : Leaves with an error code.
1.194 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.195 + @since 7.0
1.196 + @return None
1.197 + @pre CDataLogger_DumpMemoryBlock_UnitTest is fully constructed.
1.198 + @post CDataLogger_DumpMemoryBlock_UnitTest is fully initialised.
1.199 + */
1.200 + void ConstructL();
1.201 +
1.202 + /**
1.203 + The context of the Unit Test.
1.204 + i.e The CDataLogger class tested by this UnitTest's transitions.
1.205 + */
1.206 + CDataLogger_UnitTestContext* iUTContext;
1.207 + TDataLogger_StateAccessor* iStateAccessor;
1.208 + // C'tor, d'tor, and method transition validators
1.209 + TDataLogger_Ctor_TransitionValidator* iCtorValidator;
1.210 + TDataLogger_DumpMemoryBlock_TransitionValidator* iDumpMemoryBlockValidator;
1.211 + TDataLogger_Dtor_TransitionValidator* iDtorValidator;
1.212 + }; // CDataLogger_DumpMemoryBlock_UnitTest
1.213 +
1.214 +// ______________________________________________________________________________
1.215 +//
1.216 +/**
1.217 + @internalComponent
1.218 +
1.219 + Comments : Unit Test for LogInformation on CDataLogger, the class under test.
1.220 + */
1.221 +class CDataLogger_LogInformation_UnitTest : public CUnitTest
1.222 + {
1.223 +public:
1.224 + /**
1.225 + @fn NewL(CDataLogger& aDataLogger,
1.226 + MUnitTestObserver& aObserver)
1.227 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.228 + cleanup stack.
1.229 + Error Condition : Leaves with the error code.
1.230 + @leave KErrNoMemory
1.231 + @since 7.0
1.232 + @param aDataLogger The output logging object.
1.233 + @param aObserver The observer of this UnitTest.
1.234 + @return CDataLogger_LogInformation_UnitTest* The constructed object.
1.235 + @pre None.
1.236 + @post CDataLogger_LogInformation_UnitTest is fully constructed, and initialised.
1.237 + */
1.238 + static CDataLogger_LogInformation_UnitTest* NewL(CDataLogger& aDataLogger,
1.239 + MUnitTestObserver& aObserver);
1.240 +
1.241 + /**
1.242 + @fn RunError(TInt aError)
1.243 + Intended Usage : Intercept the panic caused by a RunL leave,
1.244 + to restore the CDataLogger_LogInformation_UnitTest
1.245 + object to a sensible state.
1.246 + (called by the Active Scheduler immediately before the Panic).
1.247 + Error Condition : @see CUnitTest::RunError().
1.248 + @since 7.0
1.249 + @return TInt KErrNone if cleanup successful, otherwise
1.250 + @see CUnitTest::RunError()
1.251 + @pre CDataLogger_LogInformation_UnitTest is fully constructed, and initialised.
1.252 + @post The object has been restored to a sensible state.
1.253 + */
1.254 + inline TInt RunError(TInt aError);
1.255 +
1.256 + /**
1.257 + @fn ~CDataLogger_LogInformation_UnitTest()
1.258 + Intended Usage : Standard Destructor.
1.259 + Error Condition : None.
1.260 + @since 7.0
1.261 + @pre CDataLogger_LogInformation_UnitTest is fully constructed.
1.262 + @post CDataLogger_LogInformation_UnitTest is fully destroyed.
1.263 + */
1.264 + ~CDataLogger_LogInformation_UnitTest();
1.265 +
1.266 +private:
1.267 + /**
1.268 + @fn CDataLogger_LogInformation_UnitTest(CDataLogger& aDataLogger,
1.269 + MUnitTestObserver& aObserver)
1.270 + Intended Usage : Default constructor.
1.271 + Error Condition : None.
1.272 + @since 7.0
1.273 + @param aDataLogger The output logging object.
1.274 + @param aObserver The observer of this UnitTest.
1.275 + @param aStateAccessor WhiteBox state access to the CDataLogger class.
1.276 + @pre None.
1.277 + @post CDataLogger_LogInformation_UnitTest is fully constructed.
1.278 + */
1.279 + inline CDataLogger_LogInformation_UnitTest(CDataLogger& aDataLogger,
1.280 + MUnitTestObserver& aObserver);
1.281 +
1.282 + /**
1.283 + @fn void ConstructL()
1.284 + Intended Usage : Second phase of safe two phase construction,
1.285 + to complete the object initialisation.
1.286 + Error Condition : Leaves with an error code.
1.287 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.288 + @since 7.0
1.289 + @return None
1.290 + @pre CDataLogger_LogInformation_UnitTest is fully constructed.
1.291 + @post CDataLogger_LogInformation_UnitTest is fully initialised.
1.292 + */
1.293 + void ConstructL();
1.294 +
1.295 + /**
1.296 + The context of the Unit Test.
1.297 + i.e The CDataLogger class tested by this UnitTest's transitions.
1.298 + */
1.299 + CDataLogger_UnitTestContext* iUTContext;
1.300 + TDataLogger_StateAccessor* iStateAccessor;
1.301 + // C'tor, d'tor, and method transition validators
1.302 + TDataLogger_Ctor_TransitionValidator* iCtorValidator;
1.303 + TDataLogger_LogInformation_TransitionValidator* iLogInformationValidator;
1.304 + TDataLogger_LogInformationNarrow_TransitionValidator* iLogInformationNarrowValidator;
1.305 + TDataLogger_LogInformationWithParameters_TransitionValidator* iLogInformationWithParametersValidator;
1.306 + TDataLogger_LogInformationWithParametersNarrow_TransitionValidator* iLogInformationWithParametersNarrowValidator;
1.307 + TDataLogger_Dtor_TransitionValidator* iDtorValidator;
1.308 + }; // CDataLogger_LogInformation_UnitTest
1.309 +
1.310 +// ______________________________________________________________________________
1.311 +//
1.312 +/**
1.313 + @internalComponent
1.314 +
1.315 + Comments : Unit Test for ReportInformation on CDataLogger, the class under test.
1.316 + */
1.317 +class CDataLogger_ReportInformation_UnitTest : public CUnitTest
1.318 + {
1.319 +public:
1.320 + /**
1.321 + @fn NewL(CDataLogger& aDataLogger,
1.322 + MUnitTestObserver& aObserver)
1.323 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.324 + cleanup stack.
1.325 + Error Condition : Leaves with the error code.
1.326 + @leave KErrNoMemory
1.327 + @since 7.0
1.328 + @param aDataLogger The output logging object.
1.329 + @param aObserver The observer of this UnitTest.
1.330 + @return CDataLogger_ReportInformation_UnitTest* The constructed object.
1.331 + @pre None.
1.332 + @post CDataLogger_ReportInformation_UnitTest is fully constructed, and initialised.
1.333 + */
1.334 + static CDataLogger_ReportInformation_UnitTest* NewL(CDataLogger& aDataLogger,
1.335 + MUnitTestObserver& aObserver);
1.336 +
1.337 + /**
1.338 + @fn RunError(TInt aError)
1.339 + Intended Usage : Intercept the panic caused by a RunL leave,
1.340 + to restore the CDataLogger_ReportInformation_UnitTest
1.341 + object to a sensible state.
1.342 + (called by the Active Scheduler immediately before the Panic).
1.343 + Error Condition : @see CUnitTest::RunError().
1.344 + @since 7.0
1.345 + @return TInt KErrNone if cleanup successful, otherwise
1.346 + @see CUnitTest::RunError()
1.347 + @pre CDataLogger_ReportInformation_UnitTest is fully constructed, and initialised.
1.348 + @post The object has been restored to a sensible state.
1.349 + */
1.350 + inline TInt RunError(TInt aError);
1.351 +
1.352 + /**
1.353 + @fn ~CDataLogger_ReportInformation_UnitTest()
1.354 + Intended Usage : Standard Destructor.
1.355 + Error Condition : None.
1.356 + @since 7.0
1.357 + @pre CDataLogger_ReportInformation_UnitTest is fully constructed.
1.358 + @post CDataLogger_ReportInformation_UnitTest is fully destroyed.
1.359 + */
1.360 + ~CDataLogger_ReportInformation_UnitTest();
1.361 +
1.362 +private:
1.363 + /**
1.364 + @fn CDataLogger_ReportInformation_UnitTest(CDataLogger& aDataLogger,
1.365 + MUnitTestObserver& aObserver)
1.366 + Intended Usage : Default constructor.
1.367 + Error Condition : None.
1.368 + @since 7.0
1.369 + @param aDataLogger The output logging object.
1.370 + @param aObserver The observer of this UnitTest.
1.371 + @param aStateAccessor WhiteBox state access to the CDataLogger class.
1.372 + @pre None.
1.373 + @post CDataLogger_ReportInformation_UnitTest is fully constructed.
1.374 + */
1.375 + inline CDataLogger_ReportInformation_UnitTest(CDataLogger& aDataLogger,
1.376 + MUnitTestObserver& aObserver);
1.377 +
1.378 + /**
1.379 + @fn void ConstructL()
1.380 + Intended Usage : Second phase of safe two phase construction,
1.381 + to complete the object initialisation.
1.382 + Error Condition : Leaves with an error code.
1.383 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.384 + @since 7.0
1.385 + @return None
1.386 + @pre CDataLogger_ReportInformation_UnitTest is fully constructed.
1.387 + @post CDataLogger_ReportInformation_UnitTest is fully initialised.
1.388 + */
1.389 + void ConstructL();
1.390 +
1.391 + /**
1.392 + The context of the Unit Test.
1.393 + i.e The CDataLogger class tested by this UnitTest's transitions.
1.394 + */
1.395 + CDataLogger_UnitTestContext* iUTContext;
1.396 + TDataLogger_StateAccessor* iStateAccessor;
1.397 + // C'tor, d'tor, and method transition validators
1.398 + TDataLogger_Ctor_TransitionValidator* iCtorValidator;
1.399 + TDataLogger_ReportInformation_TransitionValidator* iReportInformationValidator;
1.400 + TDataLogger_ReportInformationWithParameters_TransitionValidator* iReportInformationWithParametersValidator;
1.401 + TDataLogger_Dtor_TransitionValidator* iDtorValidator;
1.402 +
1.403 + }; // CDataLogger_ReportInformation_UnitTest
1.404 +
1.405 +
1.406 +#endif // __DATALOGGERUNITTEST_H__