telephonyprotocols/umtsgprsscpr/Test/te_spud/inc/SpudUnitTestStep.h
changeset 64 b34bb05ac869
parent 56 ab72d5c1d770
equal deleted inserted replaced
56:ab72d5c1d770 64:b34bb05ac869
     1 // Copyright (c) 2004-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 // Declaration of test classes for SPUD TEL and SPUD FSM unit tests
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef SPUD_UNIT_TEST_STEP_H
       
    24 #define SPUD_UNIT_TEST_STEP_H
       
    25 
       
    26 #include <c32comm.h>
       
    27 #include <networking/umtsnifcontrolif.h>
       
    28 #include <testexecutestepbase.h>
       
    29 
       
    30 #include "CompareContextParameters.h"
       
    31 #include "meteldriverstrategy.h"
       
    32 #include "eteldrivernmspace.h"
       
    33 #include "pdpfsmnmspace.h"
       
    34 #include "InputRequestListener.h"
       
    35 
       
    36 #define TEST_SETRESULT(cond,result) if (!(cond)) SetTestStepResult((result))
       
    37 
       
    38 /** Identifiers for each of the simtsy parameters that can be changed using publish and subscribe */
       
    39 enum TEtelRequestType
       
    40 	{
       
    41 	/** Change QoS parameters */
       
    42 	ENetworkQoSChange,
       
    43 	/** Change network status */
       
    44 	ENetworkChangeRegStatus,
       
    45 	/** Change context status */
       
    46 	EContextStatusChange,
       
    47 	/** Change context config parameters */
       
    48 	EContextConfigChange
       
    49 	};
       
    50 	
       
    51 /** Contains methods common to both SPUD FSM and SPUD TEL tests */
       
    52 class CSpudUnitTestStepBase : public CTestStep
       
    53 	{
       
    54 public:
       
    55 	CSpudUnitTestStepBase(TInt aTestNumber, TBool aUseTestPdpFsmInterface);
       
    56 	TVerdict doTestStepPreambleL();
       
    57 	TVerdict doTestStepPostambleL();
       
    58 	static void SetSimTsyTestNumberL(TInt aTestNumber);
       
    59 
       
    60 protected:
       
    61 	void InitPhoneAndPacketServiceL();
       
    62 	void DestroyPhoneAndPacketService();
       
    63 	void EtelRequest(TEtelRequestType aCommand, TInt aNewValue);
       
    64 	TInt iTestNumber;
       
    65 
       
    66 	/** Used as the interface between the thread running the active objects and the test execute thread.
       
    67 		Contains the data passed to/from Input requests */
       
    68 	CInputRequestListener *iListener;
       
    69 	/** Set to true when testing Etel driver, and as such the test FSM interface it used to interact with Etel driver
       
    70 		and set to false when the real FSM is used */
       
    71 	TBool iUseTestPdpFsmInterface;
       
    72 	/** The thread used to run the SPUD FSM and SPUD TEL active objects */
       
    73 	RThread iActiveSchedulerThread;
       
    74 	
       
    75 	/** Etel parameters that can be used in test steps */
       
    76 	RTelServer iTelServer;
       
    77 	RPhone iPhone;
       
    78 	RPacketService iPacketService;
       
    79 	RPacketContext iPrimaryPacketContext, iSecondaryPacketContext;
       
    80 	};
       
    81 
       
    82 /** Contains methods for SPUD TEL tests */
       
    83 class CSpudTelUnitTestStepBase : public CSpudUnitTestStepBase
       
    84 	{
       
    85 public:
       
    86 	CSpudTelUnitTestStepBase(TInt aTestNumber);
       
    87 
       
    88 protected:
       
    89 	void EtelDriverInputRequest(TContextId aPdpId, EtelDriver::TEtelInput aOperation);
       
    90 	void CancelPdpRequest(TContextId aPdpId);
       
    91 	void WaitForEtelDriverInputResponse(TContextId aPdpId, PdpFsm::TEtelSignal aSignal, TInt aError=KErrNone);
       
    92 	
       
    93 	void WaitForNextContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigGPRS& aContextConfigGPRS);
       
    94 	void WaitForGivenEtelContextStatusNotification(TContextId aPdpId, RPacketContext::TContextStatus aContextStatus);
       
    95 
       
    96 	void WaitForNextQosNotification(TContextId aPdpId, const RPacketQoS::TQoSR99_R4Negotiated& aQoSR99_R4Negotiated);
       
    97 
       
    98 	void WaitForNextServiceNotificationStatus(RPacketService::TStatus aServiceStatus);
       
    99 	void WaitForEtelDriverSetDataChannel(TContextId aPdpId, RPacketContext::TDataChannelV2 aDataChannelV2);
       
   100 	};
       
   101 
       
   102 /** Contains methods for SPUD FSM tests */
       
   103 class CSpudFsmUnitTestStepBase : public CSpudUnitTestStepBase
       
   104 	{
       
   105 public:
       
   106 	CSpudFsmUnitTestStepBase(TInt aTestNumber);
       
   107 
       
   108 protected:
       
   109 	void FsmInputRequest(TContextId aPdpId, TInt aOperation, TInt aParam);
       
   110 	void WaitForFsmInputResponse(TInt aPdpId, TInt aEvent, TInt aParam);
       
   111 	
       
   112     void FsmObjectCreate(TContextId aPdpId);
       
   113     void WaitForFsmObjectCreateResponse(TInt aPdpId);
       
   114 
       
   115 	void WaitForFsmSuspendedNotification(TContextId aPdpId);
       
   116 	void WaitForFsmResumedNotification(TContextId aPdpId);
       
   117 	void WaitForFsmServiceNotificationStatus();
       
   118 	void WaitForFsmContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigGPRS& aContextConfig);
       
   119 
       
   120 	void WaitForFsmQosChangeNotification(TContextId aPdpId, const RPacketQoS::TQoSR99_R4Negotiated& aQosParams);
       
   121 
       
   122 	void WaitForGivenContextStatus(RPacketContext& aPacketContext, RPacketContext::TContextStatus aStatus);
       
   123 	};
       
   124 
       
   125 /*
       
   126  Declarations for SPUD TEL unit tests - they all implement constructors, destructors and override doTestStep()
       
   127  */
       
   128 
       
   129 #define DEFINE_SPUD_TEL_UNIT_TEST_CLASS(state) class CSpudTelUnit##state : public CSpudTelUnitTestStepBase \
       
   130 	{ \
       
   131 public: \
       
   132 	CSpudTelUnit##state(); \
       
   133 	~CSpudTelUnit##state(); \
       
   134 	virtual TVerdict doTestStepL(); \
       
   135 	};
       
   136  
       
   137 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(NormalOperation)
       
   138 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(Notifications)
       
   139 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(CreatePrimaryError)
       
   140 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(SetQosError)
       
   141 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(SetTftError)
       
   142 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(ActivateError1)
       
   143 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(ActivateError2)
       
   144 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(DeleteError1)
       
   145 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(DeleteError2)
       
   146 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(MultipleContexts)
       
   147 DEFINE_SPUD_TEL_UNIT_TEST_CLASS(Cancel)
       
   148 
       
   149 /*
       
   150  Declarations for SPUD FSM unit tests - they all implement constructors, destructors and override doTestStep()
       
   151  */
       
   152  
       
   153 #define DEFINE_SPUD_FSM_UNIT_TEST_CLASS(state) class CSpudFsmUnit##state : public CSpudFsmUnitTestStepBase \
       
   154 { \
       
   155 public: \
       
   156 	CSpudFsmUnit##state(); \
       
   157 	~CSpudFsmUnit##state(); \
       
   158 	virtual TVerdict doTestStepL(); \
       
   159 };	
       
   160 
       
   161 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(NormalOperation)
       
   162 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(CreatePrimaryError1)
       
   163 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(CreatePrimaryError2)
       
   164 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(CreatePrimaryError3)
       
   165 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(SetQosAndTftError)
       
   166 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(ChangeQosAndTftError)
       
   167 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(Notifications)
       
   168 DEFINE_SPUD_FSM_UNIT_TEST_CLASS(NetworkDelete)
       
   169 
       
   170 /*
       
   171  Declarations for test names used by test execute script
       
   172  */ 
       
   173 _LIT(KSpudTelUnitNormalOperation,"SpudTelUnitNormalOperation");
       
   174 _LIT(KSpudTelUnitNotifications,"SpudTelUnitNotifications");
       
   175 _LIT(KSpudTelUnitCreatePrimaryError,"SpudTelUnitCreatePrimaryError");
       
   176 _LIT(KSpudTelUnitSetQosError,"SpudTelUnitSetQosError");
       
   177 _LIT(KSpudTelUnitSetTftError,"SpudTelUnitSetTftError");
       
   178 _LIT(KSpudTelUnitActivateError1,"SpudTelUnitActivateError1");
       
   179 _LIT(KSpudTelUnitActivateError2,"SpudTelUnitActivateError2");
       
   180 _LIT(KSpudTelUnitDeleteError1,"SpudTelUnitDeleteError1");
       
   181 _LIT(KSpudTelUnitDeleteError2,"SpudTelUnitDeleteError2");
       
   182 _LIT(KSpudTelUnitMultipleContexts,"SpudTelUnitMultipleContexts");
       
   183 _LIT(KSpudTelUnitCancel,"SpudTelUnitCancel");
       
   184 _LIT(KSpudFsmUnitNormalOperation,"SpudFsmUnitNormalOperation");
       
   185 _LIT(KSpudFsmCreatePrimaryError1,"SpudFsmCreatePrimaryError1");
       
   186 _LIT(KSpudFsmCreatePrimaryError2,"SpudFsmCreatePrimaryError2");
       
   187 _LIT(KSpudFsmCreatePrimaryError3,"SpudFsmCreatePrimaryError3");
       
   188 _LIT(KSpudFsmSetQosAndTftError,"SpudFsmSetQosAndTftError");
       
   189 _LIT(KSpudFsmChangeQosAndTftError,"SpudFsmChangeQosAndTftError");
       
   190 _LIT(KSpudFsmTestNotifications,"SpudFsmTestNotifications");
       
   191 _LIT(KSpudFsmNetworkDelete,"SpudFsmNetworkDelete");
       
   192 
       
   193 /*
       
   194  Declarations for names generated by SIMTSY for different contexts
       
   195  */ 
       
   196 _LIT(KFirstPrimaryContextName, "PRIMARY1");
       
   197 _LIT(KSecondPrimaryContextName, "PRIMARY2");
       
   198 _LIT(KThirdPrimaryContextName, "PRIMARY3");
       
   199 _LIT(KFirstSecondaryContextName, "SECONDARY1");
       
   200 _LIT(KSecondSecondaryContextName, "SECONDARY2");
       
   201 _LIT(KFirstQosName, "PACKET_QOS1");
       
   202 
       
   203 const TInt KContextId0 = 0;
       
   204 const TInt KContextId1 = 1;
       
   205 const TInt KContextId2 = 2;
       
   206 const TInt KContextId3 = 3;
       
   207 
       
   208 #endif // SPUD_UNIT_TEST_STEP_H