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