supl/locationomasuplpostester/epos_comasuplpostestermodulecfg/inc/epos_comasuplpositiontest.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Tests for various Error conditions for GetPositionL
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_COMASUPLPOSITIONTEST_H
       
    19 #define C_COMASUPLPOSITIONTEST_H
       
    20 
       
    21 #include "epos_comasuplpostestercategory.h"
       
    22 
       
    23 class COMASuplPosHandlerBase;
       
    24 class COMASuplTestHandler;
       
    25 class COMASuplPosTesterLogger;
       
    26 class COMASuplPosition;
       
    27 
       
    28 /** Constant used for logging name of test*/
       
    29 _LIT8(KPositionTest,"---------------Position Test---------------");
       
    30 
       
    31 /** Constant used for logging information about test*/
       
    32 _LIT8(KPositionTestComplete, "Info: Position Test  Complete.");
       
    33 
       
    34 /** Constant used for logging information about test*/
       
    35 _LIT8(KPositionTestCancel, "Info: Position Test  Canceled.");
       
    36 
       
    37 /** Constant used for logging information about test*/
       
    38 _LIT8(KPositionTestAborted, "Error: Position Test  Aborted.");
       
    39 
       
    40 /** Constant used for logging.*/
       
    41 _LIT8(KAfterEndSessionI, "Info: After Ending session, GetPositionL completes with ");
       
    42 
       
    43 /** Constant used for logging.*/
       
    44 _LIT8(KAfterEndSessionW, "Warning: After Ending session, GetPositionL completes with ");
       
    45 
       
    46 /** Constant used for logging.*/
       
    47 _LIT8(KGetPositionLCompleteW, "Warning: GetPositionL completes with ");
       
    48 
       
    49 /** Constant used for logging.*/
       
    50 _LIT8(KGetPositionLInfo, "Info: Requesting GetPositionL Before \
       
    51 Initializing session.");
       
    52 
       
    53 /** Constant used for logging.*/
       
    54 _LIT8(KGetPositionLSessionInitInfo, "Info: Requesting GetPositionL After \
       
    55 Initializing session.");
       
    56 
       
    57 /** Constant used for logging.*/
       
    58 _LIT8(KGetPositionLSessionEndInfo, "Info: Requesting GetPositionL After \
       
    59 Ending session.");
       
    60 
       
    61 /**
       
    62  *  Tests for GetPositionL() in various scenarios.
       
    63  *
       
    64  *  Tests for GetPositionL() in various scenarios and logs warning if there 
       
    65  *  is a deviation from expected behaviour. 
       
    66  *
       
    67  *  @lib epos_comasuplpostestermodulecfg.lib
       
    68  *  @since S60 v3.1u
       
    69  */
       
    70 class COMASuplPositionTest : public COMASuplPosTesterCategory
       
    71 	{
       
    72 	private:
       
    73 		/**  Controls the series of execution of asynchronous functions */
       
    74 		enum TExecutionSequence
       
    75 			{
       
    76 			EStartTest = 0,
       
    77 			EGetPositionBeforeInitialize,
       
    78 			EGetPositionCompleteBeforeInitialize,
       
    79 			EInitializeSession,
       
    80 			EGetPositionAfterInitialize,
       
    81 			EGetPositionCompleteAfterInitialize,
       
    82 			EEndSessionAndGetPosition,
       
    83 			EGetPositionCompleteAfterEndSession,
       
    84 			
       
    85 			};
       
    86 	public:
       
    87 		static COMASuplPositionTest* NewL(COMASuplPosHandlerBase*
       
    88 								 aPosHandler
       
    89 								, COMASuplPosTesterCategory* aCallBack = NULL);
       
    90 		virtual ~COMASuplPositionTest();
       
    91 	private:
       
    92 		COMASuplPositionTest(COMASuplPosHandlerBase* aPosHandler
       
    93 							, COMASuplPosTesterCategory* aCallBack);
       
    94 		void ConstructL();
       
    95 
       
    96 	public:
       
    97 		/**
       
    98 	     * Deletes iPosition and creates a new object for it.
       
    99 	     *
       
   100 	     * @since S60 v3.1
       
   101 	     * @return void
       
   102 	     */
       
   103 		void InitializePositionL();
       
   104 
       
   105 		/**
       
   106 	     * Initializes Position object and requests for GerPositionL
       
   107 	     *
       
   108 	     * @since S60 v3.1
       
   109 	     * @return void
       
   110 	     */
       
   111 		void RequestForPositionL();
       
   112 
       
   113 	public:
       
   114 		/**
       
   115 	     * From COMASuplPosTesterCategory
       
   116 	     * Starts testing for the test class
       
   117 	     *
       
   118 	     * @since S60 v3.1
       
   119 	     */
       
   120 		void StartTestingL();
       
   121 	public:
       
   122 		/**
       
   123 	     * From COMASuplPosTesterCategory
       
   124 	     * Handles completion of asynchronous request
       
   125 	     *
       
   126 	     * @since S60 v3.1
       
   127 	     */
       
   128 		void RunL();
       
   129 
       
   130 		/**
       
   131 	     * From COMASuplPosTesterCategory
       
   132 	     * Handles cancellation of asynchronous request
       
   133 	     *
       
   134 	     * @since S60 v3.1
       
   135 	     */
       
   136 		void DoCancel();
       
   137 
       
   138 		/**
       
   139 	     * From COMASuplPosTesterCategory
       
   140 	     * Handles leave from RunL, aborts testing.
       
   141 	     *
       
   142 	     * @since S60 v3.1
       
   143 	     * @param aError: Errorcode of leaving
       
   144 	     */
       
   145 		TInt  RunError( TInt aError );
       
   146 	private:
       
   147 		/**
       
   148 	     * Reference to the loaded POS Handler.
       
   149 	     */
       
   150 		COMASuplPosHandlerBase& iPosHandler;
       
   151 
       
   152 		/**
       
   153 	     * Pointer to session object 
       
   154 	     * Own.
       
   155 	     */
       
   156 		COMASuplPosSessionBase* iSessionBase;
       
   157 
       
   158 		/**
       
   159 	     * Identifies the case to be executed when RunL is called
       
   160 	     */
       
   161 		TExecutionSequence iNextInSeq;
       
   162 
       
   163 		/**
       
   164 		 * Unique request id for session
       
   165 		 */
       
   166 		TInt iRequestID;
       
   167 
       
   168 		/**
       
   169 	     * Holds the Position object.
       
   170 	     * Own.
       
   171 	     */
       
   172 		COMASuplPosition* iPosition;
       
   173 
       
   174 	};
       
   175 #endif