telephonyserverplugins/common_tsy/test/component/inc/cctsycomponenttestbase.h
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-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 // base class for CTSY component tests
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #ifndef CCTSYCOMPONENTTESTBASE_H
       
    23 #define CCTSYCOMPONENTTESTBASE_H
       
    24 
       
    25 #include <test/tefunit.h>
       
    26 
       
    27 #include <etelmm.h>
       
    28 #include <etelmmcs.h>
       
    29 #include <etelpckt.h>
       
    30 
       
    31 #include "rmockltsy.h"
       
    32 #include <ctsy/serviceapi/cmmutility.h>
       
    33 #include "CMmCommonStaticUtility.h"
       
    34 
       
    35 // for making iCurrentICCType == EICCTypeSim3G  
       
    36 enum TICCType
       
    37     {
       
    38     EICCTypeSim2GGsm,
       
    39     EICCTypeSim3G,
       
    40     EICCTypeSimUnknown
       
    41     };
       
    42 
       
    43 class CStorageInfoData;
       
    44 
       
    45 class CCtsyComponentTestBase : public CTestFixture
       
    46 	{
       
    47 
       
    48 protected:
       
    49 	enum TExtendedErrorClient
       
    50 		{
       
    51 		EUseBasicError,
       
    52 		EUseExtendedError
       
    53 		};
       
    54 	void OpenEtelServerL(TExtendedErrorClient aSetExtendedErrorClient = EUseBasicError);
       
    55 	void OpenPhoneL();
       
    56 	void DialL(RCall& aCall, const TInt aCallId, const RMobilePhone::TMobileService aService);
       
    57 	void DialL(RCall& aCall,
       
    58 				const TInt aCallId,
       
    59 				const RMobilePhone::TMobileService aService,
       
    60 				const TDesC &aTelNumber);
       
    61 	void OpenPacketServiceL(RPacketService& aRPacketService,	          
       
    62 	          RPacketService::TStatus aStartAttachStatus = RPacketService::EStatusUnattached,
       
    63 	          RPacketService::TAttachMode aStartAttachMode = RPacketService::EAttachWhenNeeded,
       
    64 	          TInt aMaxMonitorServices=10,
       
    65 	          TInt aMaxServices=10
       
    66 	          );
       
    67 	          	          
       
    68     TInt InitContextL(RPacketContext& aPacketContext,
       
    69                       TInfoName& aContextName,
       
    70                       TInfoName aHostCidName = KNullDesC());
       
    71 	TInt SetContextActiveL(TInfoName& aContextName);
       
    72 	TInt SetContextStatusL(TInfoName& aContextName, RPacketContext::TContextStatus aStatus);
       
    73 	TInt CreateQoSAndSetProfileParamLC(RPacketQoS& aPacketQoS, 
       
    74 									   RPacketContext& aPacketContext,
       
    75 									   TInfoName& aContextName,
       
    76 									   TPacketDataConfigBase& aRequested,
       
    77 									   TInfoName aPrimaryContextName = KNullDesC());
       
    78 									   
       
    79     TInt InitMbmsContextL(RPacketMbmsContext& aMbmsContext,
       
    80                           TInfoName& aContextName);	
       
    81     TInt SetMbmsActiveL(TInfoName& aContextName);    
       
    82     TInt SetMbmsConfigL(RPacketMbmsContext& aPacketContext, 
       
    83                         TInfoName& aContextName, 
       
    84                         RPacketMbmsContext::TContextConfigMbmsV1 aStatus);   
       
    85     TInt SetMbmsActiveL(RPacketMbmsContext& aPacketContext, 
       
    86                         RPacketMbmsContext::TContextConfigMbmsV1& aConfig,
       
    87                         TInfoName& aContextName);                                           								 
       
    88     TInt SetMbmsDeactiveL(RPacketMbmsContext& aPacketContext, 
       
    89                         TInfoName& aContextName);    									 
       
    90     TInt SetMbmsDeleteL(RPacketMbmsContext& aPacketContext, 
       
    91                         TInfoName& aContextName); 
       
    92                       
       
    93 	TInt SetPacketServiceStatusL(RPacketService::TStatus& aStatus, TBool aIsResumed);
       
    94 	
       
    95 	TInt AddContextPacketFilterL(RPacketContext& aContext,
       
    96 	                             TInfoName& aContextName, 
       
    97 								 RPacketContext::TPacketFilterV2& aFilter,
       
    98 								 TBool aIsFailInCTSY = 0);
       
    99 
       
   100 	TInt OpenNewCall(RLine& aLine,
       
   101 						RCall& aCall,
       
   102 						const TDesC& aLineName);
       
   103 	
       
   104 	TInt OpenNewCall(RLine& aLine, RCall& aCall, const TDesC& aLineName, TName& aNewName);
       
   105 	
       
   106 	TInt CreateIncomingCallL(RLine& aLine, 
       
   107 	                        const TInt aCallId, 
       
   108 	                        const TDesC& aLineName, // deprecated
       
   109 	                        TName& aIncomingCallName,
       
   110 	                        RMobilePhone::TMobileService aMobileService,
       
   111 	                        RMobileCall::TMobileCallStatus aMobileCallStatus);
       
   112 
       
   113 	void CloseIncomingCallL(RCall& aCall,
       
   114 	         const TInt aCallId,
       
   115 	         const RMobilePhone::TMobileService aMobileService = RMobilePhone::EVoiceService);
       
   116 	
       
   117 	void CloseCallL(RCall& aCall,
       
   118 	         const TInt aCallId,
       
   119 	         const RMobilePhone::TMobileService aMobileService);
       
   120 	
       
   121 	void PrepareCallCloseL(const TInt aCallId,
       
   122 							const RMobilePhone::TMobileService aMobileService);
       
   123 	
       
   124 	void CloseLineL(RLine& aLine,
       
   125 	        TInt aCallId = 0,
       
   126 	        RMobilePhone::TMobileService aMobileService = RMobilePhone::EServiceUnspecified);
       
   127 
       
   128 	void AssertMockLtsyStatusL();
       
   129 
       
   130 	// to push a CleanupItem ont the cleanupstack to close the phone
       
   131 	static void Cleanup(TAny* self);
       
   132 	void DoCleanup();
       
   133 	
       
   134 	// Fake type used for bad parameter testing.
       
   135 	// These will have the correct extension ID but the wrong descriptor
       
   136 	// size compared to the T-class which the API expects.
       
   137 	class TTestMultimodeType
       
   138 		{
       
   139 	public:
       
   140 		TTestMultimodeType(TInt aExtensionId) { iExtensionId = aExtensionId; }
       
   141 		TInt ExtensionId() const { return iExtensionId; }
       
   142 
       
   143 	private:
       
   144 		TInt iExtensionId;
       
   145 		};
       
   146 
       
   147 	typedef TPckg<TTestMultimodeType> TTestMultimodeTypePckg;
       
   148 		
       
   149 	void CallGetMobileCallInfoL(TInt aCallId, 
       
   150 	                           RMobilePhone::TMobileService aService, 
       
   151     	                       const TDesC &aTelNumber);
       
   152 	
       
   153 	void ChangeCallStatusL(const TInt aCallId,
       
   154 			const RMobilePhone::TMobileService aMobileService,
       
   155 			const RMobileCall::TMobileCallStatus aCallStatus,
       
   156 			const TInt aError = KErrNone);
       
   157 
       
   158 	void GetNextServiceGroup(RMobilePhone::TMobileService &aServiceGroup);
       
   159 	
       
   160 	void OpenLineLC(RLine& aLine, const TDesC& aLineName);
       
   161 
       
   162 	void OpenNewCallLC(RLine& aLine, RCall& aCall);
       
   163 
       
   164 	void OpenIncomingCallLC(
       
   165 			RLine& aLine,
       
   166 			RCall& aCall,
       
   167 			const TInt aCallId,
       
   168 			RMobilePhone::TMobileService aMobileService,
       
   169 			RMobileCall::TMobileCallStatus aMobileCallStatus);
       
   170 
       
   171 	void OpenPhoneBookStoreL(RMobilePhoneBookStore &aStore, TName &aName, RMobilePhone &aPhone);
       
   172 
       
   173 	void ChangeUsedSimCardTypeL(TICCType aType);
       
   174 	
       
   175 	void CompleteDialStatusNotificationsL(RCall &aCall, TInt aCallId, RMobilePhone::TMobileService aMobileService);
       
   176 	
       
   177 	void CompleteCallDisconnectNotificationsL(TInt aCallId, RMobilePhone::TMobileService aMobileService);
       
   178 	
       
   179 static void SetStorageInfoData(CStorageInfoData& aStorage, TInt aVal = 50);
       
   180 
       
   181 protected:
       
   182 	RTelServer iTelServer;
       
   183 	RMobilePhone iPhone;
       
   184 	RMockLtsy  iMockLTSY;
       
   185 
       
   186 	}; 
       
   187 
       
   188 #endif 
       
   189