51
|
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 |
|
|
19 |
#include "eunittools.h"
|
|
20 |
|
|
21 |
|
|
22 |
#include <platform/digia/eunit/eunitmacros.h>
|
|
23 |
#include <platform/digia/eunit/teunitassertioninfo.h>
|
|
24 |
#include <ecom/ecom.h>
|
|
25 |
#include <badesca.h>
|
|
26 |
|
|
27 |
#include <ximpbase.h>
|
|
28 |
#include <ximpclient.h>
|
|
29 |
#include <ximpcontext.h>
|
|
30 |
#include <ximpcontextstateevent.h>
|
|
31 |
#include <ximprequestcompleteevent.h>
|
|
32 |
#include <ximpstatus.h>
|
|
33 |
#include <presencefeatures.h>
|
|
34 |
#include <presencewatching.h>
|
|
35 |
#include <presencepublishing.h>
|
|
36 |
#include <presentitypresenceevent.h>
|
|
37 |
#include <ximpobjectfactory.h>
|
|
38 |
|
|
39 |
#include <presentitygroups.h>
|
|
40 |
#include <presentitygroupinfo.h>
|
|
41 |
#include <presentitygrouplistevent.h>
|
|
42 |
|
|
43 |
|
|
44 |
#include <presentitygroups.h>
|
|
45 |
#include <presentitygroupmemberinfo.h>
|
|
46 |
#include <presentitygroupcontentevent.h>
|
|
47 |
|
|
48 |
#include <presenceauthorization.h>
|
|
49 |
#include <presenceblocklistevent.h>
|
|
50 |
#include <presenceblockinfo.h>
|
|
51 |
|
|
52 |
#include "t_presenceall.h"
|
|
53 |
#include "prfwteststatuseventlistener.h"
|
|
54 |
#include "prfwtestmessaging.h"
|
|
55 |
#include "prfwtestmessenger.h"
|
|
56 |
#include "prfwtestcontextwrappermgr.h"
|
|
57 |
#include "prfwtestcontextwrapper.h"
|
|
58 |
|
|
59 |
#include "presenceinfoimp.h"
|
|
60 |
#include "presenceinfofilterimp.h"
|
|
61 |
#include "prfwtestpresencedatautils.h"
|
|
62 |
#include "ximpidentityimp.h"
|
|
63 |
#include "presentitygroupmemberinfoimp.h"
|
|
64 |
#include "ximpobjecthelpers.h"
|
|
65 |
#include "prfwtestfilesrvmsg.h"
|
|
66 |
#include "prfwtestwaithelper.h"
|
|
67 |
#include "prfwtestlistener.h"
|
|
68 |
|
|
69 |
|
|
70 |
#include "presentitygroupcontenteventimp.h"
|
|
71 |
#include "ximprequestcompleteeventimp.h"
|
|
72 |
#include "presentitygroupinfoimp.h"
|
|
73 |
#include "presentitygrouplisteventimp.h"
|
|
74 |
#include "presentitygroupmemberinfoimp.h"
|
|
75 |
#include "ximprequestcompleteeventimp.h"
|
|
76 |
#include "ximprestrictedobjectcollection.h"
|
|
77 |
#include "ximpobjectfactoryimp.h"
|
|
78 |
|
|
79 |
#include "prfwtesteventfactory.h"
|
|
80 |
|
|
81 |
#include "prfwtestpresencedatautils.h"
|
|
82 |
|
|
83 |
#include "ximpobjecthelpers.h"
|
|
84 |
#include "presentitygroupinfoimp.h"
|
|
85 |
#include "presentitygrouplisteventimp.h"
|
|
86 |
#include "presentitygroupcontenteventimp.h"
|
|
87 |
|
|
88 |
#include "prfwtestfiletool.h"
|
|
89 |
|
|
90 |
|
|
91 |
#include "prfwtestrobustnesstools.h"
|
|
92 |
|
|
93 |
_LIT8( KPrefix1, "PreA_" );
|
|
94 |
_LIT8( KPrefix2, "PreB_" );
|
|
95 |
_LIT8( KPrefix3, "PreC_" );
|
|
96 |
_LIT8( KPrefix4, "PreD_" );
|
|
97 |
|
|
98 |
_LIT( KPrefix5, "PreXX_" );
|
|
99 |
_LIT( KPrefix6, "PreYY_" );
|
|
100 |
|
|
101 |
_LIT( KIdentity, "TestId@hello.world" );
|
|
102 |
|
|
103 |
|
|
104 |
_LIT( KMemberId1, "tel:user1@foo.bar" );
|
|
105 |
_LIT( KMemberDisplayName1, "user1" );
|
|
106 |
|
|
107 |
_LIT( KMemberId2, "tel:user2@foo.bar" );
|
|
108 |
_LIT( KMemberDisplayName2, "user2" );
|
|
109 |
|
|
110 |
_LIT( KGroupId, "PrsDemoGrp" );
|
|
111 |
_LIT( KGroupDisplayName, "demo group" );
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
116 |
|
|
117 |
// CONSTRUCTION
|
|
118 |
T_PresenceAll* T_PresenceAll::NewL()
|
|
119 |
{
|
|
120 |
T_PresenceAll* self = new( ELeave ) T_PresenceAll;
|
|
121 |
CleanupStack::PushL( self );
|
|
122 |
self->ConstructL();
|
|
123 |
CleanupStack::Pop( self );
|
|
124 |
|
|
125 |
return self;
|
|
126 |
}
|
|
127 |
|
|
128 |
|
|
129 |
T_PresenceAll::~T_PresenceAll()
|
|
130 |
{
|
|
131 |
}
|
|
132 |
|
|
133 |
|
|
134 |
void T_PresenceAll::ConstructL()
|
|
135 |
{
|
|
136 |
CEUnitTestSuiteClass::ConstructL();
|
|
137 |
}
|
|
138 |
|
|
139 |
|
|
140 |
T_PresenceAll::T_PresenceAll()
|
|
141 |
{
|
|
142 |
}
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
// ===========================================================================
|
|
147 |
// TEST CASE SETUP & TEARDOWN METHODS
|
|
148 |
// ===========================================================================
|
|
149 |
//
|
|
150 |
|
|
151 |
void T_PresenceAll::Setup_L()
|
|
152 |
{
|
|
153 |
__UHEAP_MARK;
|
|
154 |
PrfwTestRobustness::DoPreCleaning();
|
|
155 |
|
|
156 |
iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
|
|
157 |
iWrapperMgr->CreateWrapperL();
|
|
158 |
}
|
|
159 |
|
|
160 |
void T_PresenceAll::SetupMultiple_L()
|
|
161 |
{
|
|
162 |
PrfwTestRobustness::DoPreCleaning();
|
|
163 |
|
|
164 |
iWrapperMgr = CXIMPTestContextWrapperMgr::NewL();
|
|
165 |
iWrapperMgr->CreateWrapperL();
|
|
166 |
iWrapperMgr->CreateWrapperL();
|
|
167 |
iWrapperMgr->CreateWrapperL();
|
|
168 |
}
|
|
169 |
|
|
170 |
|
|
171 |
void T_PresenceAll::BindL()
|
|
172 |
{
|
|
173 |
CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
|
|
174 |
|
|
175 |
wrapper0->BindL( 0 );
|
|
176 |
}
|
|
177 |
|
|
178 |
void T_PresenceAll::BindAllL()
|
|
179 |
{
|
|
180 |
for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
|
|
181 |
{
|
|
182 |
CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
|
|
183 |
wrapper->BindL( 0 );
|
|
184 |
}
|
|
185 |
}
|
|
186 |
|
|
187 |
|
|
188 |
void T_PresenceAll::Teardown()
|
|
189 |
{
|
|
190 |
delete iWrapperMgr;
|
|
191 |
iWrapperMgr = NULL;
|
|
192 |
|
|
193 |
REComSession::FinalClose();
|
|
194 |
|
|
195 |
PrfwTestRobustness::DoPreCleaning();
|
|
196 |
User::SetJustInTime( ETrue );
|
|
197 |
__UHEAP_MARKEND;
|
|
198 |
}
|
|
199 |
|
|
200 |
void T_PresenceAll::UnbindL()
|
|
201 |
{
|
|
202 |
// Do unbind
|
|
203 |
CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 );
|
|
204 |
wrapper0->UnbindL();
|
|
205 |
}
|
|
206 |
|
|
207 |
void T_PresenceAll::UnbindAllL()
|
|
208 |
{
|
|
209 |
for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a )
|
|
210 |
{
|
|
211 |
CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a );
|
|
212 |
wrapper->UnbindL();
|
|
213 |
}
|
|
214 |
}
|
|
215 |
|
|
216 |
|
|
217 |
// ===========================================================================
|
|
218 |
// TEST CASES for presentity presence subscription
|
|
219 |
// ===========================================================================
|
|
220 |
|
|
221 |
// Jani
|
|
222 |
void T_PresenceAll::T_TMO_demo_Startup_L()
|
|
223 |
{
|
|
224 |
EUNIT_PRINT( _L("T_TMO_demo_Startup_L") );
|
|
225 |
|
|
226 |
BindL();
|
|
227 |
|
|
228 |
CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
|
|
229 |
MXIMPContext* context = wrapper->GetContext();
|
|
230 |
CXIMPTestMessenger* messenger = wrapper->GetMessenger();
|
|
231 |
|
|
232 |
// Tell the protocol it should act normally
|
|
233 |
messenger->SetNoError();
|
|
234 |
|
|
235 |
|
|
236 |
// Get the interfaces
|
|
237 |
MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
|
|
238 |
MPresencePublishing& presPub = presFeat->PresencePublishing();
|
|
239 |
MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
|
|
240 |
MPresentityGroups& presGroup = presFeat->PresentityGroups();
|
|
241 |
MPresenceWatching& presWatch = presFeat->PresenceWatching();
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
//////////////////////////////////////////////////////////////////////////
|
|
246 |
// SUBSCRIBE OWN PRESENCE
|
|
247 |
//////////////////////////////////////////////////////////////////////////
|
|
248 |
|
|
249 |
// Create own presence info filter
|
|
250 |
CPresenceInfoFilterImp* ownPif = CPresenceInfoFilterImp::NewLC(); // << ownPif
|
|
251 |
ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll );
|
|
252 |
//ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage );
|
|
253 |
//ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
|
|
254 |
|
|
255 |
// Setup status event listener for RequestComplete
|
|
256 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
257 |
|
|
258 |
// subscribe own presence
|
|
259 |
TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *ownPif );
|
|
260 |
|
|
261 |
// Wait for events on the request
|
|
262 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
263 |
wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") );
|
|
264 |
|
|
265 |
// verify that SubscribeOwnPresenceL was called
|
|
266 |
COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL );
|
|
267 |
|
|
268 |
//////////////////////////////////////////////////////////////////////////
|
|
269 |
// SUBSCRIBE PRESENCE WATCHER LIST
|
|
270 |
//////////////////////////////////////////////////////////////////////////
|
|
271 |
|
|
272 |
// Setup status event listener for RequestComplete
|
|
273 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
274 |
|
|
275 |
// subscribe
|
|
276 |
reqId = presPub.SubscribePresenceWatcherListL();
|
|
277 |
|
|
278 |
// Wait for events on the request
|
|
279 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
280 |
wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") );
|
|
281 |
|
|
282 |
COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL );
|
|
283 |
|
|
284 |
|
|
285 |
//////////////////////////////////////////////////////////////////////////
|
|
286 |
// SUBSCRIBE PRESENCE BLOCK LIST
|
|
287 |
//////////////////////////////////////////////////////////////////////////
|
|
288 |
|
|
289 |
// Setup status event listener for RequestComplete
|
|
290 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
291 |
|
|
292 |
// subscribe
|
|
293 |
reqId = presAuth.SubscribePresenceBlockListL();
|
|
294 |
|
|
295 |
// Wait for events on the request
|
|
296 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
297 |
wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") );
|
|
298 |
|
|
299 |
// verify that SubscribeBlockListL was called
|
|
300 |
COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL );
|
|
301 |
|
|
302 |
|
|
303 |
|
|
304 |
//////////////////////////////////////////////////////////////////////////
|
|
305 |
// SUBSCRIBE PRESENTITY GROUP LIST
|
|
306 |
//////////////////////////////////////////////////////////////////////////
|
|
307 |
|
|
308 |
// Setup status event listener for RequestComplete
|
|
309 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
310 |
|
|
311 |
// subscribe
|
|
312 |
reqId = presGroup.SubscribePresentityGroupListL();
|
|
313 |
|
|
314 |
// Wait for events on the request
|
|
315 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
316 |
wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") );
|
|
317 |
|
|
318 |
// verify that SubscribePresentityGroupListL was called
|
|
319 |
messenger->AssertSubscribePresentityGroupListCalled( ETrue );
|
|
320 |
|
|
321 |
|
|
322 |
//////////////////////////////////////////////////////////////////////////
|
|
323 |
// EMPTY GROUP LIST EVENT
|
|
324 |
/////////////////////////////////////////////////////////////////////////
|
|
325 |
// According to design, this should not be called
|
|
326 |
// because the group list is empty, this can be removed
|
|
327 |
// Create help listener
|
|
328 |
|
|
329 |
/* CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
|
|
330 |
CleanupStack::PushL( listener2 ); // << listener2
|
|
331 |
|
|
332 |
// Create faked server message about group list
|
|
333 |
SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList );
|
|
334 |
|
|
335 |
// expect empty MPresentityGroupList event.
|
|
336 |
CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX(
|
|
337 |
KNullDesC, KNullDesC,
|
|
338 |
XIMPTestEventFactory::ETestPGLEmpty,
|
|
339 |
KNullDesC, KNullDesC,
|
|
340 |
MXIMPDataSubscriptionState::ESubscriptionActive,
|
|
341 |
MXIMPDataSubscriptionState::EDataAvailable
|
|
342 |
);
|
|
343 |
|
|
344 |
listener2->ExpectL( event );
|
|
345 |
CleanupStack::Pop( event ); // 4 more items in cleanupstack
|
|
346 |
|
|
347 |
EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" );
|
|
348 |
CleanupStack::PopAndDestroy( 4 ); // lists
|
|
349 |
CleanupStack::PopAndDestroy( listener2 ); // >>> listener2
|
|
350 |
|
|
351 |
*/
|
|
352 |
//////////////////////////////////////////////////////////////////////////
|
|
353 |
// CREATE PRESENTITY GROUP
|
|
354 |
/////////////////////////////////////////////////////////////////////////
|
|
355 |
|
|
356 |
// Setup status event listener for RequestComplete
|
|
357 |
// This will also produce HandlePresentityGroupListEvent, since the
|
|
358 |
// the group is subscribed
|
|
359 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
360 |
|
|
361 |
|
|
362 |
MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
|
|
363 |
CleanupStack::Pop(); // groupId
|
|
364 |
groupId->SetIdentityL( KGroupId );
|
|
365 |
|
|
366 |
// subscribe
|
|
367 |
reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
|
|
368 |
|
|
369 |
// Wait for events on the request
|
|
370 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
371 |
wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
|
|
372 |
|
|
373 |
// verify that SubscribePresentityGroupListL was called
|
|
374 |
messenger->AssertCreatePresentityGroupCalled( ETrue );
|
|
375 |
|
|
376 |
|
|
377 |
|
|
378 |
//////////////////////////////////////////////////////////////////////////
|
|
379 |
// ADD PRESENTITY GROUP MEMBER
|
|
380 |
//////////////////////////////////////////////////////////////////////////
|
|
381 |
|
|
382 |
CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
|
|
383 |
CleanupStack::PushL( listener4 ); // << listener4
|
|
384 |
|
|
385 |
MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
|
|
386 |
member->SetIdentityL( KMemberId1 );
|
|
387 |
|
|
388 |
|
|
389 |
// request complete
|
|
390 |
TXIMPRequestId reqIdDummy;
|
|
391 |
CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
|
|
392 |
|
|
393 |
// group id
|
|
394 |
CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
|
|
395 |
evReqComplete->AppendParamL( identity2 );
|
|
396 |
CleanupStack::Pop(identity2); // identity2
|
|
397 |
|
|
398 |
// id for member info
|
|
399 |
CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 );
|
|
400 |
// member info
|
|
401 |
CPresentityGroupMemberInfoImp* memInfoImp =
|
|
402 |
CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 );
|
|
403 |
evReqComplete->AppendParamL( memInfoImp );
|
|
404 |
CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL
|
|
405 |
CleanupStack::PopAndDestroy( miId ); // copy was made
|
|
406 |
|
|
407 |
listener4->ExpectL( evReqComplete );
|
|
408 |
CleanupStack::Pop( evReqComplete );
|
|
409 |
|
|
410 |
// do the call
|
|
411 |
reqId = presGroup.AddPresentityGroupMemberL(
|
|
412 |
*groupId, *member, KMemberDisplayName1 );
|
|
413 |
|
|
414 |
// and wait
|
|
415 |
EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
|
|
416 |
|
|
417 |
messenger->AssertAddPresentityGroupMemberCalled( ETrue );
|
|
418 |
CleanupStack::PopAndDestroy(); // >>> member
|
|
419 |
CleanupStack::PopAndDestroy( listener4 );// >>> listener4
|
|
420 |
|
|
421 |
|
|
422 |
//////////////////////////////////////////////////////////////////////////
|
|
423 |
// SUBSCRIBE PRESENTITY GROUP CONTENT
|
|
424 |
//////////////////////////////////////////////////////////////////////////
|
|
425 |
|
|
426 |
// Setup status event listener for RequestComplete
|
|
427 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
428 |
|
|
429 |
// subscribe group content
|
|
430 |
MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC();
|
|
431 |
identity->SetIdentityL( KGroupId ); // << identity
|
|
432 |
|
|
433 |
reqId = presGroup.SubscribePresentityGroupContentL( *identity );
|
|
434 |
|
|
435 |
// Wait for events on the request
|
|
436 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
437 |
wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") );
|
|
438 |
|
|
439 |
COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL );
|
|
440 |
|
|
441 |
//////////////////////////////////////////////////////////////////////////
|
|
442 |
// SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE
|
|
443 |
//////////////////////////////////////////////////////////////////////////
|
|
444 |
|
|
445 |
// Setup status event listener for RequestComplete
|
|
446 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
447 |
|
|
448 |
// This is the group we are interested in
|
|
449 |
MXIMPIdentity* group = context->ObjectFactory().NewIdentityLC();
|
|
450 |
CleanupStack::Pop(); // group
|
|
451 |
group->SetIdentityL( KGroupId );
|
|
452 |
// Set filter for the group
|
|
453 |
//CPresenceInfoFilterImp* gpif = CPresenceInfoFilterImp::NewLC();
|
|
454 |
//gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage );
|
|
455 |
//gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar );
|
|
456 |
|
|
457 |
|
|
458 |
|
|
459 |
CPresenceInfoFilterImp* gpif =
|
|
460 |
XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 );
|
|
461 |
|
|
462 |
CleanupStack::Pop(gpif); // gpif
|
|
463 |
|
|
464 |
// register interest
|
|
465 |
reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *group, *gpif );
|
|
466 |
|
|
467 |
// Wait for events on the request
|
|
468 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
469 |
wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") );
|
|
470 |
|
|
471 |
// verify that UpdateInterest was called
|
|
472 |
COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
|
|
473 |
|
|
474 |
delete gpif;
|
|
475 |
|
|
476 |
|
|
477 |
//////////////////////////////////////////////////////////////////////////
|
|
478 |
// ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED
|
|
479 |
//////////////////////////////////////////////////////////////////////////
|
|
480 |
|
|
481 |
// Setup status event listener for RequestComplete
|
|
482 |
// This will also produce HandlePresentityGroupMemberAddedL, since the
|
|
483 |
// the group is subscribed
|
|
484 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
485 |
|
|
486 |
MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2
|
|
487 |
member2->SetIdentityL( KMemberId2 );
|
|
488 |
|
|
489 |
// do the call
|
|
490 |
reqId = presGroup.AddPresentityGroupMemberL(
|
|
491 |
*groupId, *member2, KMemberDisplayName2 );
|
|
492 |
|
|
493 |
// Wait for events on the request
|
|
494 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
495 |
wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") );
|
|
496 |
|
|
497 |
|
|
498 |
messenger->AssertAddPresentityGroupMemberCalled( ETrue );
|
|
499 |
CleanupStack::PopAndDestroy(); // >>> member2
|
|
500 |
|
|
501 |
|
|
502 |
|
|
503 |
//////////////////////////////////////////////////////////////////////////
|
|
504 |
// GRANT PRESENTITY GROUP MEMBER
|
|
505 |
//////////////////////////////////////////////////////////////////////////
|
|
506 |
|
|
507 |
// This is the group we are interested in
|
|
508 |
MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
|
|
509 |
CleanupStack::Pop(); // ggroup
|
|
510 |
ggroup->SetIdentityL( KGroupId );
|
|
511 |
// Set filter for the group
|
|
512 |
CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
|
|
513 |
//ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll );
|
|
514 |
CleanupStack::Pop(); // ggpif
|
|
515 |
|
|
516 |
// Setup status event listener for RequestComplete
|
|
517 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
518 |
|
|
519 |
// grant for all
|
|
520 |
reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
|
|
521 |
|
|
522 |
// Wait for events on the request
|
|
523 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
524 |
|
|
525 |
// verify that UpdateInterest was called
|
|
526 |
COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,
|
|
527 |
"GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
|
|
528 |
|
|
529 |
delete ggpif;
|
|
530 |
|
|
531 |
|
|
532 |
//////////////////////////////////////////////////////////////////////////
|
|
533 |
// WITHDRAW PRESENTITY GROUP MEMBER
|
|
534 |
//////////////////////////////////////////////////////////////////////////
|
|
535 |
|
|
536 |
|
|
537 |
// Setup status event listener for RequestComplete
|
|
538 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
539 |
|
|
540 |
// withdraw from all
|
|
541 |
reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup );
|
|
542 |
|
|
543 |
// Wait for events on the request
|
|
544 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
545 |
// verify that UpdateInterest was called
|
|
546 |
COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,
|
|
547 |
"GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
|
|
548 |
|
|
549 |
delete ggroup;
|
|
550 |
|
|
551 |
|
|
552 |
//////////////////////////////////////////////////////////////////////////
|
|
553 |
// UNSUBSCRIBE PRESENTITY GROUP MEMBERS
|
|
554 |
//////////////////////////////////////////////////////////////////////////
|
|
555 |
|
|
556 |
// Setup status event listener for RequestComplete
|
|
557 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
558 |
|
|
559 |
// unregister interest
|
|
560 |
reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *group );
|
|
561 |
|
|
562 |
// Wait for events on the request
|
|
563 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
564 |
wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group members, complete with error: ") );
|
|
565 |
|
|
566 |
// verify that UpdateInterest was called
|
|
567 |
COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL );
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
//////////////////////////////////////////////////////////////////////////
|
|
572 |
// UNSUBSCRIBE PRESENTITY GROUP CONTENT
|
|
573 |
//////////////////////////////////////////////////////////////////////////
|
|
574 |
|
|
575 |
// Setup status event listener for RequestComplete
|
|
576 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
577 |
|
|
578 |
// unsubscribe
|
|
579 |
reqId = presGroup.UnsubscribePresentityGroupContentL( *identity );
|
|
580 |
|
|
581 |
// Wait for events on the request
|
|
582 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
583 |
wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group content, complete with error: ") );
|
|
584 |
|
|
585 |
// verify that UnsubscribePresentityGroupContentL was called
|
|
586 |
messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue );
|
|
587 |
|
|
588 |
CleanupStack::PopAndDestroy(); // >>> identity
|
|
589 |
|
|
590 |
//////////////////////////////////////////////////////////////////////////
|
|
591 |
// UNSUBSCRIBE PRESENCE BLOCK LIST
|
|
592 |
//////////////////////////////////////////////////////////////////////////
|
|
593 |
|
|
594 |
// Setup status event listener for RequestComplete
|
|
595 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
596 |
|
|
597 |
// subscribe
|
|
598 |
reqId = presAuth.UnsubscribePresenceBlockListL();
|
|
599 |
|
|
600 |
// Wait for events on the request
|
|
601 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
602 |
wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") );
|
|
603 |
|
|
604 |
// verify that SubscribeBlockListL was called
|
|
605 |
COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnubscribeBlockListL was not called", ETrue, NULL );
|
|
606 |
|
|
607 |
//////////////////////////////////////////////////////////////////////////
|
|
608 |
// UNSUBSCRIBE PRESENTITY GROUP LIST
|
|
609 |
//////////////////////////////////////////////////////////////////////////
|
|
610 |
|
|
611 |
// Setup status event listener for RequestComplete
|
|
612 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
613 |
|
|
614 |
// unsubscribe
|
|
615 |
reqId = presGroup.UnsubscribePresentityGroupListL();
|
|
616 |
|
|
617 |
// Wait for events on the request
|
|
618 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
619 |
wrapper->VerifyEventStackL( _L8("Unsubscribing presentity group list, complete with error: ") );
|
|
620 |
|
|
621 |
// verify that SubscribePresentityGroupListL was called
|
|
622 |
messenger->AssertUnsubscribePresentityGroupListCalled( ETrue );
|
|
623 |
|
|
624 |
|
|
625 |
//////////////////////////////////////////////////////////////////////////
|
|
626 |
// UNSUBSCRIBE PRESENCE WATCHER LIST
|
|
627 |
//////////////////////////////////////////////////////////////////////////
|
|
628 |
|
|
629 |
// Setup status event listener for RequestComplete
|
|
630 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
631 |
|
|
632 |
// unsubscribe
|
|
633 |
reqId = presPub.UnsubscribePresenceWatcherListL();
|
|
634 |
|
|
635 |
// Wait for events on the request
|
|
636 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
637 |
wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") );
|
|
638 |
|
|
639 |
// verify that UnsubscribeWatcherListL was called
|
|
640 |
COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL );
|
|
641 |
|
|
642 |
|
|
643 |
////////////////////////////////////////////////////////////////////////////
|
|
644 |
// UNSUBSCRIBE OWN PRESENCE
|
|
645 |
////////////////////////////////////////////////////////////////////////////
|
|
646 |
// Setup status event listener for RequestComplete
|
|
647 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
648 |
|
|
649 |
// unsubscribe own presence
|
|
650 |
reqId = presPub.UnsubscribeOwnPresenceL();
|
|
651 |
|
|
652 |
// Wait for events on the request
|
|
653 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
654 |
|
|
655 |
wrapper->VerifyEventStackL( _L8("Unsubscribing own presence, complete with error: ") );
|
|
656 |
|
|
657 |
// verify that UnsubscribeOwnPresenceL was called
|
|
658 |
COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL );
|
|
659 |
|
|
660 |
CleanupStack::PopAndDestroy( ownPif ); // >>> ownPif
|
|
661 |
delete group;
|
|
662 |
delete groupId;
|
|
663 |
|
|
664 |
|
|
665 |
UnbindL();
|
|
666 |
|
|
667 |
wrapper = NULL;
|
|
668 |
context = NULL;
|
|
669 |
messenger = NULL;
|
|
670 |
|
|
671 |
|
|
672 |
|
|
673 |
}
|
|
674 |
|
|
675 |
// Grant/Withdraw from group
|
|
676 |
void T_PresenceAll::T_GrantWithdrawGroup_L()
|
|
677 |
{
|
|
678 |
EUNIT_PRINT( _L("T_GrantWithdrawGroup_L") );
|
|
679 |
|
|
680 |
BindL();
|
|
681 |
|
|
682 |
CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
|
|
683 |
MXIMPContext* context = wrapper->GetContext();
|
|
684 |
CXIMPTestMessenger* messenger = wrapper->GetMessenger();
|
|
685 |
|
|
686 |
// Tell the protocol it should act normally
|
|
687 |
messenger->SetNoError();
|
|
688 |
|
|
689 |
|
|
690 |
// Get the interfaces
|
|
691 |
MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures();
|
|
692 |
MPresencePublishing& presPub = presFeat->PresencePublishing();
|
|
693 |
MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization();
|
|
694 |
MPresentityGroups& presGroup = presFeat->PresentityGroups();
|
|
695 |
MPresenceWatching& presWatch = presFeat->PresenceWatching();
|
|
696 |
|
|
697 |
|
|
698 |
|
|
699 |
//////////////////////////////////////////////////////////////////////////
|
|
700 |
// CREATE PRESENTITY GROUP
|
|
701 |
/////////////////////////////////////////////////////////////////////////
|
|
702 |
|
|
703 |
// Setup status event listener for RequestComplete
|
|
704 |
// This will also produce HandlePresentityGroupListEvent, since the
|
|
705 |
// the group is subscribed
|
|
706 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
707 |
|
|
708 |
|
|
709 |
MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC();
|
|
710 |
CleanupStack::Pop(); // groupId
|
|
711 |
groupId->SetIdentityL( KGroupId );
|
|
712 |
|
|
713 |
// subscribe
|
|
714 |
TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName );
|
|
715 |
|
|
716 |
// Wait for events on the request
|
|
717 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
718 |
wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") );
|
|
719 |
|
|
720 |
// verify that SubscribePresentityGroupListL was called
|
|
721 |
messenger->AssertCreatePresentityGroupCalled( ETrue );
|
|
722 |
|
|
723 |
|
|
724 |
|
|
725 |
//////////////////////////////////////////////////////////////////////////
|
|
726 |
// ADD PRESENTITY GROUP MEMBER
|
|
727 |
//////////////////////////////////////////////////////////////////////////
|
|
728 |
|
|
729 |
CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context );
|
|
730 |
CleanupStack::PushL( listener4 ); // << listener4
|
|
731 |
|
|
732 |
MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member
|
|
733 |
member->SetIdentityL( KMemberId1 );
|
|
734 |
|
|
735 |
|
|
736 |
// request complete
|
|
737 |
TXIMPRequestId reqIdDummy;
|
|
738 |
CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy );
|
|
739 |
|
|
740 |
// group id
|
|
741 |
CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() );
|
|
742 |
evReqComplete->AppendParamL( identity2 );
|
|
743 |
CleanupStack::Pop(); // identity2
|
|
744 |
|
|
745 |
// id for member info
|
|
746 |
CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 );
|
|
747 |
// member info
|
|
748 |
CPresentityGroupMemberInfoImp* memInfoImp =
|
|
749 |
CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 );
|
|
750 |
evReqComplete->AppendParamL( memInfoImp );
|
|
751 |
CleanupStack::Pop(); // memInfoImp owned by AppendParamL
|
|
752 |
CleanupStack::PopAndDestroy( miId ); // copy was made
|
|
753 |
|
|
754 |
listener4->ExpectL( evReqComplete );
|
|
755 |
CleanupStack::Pop( evReqComplete );
|
|
756 |
|
|
757 |
// do the call
|
|
758 |
reqId = presGroup.AddPresentityGroupMemberL(
|
|
759 |
*groupId, *member, KMemberDisplayName1 );
|
|
760 |
|
|
761 |
// and wait
|
|
762 |
EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" );
|
|
763 |
|
|
764 |
messenger->AssertAddPresentityGroupMemberCalled( ETrue );
|
|
765 |
CleanupStack::PopAndDestroy(); // >>> member
|
|
766 |
CleanupStack::PopAndDestroy( listener4 );// >>> listener4
|
|
767 |
|
|
768 |
delete groupId;
|
|
769 |
|
|
770 |
//////////////////////////////////////////////////////////////////////////
|
|
771 |
// ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED
|
|
772 |
//////////////////////////////////////////////////////////////////////////
|
|
773 |
|
|
774 |
// Setup status event listener for RequestComplete
|
|
775 |
// This will also produce HandlePresentityGroupMemberAddedL, since the
|
|
776 |
// the group is subscribed
|
|
777 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
778 |
|
|
779 |
MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2
|
|
780 |
member2->SetIdentityL( KMemberId2 );
|
|
781 |
|
|
782 |
// do the call
|
|
783 |
reqId = presGroup.AddPresentityGroupMemberL(
|
|
784 |
*groupId, *member2, KMemberDisplayName2 );
|
|
785 |
|
|
786 |
// Wait for events on the request
|
|
787 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
788 |
wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") );
|
|
789 |
|
|
790 |
|
|
791 |
messenger->AssertAddPresentityGroupMemberCalled( ETrue );
|
|
792 |
CleanupStack::PopAndDestroy(); // >>> member2
|
|
793 |
|
|
794 |
|
|
795 |
|
|
796 |
//////////////////////////////////////////////////////////////////////////
|
|
797 |
// GRANT PRESENTITY GROUP MEMBER
|
|
798 |
//////////////////////////////////////////////////////////////////////////
|
|
799 |
|
|
800 |
// This is the group we are interested in
|
|
801 |
MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC();
|
|
802 |
CleanupStack::Pop(); // ggroup
|
|
803 |
ggroup->SetIdentityL( KGroupId );
|
|
804 |
// Set filter for the group
|
|
805 |
CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC();
|
|
806 |
ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll );
|
|
807 |
CleanupStack::Pop(); // ggpif
|
|
808 |
|
|
809 |
// Setup status event listener for RequestComplete
|
|
810 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
811 |
|
|
812 |
// grant for all
|
|
813 |
reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif );
|
|
814 |
|
|
815 |
// Wait for events on the request
|
|
816 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
817 |
|
|
818 |
// verify that UpdateInterest was called
|
|
819 |
COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,
|
|
820 |
"GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
|
|
821 |
|
|
822 |
delete ggpif;
|
|
823 |
|
|
824 |
|
|
825 |
|
|
826 |
//////////////////////////////////////////////////////////////////////////
|
|
827 |
// WITHDRAW PRESENTITY GROUP MEMBER
|
|
828 |
//////////////////////////////////////////////////////////////////////////
|
|
829 |
|
|
830 |
|
|
831 |
// Setup status event listener for RequestComplete
|
|
832 |
SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk );
|
|
833 |
|
|
834 |
// withdraw from all
|
|
835 |
reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup );
|
|
836 |
|
|
837 |
// Wait for events on the request
|
|
838 |
wrapper->WaitRequestAndStackEvents( reqId );
|
|
839 |
// verify that UpdateInterest was called
|
|
840 |
COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled,
|
|
841 |
"GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL );
|
|
842 |
|
|
843 |
delete ggroup;
|
|
844 |
|
|
845 |
UnbindL();
|
|
846 |
|
|
847 |
wrapper = NULL;
|
|
848 |
context = NULL;
|
|
849 |
messenger = NULL;
|
|
850 |
|
|
851 |
}
|
|
852 |
|
|
853 |
|
|
854 |
// ===========================================================================
|
|
855 |
// SETUP HELPERS FOR THE LISTENER
|
|
856 |
// ===========================================================================
|
|
857 |
//
|
|
858 |
void T_PresenceAll::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
|
|
859 |
{
|
|
860 |
RArray< TInt32 > array;
|
|
861 |
CleanupClosePushL( array );
|
|
862 |
array.Append( MXIMPContextStateEvent::KInterfaceId );
|
|
863 |
array.Append( MPresentityPresenceEvent::KInterfaceId );
|
|
864 |
aWrapper->SetupListenerReqCompleteL( aEventType, &array );
|
|
865 |
CleanupStack::PopAndDestroy(); // array
|
|
866 |
}
|
|
867 |
|
|
868 |
void T_PresenceAll::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType )
|
|
869 |
{
|
|
870 |
RArray< TInt32 > array;
|
|
871 |
CleanupClosePushL( array );
|
|
872 |
array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId );
|
|
873 |
array.AppendL( MXIMPContextStateEvent::KInterfaceId );
|
|
874 |
array.AppendL( MPresentityPresenceEvent::KInterfaceId );
|
|
875 |
aWrapper->SetupListenerReqCompleteL( aEventType, &array );
|
|
876 |
CleanupStack::PopAndDestroy(); // array
|
|
877 |
}
|
|
878 |
|
|
879 |
void T_PresenceAll::SendSrvMsgL(
|
|
880 |
const TDesC& aUri, const TDesC& aDispName,
|
|
881 |
TInt aMsgType )
|
|
882 |
{
|
|
883 |
// we'll use hard-coded wrapper 0 instance for now.
|
|
884 |
CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
|
|
885 |
|
|
886 |
// create a group info contained within the server-originated
|
|
887 |
// faked message
|
|
888 |
CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri );
|
|
889 |
CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName );
|
|
890 |
HBufC8* packet = NULL;
|
|
891 |
if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete )
|
|
892 |
{
|
|
893 |
packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId );
|
|
894 |
}
|
|
895 |
else
|
|
896 |
{
|
|
897 |
packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem );
|
|
898 |
}
|
|
899 |
CleanupStack::PushL( packet );
|
|
900 |
|
|
901 |
// use filetool to send it for plugin.
|
|
902 |
CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet );
|
|
903 |
CleanupStack::PushL( srvMsg );
|
|
904 |
wrapper->FileTool().CleanAllL();
|
|
905 |
wrapper->FileTool().SrvMsgStoreL( srvMsg );
|
|
906 |
CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId
|
|
907 |
}
|
|
908 |
|
|
909 |
// send a faked server-originated message with empty contents
|
|
910 |
//
|
|
911 |
void T_PresenceAll::SendSrvMsgL( TInt aMsgType )
|
|
912 |
{
|
|
913 |
// we'll use hard-coded wrapper 0 instance for now.
|
|
914 |
CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
|
|
915 |
|
|
916 |
// create a server-originated faked message with empty contents
|
|
917 |
RXIMPObjOwningPtrArray<CPresentityGroupInfoImp> groupList;
|
|
918 |
|
|
919 |
HBufC8* packedArray = TXIMPObjectPacker<CPresentityGroupInfoImp>::PackArrayL( groupList );
|
|
920 |
CleanupStack::PushL( packedArray );
|
|
921 |
|
|
922 |
// use filetool to send it for plugin.
|
|
923 |
CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType,
|
|
924 |
*packedArray );
|
|
925 |
CleanupStack::PushL( srvMsg );
|
|
926 |
wrapper->FileTool().CleanAllL();
|
|
927 |
wrapper->FileTool().SrvMsgStoreL( srvMsg );
|
|
928 |
CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray
|
|
929 |
}
|
|
930 |
|
|
931 |
|
|
932 |
void T_PresenceAll::T_BindUnbindL()
|
|
933 |
{
|
|
934 |
EUNIT_PRINT( _L("T_BindUnbindL") );
|
|
935 |
|
|
936 |
BindL();
|
|
937 |
|
|
938 |
CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
|
|
939 |
MXIMPContext* context = wrapper->GetContext();
|
|
940 |
CXIMPTestMessenger* messenger = wrapper->GetMessenger();
|
|
941 |
|
|
942 |
// Tell the protocol it should act normally
|
|
943 |
messenger->SetNoError();
|
|
944 |
|
|
945 |
|
|
946 |
UnbindL();
|
|
947 |
|
|
948 |
wrapper = NULL;
|
|
949 |
context = NULL;
|
|
950 |
messenger = NULL;
|
|
951 |
}
|
|
952 |
// ===========================================================================
|
|
953 |
// TEST CASE TABLE
|
|
954 |
// ===========================================================================
|
|
955 |
//
|
|
956 |
EUNIT_BEGIN_TEST_TABLE(
|
|
957 |
T_PresenceAll,
|
|
958 |
"XIMP presence all tests",
|
|
959 |
"MODULE" )
|
|
960 |
|
|
961 |
PRFW_DECORATED_TEST(
|
|
962 |
"TMO_demo_Startup",
|
|
963 |
"",
|
|
964 |
"",
|
|
965 |
"FUNCTIONALITY",
|
|
966 |
Setup_L,
|
|
967 |
T_TMO_demo_Startup_L,
|
|
968 |
Teardown )
|
|
969 |
|
|
970 |
PRFW_DECORATED_TEST(
|
|
971 |
"BindUnbind",
|
|
972 |
"",
|
|
973 |
"",
|
|
974 |
"FUNCTIONALITY",
|
|
975 |
Setup_L,
|
|
976 |
T_BindUnbindL,
|
|
977 |
Teardown )
|
|
978 |
|
|
979 |
PRFW_DECORATED_TEST(
|
|
980 |
"GrantWithdrawGroup",
|
|
981 |
"",
|
|
982 |
"",
|
|
983 |
"FUNCTIONALITY",
|
|
984 |
Setup_L,
|
|
985 |
T_GrantWithdrawGroup_L,
|
|
986 |
Teardown )
|
|
987 |
|
|
988 |
EUNIT_END_TEST_TABLE
|
|
989 |
|
|
990 |
|
|
991 |
// ===========================================================================
|
|
992 |
// TEST SUITE CONSTRUCTION
|
|
993 |
// ===========================================================================
|
|
994 |
//
|
|
995 |
EXPORT_C MEUnitTest* CreateTestSuiteL()
|
|
996 |
{
|
|
997 |
return T_PresenceAll::NewL();
|
|
998 |
}
|
|
999 |
|
|
1000 |
|
|
1001 |
// end of file
|