|
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 // Base class for CTSY component tests |
|
15 // |
|
16 |
|
17 /** |
|
18 @file |
|
19 @internalAll |
|
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 <test/rmockltsy.h> |
|
32 #include <ctsy/serviceapi/cmmutility.h> |
|
33 #include <ctsy/rmmcustomapi.h> |
|
34 |
|
35 class CCtsyComponentTestBase : public CTestFixture |
|
36 { |
|
37 |
|
38 protected: |
|
39 enum TExtendedErrorClient |
|
40 { |
|
41 EUseBasicError, |
|
42 EUseExtendedError |
|
43 }; |
|
44 |
|
45 void OpenEtelServerL(TExtendedErrorClient aSetExtendedErrorClient = EUseBasicError); |
|
46 |
|
47 void OpenPhoneNegativeL(TInt aMode = 1); |
|
48 |
|
49 void OpenPhoneL(); |
|
50 void OpenPhoneL(RMobilePhone::TMobilePhoneServiceTableV1& aSimServiceTable); |
|
51 |
|
52 void OpenCustomApiLC(RMmCustomAPI& aCustomAPI); |
|
53 |
|
54 void OpenPacketServiceLC(RPacketService& aPacketService, RPacketService::TStatus aPacketServiceStatus); |
|
55 TInt SetContextActiveL(TInfoName& aContextName); |
|
56 // |
|
57 |
|
58 // Driver calls |
|
59 void DriverExpectDialCallRequestL(TInt aCallId, RMobilePhone::TMobileService aMode, TInt aDialError, TBool aIsIsvCall = EFalse, TBool aIsSimOriginated = EFalse, TBool aPerformFdnCheck = ETrue); |
|
60 void DriverCompleteGetMobileCallInfoL(TInt aCallId, RMobilePhone::TMobileService aService); |
|
61 void DriverCompleteSuccessfulDialNotificationsL(TInt aCallId); |
|
62 void DriverCompleteCallStatusChangeNotificationsL(RArray<RMobileCall::TMobileCallStatus>& aStatuses, TInt aCallId, TInt aNotifyError, TInt aExtraDelay = 0); |
|
63 void DriverDialCallL(TInt aCallId, RMobilePhone::TMobileService aMode, TBool aIsIsvCall = EFalse, TBool aIsSimOriginated = EFalse, TBool aPerformFdnCheck = ETrue); //aIsSimOriginated is set to ETrue when the call originates from the SIM i.e. a SET UP CALL proactive command |
|
64 void DriverHangUpCallL(TInt aCallId, TInt aHangUpCause, TBool aCallHasDuration = ETrue); |
|
65 void DriverCompleteSuccessfulHangUpNotificationsL(TInt aCallId, TBool aWithInBandInfo, TInt aNotifyError, TBool aCallHasDuration = ETrue, TInt aExtraDelay = 0); //aCallDuration should be set to true if we expect an update to the phone's life timer... i.e. if the call has been connected then an update will come through |
|
66 void DriverHoldCallL(TInt aCallId, TInt aHoldError); |
|
67 void DriverDialAndHoldFirstCallDialSecondCallL(RMobilePhone::TMobileService aMobileService, TInt aCallId1, TInt aCallId2); |
|
68 |
|
69 void DriverPrepInternalGettersMockLtsyL(); |
|
70 |
|
71 // Client calls |
|
72 TInt OpenLineAndCallL(RMobileLine& aMobileLine, RMobileCall& aMobileCall, RMobilePhone::TMobileService aMode); |
|
73 void ClientDialCallL(RMobileLine& aMobileLine, RMobileCall& aMobileCall, RMobilePhone::TMobileService aMode, TBool aDialEmergencyCall=EFalse, TBool aPerformFdnCheck=ETrue); |
|
74 void ClientWaitForCallStatusNotifications(RMobileCall& aMobileCall, TRequestStatus& aRequestStatus, RMobileCall::TMobileCallStatus& aCallStatus, RArray<RMobileCall::TMobileCallStatus>& aExpectedStatuses, TInt aExpectedError); |
|
75 void ClientDialAndHoldFirstCallDialSecondCallL(RMobilePhone::TMobileService aMobileService, RMobileCall& aMobileCall1, RMobileLine& aMobileLine1, RMobileCall& aMobileCall2, RMobileLine& aMobileLine2); |
|
76 void ClientHangUpCallL(RMobileCall& aMobileCall); |
|
77 |
|
78 // |
|
79 |
|
80 void AssertMockLtsyStatusL(); |
|
81 |
|
82 void WaitForMockLTSYTerminated(); |
|
83 |
|
84 // To push a CleanupItem ont the cleanupstack to close the phone |
|
85 static void Cleanup(TAny* self); |
|
86 virtual void DoCleanup(); |
|
87 |
|
88 |
|
89 // Fake type used for bad parameter testing. |
|
90 // These will have the correct extension ID but the wrong descriptor |
|
91 // size compared to the T-class which the API expects. |
|
92 class TTestMultimodeType |
|
93 { |
|
94 public: |
|
95 TTestMultimodeType(TInt aExtensionId) { iExtensionId = aExtensionId; } |
|
96 TInt ExtensionId() const { return iExtensionId; } |
|
97 |
|
98 private: |
|
99 TInt iExtensionId; |
|
100 }; |
|
101 |
|
102 typedef TPckg<TTestMultimodeType> TTestMultimodeTypePckg; |
|
103 |
|
104 void CallGetMobileCallInfoL(TInt aCallId, |
|
105 RMobilePhone::TMobileService aService, |
|
106 const TDesC& aTelNumber); |
|
107 |
|
108 void PrintMockLtsyLog(); |
|
109 protected: |
|
110 RTelServer iTelServer; |
|
111 RMobilePhone iPhone; |
|
112 RMockLtsy iMockLTSY; |
|
113 TBuf<255> iLogBuf; |
|
114 |
|
115 }; // class CCtsyComponentTestBase |
|
116 |
|
117 |
|
118 // ------------------------------------------------------------------------ // |
|
119 |
|
120 // |
|
121 // Defintions of various Network Information type data for use in test-steps |
|
122 // |
|
123 |
|
124 // Data values for RMobilePhone::TMobilePhoneNetworkInfoV5 |
|
125 const RMobilePhone::TMobilePhoneNetworkCountryCode KCountryCode= _L("011"); |
|
126 const RMobilePhone::TMobilePhoneNetworkIdentity KCdmaSID = _L("666"); |
|
127 const RMobilePhone::TMobilePhoneNetworkIdentity KAnalogSID = _L("777"); |
|
128 const RMobilePhone::TMobilePhoneNetworkIdentity KNetworkId = _L("88888"); |
|
129 const RMobilePhone::TMobilePhoneNetworkDisplayTag KDisplayTag = _L("MyNet"); |
|
130 const RMobilePhone::TMobilePhoneNetworkShortName KShortName = _L("MyNetwork"); |
|
131 const RMobilePhone::TMobilePhoneNetworkLongName KLongName = _L("MyNetworkLongName"); |
|
132 const RMobilePhone::TMobilePhoneNetworkAccess KAccess = RMobilePhone::ENetworkAccessGsm; |
|
133 const RMobilePhone::TMobilePhoneNetworkMode KMode = RMobilePhone::ENetworkModeCdma95; |
|
134 const RMobilePhone::TMobilePhoneNetworkStatus KStatus = RMobilePhone::ENetworkStatusAvailable; |
|
135 const RMobilePhone::TMobilePhoneNetworkBandInfo KBandInfo = RMobilePhone::E1900BandF; |
|
136 const TBool KEgprsAvailable = ETrue; |
|
137 const TBool KHsdpaAvailable = EFalse; |
|
138 |
|
139 // Data values for RMobilePhone::TMobilePhoneLocationAreaV1 |
|
140 const TBool KAreaKnown = ETrue; |
|
141 const TUint KLocationAreaCode = 9999; |
|
142 const TUint KCellId = 111; |
|
143 |
|
144 // Data values for RMobilePhone::TMobilePhoneNetworkMode |
|
145 const RMobilePhone::TMobilePhoneNetworkMode KNetworkMode = RMobilePhone::ENetworkModeWcdma; |
|
146 |
|
147 // Data values for RMobilePhone::TMobilePhoneNITZ |
|
148 const TInt32 KNitzFieldsUsed = RMobilePhone::KCapsTimeAvailable | |
|
149 RMobilePhone::KCapsTimezoneAvailable | |
|
150 RMobilePhone::KCapsDSTAvailable | |
|
151 RMobilePhone::KCapsShortNameAvailable | |
|
152 RMobilePhone::KCapsLongNameAvailable; |
|
153 |
|
154 const TInt KTimeZone = 10; |
|
155 const TInt KDst = 5; |
|
156 |
|
157 // Data values for Signal Strength |
|
158 const TInt32 KSignalStrength = 99; |
|
159 const TInt8 KBar = 5; |
|
160 |
|
161 // Data values for RMobilePhone::TMobilePhoneBatteryInfoV1 |
|
162 const RMobilePhone::TMobilePhoneBatteryStatus KBatteryStatus = RMobilePhone::EPoweredByBattery; |
|
163 const TUint KBatteryChargeLevel = 77; |
|
164 |
|
165 |
|
166 #endif // CCTSYCOMPONENTTESTBASE_H |
|
167 |