|
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_PRESENCEWATCHERLISTMANAGEMENT_H |
|
19 #define T_PRESENCEWATCHERLISTMANAGEMENT_H |
|
20 |
|
21 #include <ceunittestsuiteclass.h> |
|
22 #include <ximpbase.h> |
|
23 #include <ximpcontextobserver.h> |
|
24 #include "presencetypehelpers.h" |
|
25 #include "prfwteststatuseventlistener.h" |
|
26 #include "prfwtestmessaging.h" |
|
27 |
|
28 class CXIMPTestContextWrapper; |
|
29 class CXIMPTestContextWrapperMgr; |
|
30 class CXIMPTestMessenger; |
|
31 class CPresenceWatcherInfoImp; |
|
32 class CPresenceWatcherListEventImp; |
|
33 |
|
34 /** |
|
35 * XIMP Framework Eunit tests. |
|
36 * |
|
37 * Tests for XIMP presence watcher list. |
|
38 * |
|
39 * @since S60 v4.0 |
|
40 */ |
|
41 class T_PresenceWatcherListManagement : public CEUnitTestSuiteClass, |
|
42 public MXIMPContextObserver |
|
43 { |
|
44 |
|
45 public: |
|
46 static T_PresenceWatcherListManagement* NewL(); |
|
47 virtual ~T_PresenceWatcherListManagement(); |
|
48 |
|
49 |
|
50 private: |
|
51 T_PresenceWatcherListManagement(); |
|
52 void ConstructL(); |
|
53 |
|
54 enum TValidateType |
|
55 { |
|
56 EWatcherList, |
|
57 EInvalid = 1000 |
|
58 }; |
|
59 |
|
60 private: // Test case functions |
|
61 |
|
62 void Setup_L(); |
|
63 void SetupMultiple_L(); |
|
64 void BindL(); |
|
65 void BindAllL(); |
|
66 void Teardown(); |
|
67 void UnbindL(); |
|
68 void UnbindAllL(); |
|
69 void SubscribeL(); |
|
70 void UnsubscribeL(); |
|
71 |
|
72 void T_BindUnbind_L(); |
|
73 void T_SubscribePresenceWatcherList_Single_L(); |
|
74 void T_SubscribePresenceWatcherList_Multiple_L(); |
|
75 void T_HandlePresenceWatcherList_L(); |
|
76 void T_IndiaCase_L(); |
|
77 void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, |
|
78 TXIMPTestStatusEventTemplate aEventType ); |
|
79 |
|
80 void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, |
|
81 TXIMPTestStatusEventTemplate aEventType ); |
|
82 |
|
83 //TBool ValidateWatcherListEvent( RXIMPObjOwningPtrArray<CPresenceWatcherInfoImp>& aExpectedArray, TValidateType aType ); |
|
84 |
|
85 |
|
86 private: // From MXIMPContextObserver |
|
87 |
|
88 void HandlePresenceContextEvent( |
|
89 const MXIMPContext& aContext, |
|
90 const MXIMPBase& aEvent ); |
|
91 |
|
92 |
|
93 private: // Test helpers |
|
94 |
|
95 /** |
|
96 * Fake a server-originated (=mobile terminated) message. |
|
97 * The message appears to adaptation and framework as if |
|
98 * it came from the network. Uses only one group. |
|
99 * @param aUri The URI of group |
|
100 * @param aDispName The display name for the group |
|
101 * @param aMsgType The message type for CXIMPTestFileSrvMsg |
|
102 */ |
|
103 void SendSrvMsgL( |
|
104 const TDesC& aUri, const TDesC& aDispName, |
|
105 TInt aMsgType ); |
|
106 |
|
107 /** |
|
108 * Fake a server-originated message with empty content. |
|
109 * Whether to use this depends on the event you expect. |
|
110 * @see SendSrvMsgL |
|
111 */ |
|
112 void SendSrvMsgL( TInt aMsgType ); |
|
113 |
|
114 // @see below |
|
115 enum TTestPWlOperation |
|
116 { |
|
117 ETestPWlNew = 0, // new watchers |
|
118 ETestPWlCurrent, // current watchers |
|
119 ETestPWlDisappeared // disappeared watchers |
|
120 }; |
|
121 |
|
122 |
|
123 /** |
|
124 * Creates an event for new watcher, current, or disappred presence watcher |
|
125 * list. The caller provides an identity and current presence watcher list. |
|
126 * Depending on the provided operation an event is created. |
|
127 * |
|
128 * In cleanupstack there are 4 items, FIFO: |
|
129 * - new list |
|
130 * - current list |
|
131 * - disappeared list |
|
132 * - event imp |
|
133 * |
|
134 * This is because this event won't take ownership to the arrays |
|
135 * when created this way. |
|
136 * |
|
137 * @param aUri Uri |
|
138 * @param aDispName Displayname |
|
139 * @param aOperation operation for which caller wants to generates event |
|
140 * @param aCurrentList Current watcher list provided by caller, method takes |
|
141 * ownership of the current list, and it is included in above 3 lists. |
|
142 * a NULL pointer with operation ETestPWlCurrent causes empty event. |
|
143 * @return The suitably filled event. |
|
144 */ |
|
145 CPresenceWatcherListEventImp* CreateWatcherListEventLCX( |
|
146 const TDesC& aUri, |
|
147 const TDesC& aDispName, |
|
148 MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, |
|
149 MXIMPDataSubscriptionState::TDataState aDataState, |
|
150 TTestPWlOperation aOperation, |
|
151 RPrWatLstInfoImpArray* aCurrentList = NULL |
|
152 ); |
|
153 |
|
154 |
|
155 private: // Test data |
|
156 |
|
157 /** |
|
158 * Eunit test case table declaration. |
|
159 */ |
|
160 EUNIT_DECLARE_TEST_TABLE; |
|
161 |
|
162 // owned |
|
163 CXIMPTestContextWrapperMgr* iWrapperMgr; |
|
164 |
|
165 // |
|
166 TValidateType iLastEvent; |
|
167 TInt iLastError; |
|
168 RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > iValidateArray; |
|
169 }; |
|
170 |
|
171 |
|
172 #endif // T_PRESENCEWATCHERLISTMANAGEMENT_H |
|
173 |
|
174 |
|
175 |
|
176 // end of file |
|
177 |
|
178 |
|
179 |