|
1 /* |
|
2 * Copyright (c) 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: XIMP Framework Test Code |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef T_PRESENCEBLOCKING_H |
|
19 #define T_PRESENCEBLOCKING_H |
|
20 |
|
21 #include <ceunittestsuiteclass.h> |
|
22 #include <ximpbase.h> |
|
23 #include "prfwteststatuseventlistener.h" |
|
24 #include "prfwtestmessaging.h" |
|
25 #include "ximpdatasubscriptionstateimp.h" |
|
26 #include "presencetypehelpers.h" |
|
27 |
|
28 class CXIMPTestContextWrapper; |
|
29 class CXIMPTestContextWrapperMgr; |
|
30 class CXIMPTestMessenger; |
|
31 class CPresenceBlockInfoImp; |
|
32 class CPresenceBlockListEventImp; |
|
33 |
|
34 /** |
|
35 * XIMP Framework Eunit tests. |
|
36 * |
|
37 * Tests for XIMP session management services. |
|
38 * |
|
39 * @since S60 v4.0 |
|
40 */ |
|
41 class T_PresenceBlocking : public CEUnitTestSuiteClass |
|
42 { |
|
43 |
|
44 public: |
|
45 static T_PresenceBlocking* NewL(); |
|
46 virtual ~T_PresenceBlocking(); |
|
47 |
|
48 |
|
49 private: |
|
50 T_PresenceBlocking(); |
|
51 void ConstructL(); |
|
52 |
|
53 private: // Test case functions |
|
54 |
|
55 void Setup_L(); |
|
56 void SetupMultiple_L(); |
|
57 void BindL(); |
|
58 void BindAllL(); |
|
59 void Teardown(); |
|
60 void UnbindL(); |
|
61 void UnbindAllL(); |
|
62 void SubscribeL(); |
|
63 void UnsubscribeL(); |
|
64 |
|
65 void T_SubscribeBlockList_Single_L(); |
|
66 void T_SubscribeBlockListRefresh_Single_L(); |
|
67 void T_SubscribeBlockList_Multiple_L(); |
|
68 void T_HandlePresenceBlockList_L(); |
|
69 void T_BlockPresence_L(); |
|
70 void T_CancelBlockedPresence_L(); |
|
71 void T_HandlePresenceBlocked_L(); |
|
72 void T_HandlePresenceBlockCanceled_L(); |
|
73 |
|
74 |
|
75 private: // Test helpers |
|
76 |
|
77 /** |
|
78 * Fake a server-originated (=mobile terminated) message. |
|
79 * The message appears to adaptation and framework as if |
|
80 * it came from the network. Uses only one group. |
|
81 * @param aUri The URI of group |
|
82 * @param aDispName The display name for the group |
|
83 * @param aMsgType The message type for CXIMPTestFileSrvMsg |
|
84 */ |
|
85 void SendSrvMsgL( |
|
86 const TDesC& aUri, const TDesC& aDispName, |
|
87 TInt aMsgType ); |
|
88 void SendBlockedSrvMsgL( |
|
89 const TDesC& aUri, const TDesC& aDispName, |
|
90 TInt aMsgType ); |
|
91 void SendCanceledSrvMsgL( |
|
92 const TDesC& aUri, const TDesC& aDispName, |
|
93 TInt aMsgType ); |
|
94 |
|
95 /** |
|
96 * Fake a server-originated message with empty content. |
|
97 * Whether to use this depends on the event you expect. |
|
98 * @see SendSrvMsgL |
|
99 */ |
|
100 void SendSrvMsgL( TInt aMsgType ); |
|
101 |
|
102 // @see below |
|
103 /* |
|
104 enum TTestPBlArraySpecifier //Waqas: Not used anymore, use next one |
|
105 { |
|
106 ETestPBlNewList = 0, // new block list |
|
107 ETestPBlAdded, // added block |
|
108 ETestPBlCurrent, // current block list |
|
109 ETestPBlRemoved, // removed block |
|
110 ETestPBlUpdated, // updated block |
|
111 ETestPBlEmpty, // make an empty array for empty event |
|
112 };*/ |
|
113 |
|
114 enum TTestPBlOperationSpecifier |
|
115 { |
|
116 ETestPBlAdded = 0, // added block |
|
117 ETestPBlCurrent, // current block list |
|
118 ETestPBlRemoved, // removed block |
|
119 ETestPBlUpdated // updated block |
|
120 }; |
|
121 |
|
122 /** |
|
123 * Creates an event for adding, current, removing or updating |
|
124 * block list. The caller provides an identity and current blocked list |
|
125 * and depending on the provided operation an event is created. |
|
126 * |
|
127 * In cleanupstack there are 4 items, FIFO: |
|
128 * - created list |
|
129 * - updated list |
|
130 * - deleted list |
|
131 * - event imp |
|
132 * |
|
133 * This is because this event won't take ownership to the arrays |
|
134 * when created this way. |
|
135 * |
|
136 * @param aUri Uri |
|
137 * @param aDispName Displayname |
|
138 * @param aOperation operation for which caller wants to generates event |
|
139 * @param aCurrentList Current blocked list provided by caller, method takes |
|
140 * ownership of the current list, and it is included in above 4 items. |
|
141 * a NULL pointer with operation ETestPBlCurrent causes empty event. |
|
142 * @return The suitably filled event. |
|
143 */ |
|
144 CPresenceBlockListEventImp* CreateBlockListEventLCX( |
|
145 const TDesC& aUri, |
|
146 const TDesC& aDispName, |
|
147 MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, |
|
148 MXIMPDataSubscriptionState::TDataState aDataState, |
|
149 TTestPBlOperationSpecifier aOperation, |
|
150 RPrBlockInfoImpArray* aCurrentList = NULL |
|
151 ); |
|
152 |
|
153 |
|
154 private: // Test data |
|
155 |
|
156 /** |
|
157 * Eunit test case table declaration. |
|
158 */ |
|
159 EUNIT_DECLARE_TEST_TABLE; |
|
160 |
|
161 // owned |
|
162 CXIMPTestContextWrapperMgr* iWrapperMgr; |
|
163 |
|
164 // |
|
165 TInt iLastError; |
|
166 RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > iValidateArray; |
|
167 }; |
|
168 |
|
169 |
|
170 #endif // T_PRESENCEBLOCKING_H |
|
171 |
|
172 |
|
173 |
|
174 // end of file |
|
175 |
|
176 |
|
177 |