locationmgmt/agpslocationmgr/test/te_agpsmanagersuite/inc/ctestobserverbase.h
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // AGPS Manager test observer base class definition
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __CTESTOBSERVERBASE_H__
       
    19 #define __CTESTOBSERVERBASE_H__
       
    20 
       
    21 #include <e32cmn.h>
       
    22 //#include <ecom/ecom.h>
       
    23 //#include <lbslocdatasourcegpsbase.h>
       
    24 //#include <lbs/lbsnetcommon.h>
       
    25 //#include <lbs/lbsassistancedatabuilderset.h>
       
    26 #include "lbstimer.h"
       
    27 
       
    28 
       
    29 /** Base class for test observers.
       
    30 
       
    31 This class is used to factor out functionality that is
       
    32 common to all of the observer classes in the AGPS Manager
       
    33 UNIT test framework.
       
    34 */
       
    35 class CTestObserverBase : public CBase, public MLbsCallbackTimerObserver
       
    36 	{
       
    37 
       
    38 public:
       
    39 
       
    40 	/** Callback method result enumeration.
       
    41 	This is used to show which observer method was called.
       
    42 	*/
       
    43 	enum TCallBackError
       
    44 		{
       
    45 		ECallBackErrorNone,
       
    46 		ECallBackTimeout,
       
    47 		ECallBackTimerError
       
    48 		};
       
    49 
       
    50 public:
       
    51 
       
    52 	virtual	~CTestObserverBase();
       
    53 	
       
    54 	// Reset the observer's called status
       
    55 	void ResetWasObserverCalled();
       
    56 	
       
    57 	// Wait for an observer callback
       
    58 	void WaitForCallBack();
       
    59 	
       
    60 	// Check if the observer was called
       
    61 	TBool WasObserverCalled() const;
       
    62 
       
    63 	// Check if more observer activity takes place
       
    64 	TBool IsMoreActivityObserved();
       
    65 	
       
    66 	TInt NumberOfCallbacksReceived();
       
    67 		
       
    68 	// MTestTimerObserver methods
       
    69 	void OnTimerEventL(TInt aTimerId);
       
    70 	TInt OnTimerError(TInt aTimerId, TInt aError);
       
    71 
       
    72 protected:
       
    73 
       
    74 	// Signal that the observer has received a callback
       
    75 	void SignalObserverCallBack(const TCallBackError aResult);
       
    76 	
       
    77 	void CallbackHandled();
       
    78 
       
    79 	
       
    80 	void ConstructL();
       
    81 
       
    82 	CTestObserverBase();
       
    83 
       
    84 private:
       
    85 
       
    86 	/** Value relating to the observer method that was called.
       
    87 	*/
       
    88 	TCallBackError iCallBackError;
       
    89 	
       
    90 	/** Number of callbacks received and waiting to be looked
       
    91 	at by the test
       
    92 	**/
       
    93 	TInt iNumberOfCallbacks;
       
    94 	
       
    95 	/** Local (nested) active scheduler used to wait for callbacks
       
    96 	*/
       
    97 	CActiveSchedulerWait* iScheduler;
       
    98 	
       
    99 	/** Test timer
       
   100 	*/
       
   101 	CLbsCallbackTimer* iTimer;
       
   102 	};
       
   103 
       
   104 #endif //__CTESTOBSERVERBASE_H__