| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * ============================================================================== | |||
| 3 | * Name : t_vimpstcmdprocess_cmdfactory_utestCases.cpp | |||
| 4 | * Part of : vimpstcmdprocess_utest | |||
| 5 | * | |||
| 6 | * Description : vimpstcmdprocess_utest test module. | |||
| 7 | * Version: %version: 3 % | |||
| 8 | * | |||
| 9 | * Copyright (C) 2002 - 2007 Nokia Corporation. | |||
| 10 | * This material, including documentation and any related | |||
| 11 | * computer programs, is protected by copyright controlled by | |||
| 12 | * Nokia Corporation. All rights are reserved. Copying, | |||
| 13 | * including reproducing, storing, adapting or translating, any | |||
| 14 | * or all of this material requires the prior written consent of | |||
| 15 | * Nokia Corporation. This material also contains confidential | |||
| 16 | * information which may not be disclosed to others without the | |||
| 17 | * prior written consent of Nokia Corporation. | |||
| 18 | * | |||
| 19 | * ============================================================================ | |||
| 20 | */ | |||
| 21 | ||||
| 22 | /** | |||
| 23 | * GLOBAL VARIABLES SECTION | |||
| 24 | */ | |||
| 25 | #ifdef TEST_VAR_DECLARATIONS | |||
| 26 | //Global variable declration | |||
| 27 | #endif | |||
| 28 | /** | |||
| 29 | * END OF GLOBAL VARIABLES SECTION | |||
| 30 | */ | |||
| 31 | ||||
| 32 | ||||
| 33 | /** | |||
| 34 | * TEST CASES SECTION | |||
| 35 | */ | |||
| 36 | #ifdef TEST_CASES | |||
| 37 | /** | |||
| 38 | * STIF_SETUP defines activities needed before every test case. | |||
| 39 | */ | |||
| 40 | STIF_SETUP | |||
| 41 | { | |||
| 42 | //No set up required | |||
| 43 | } | |||
| 44 | ||||
| 45 | /** | |||
| 46 | * STIF_TEARDOWN defines activities needed after every test case | |||
| 47 | */ | |||
| 48 | STIF_TEARDOWN | |||
| 49 | { | |||
| 50 | ||||
| 51 | } | |||
| 52 | ||||
| 53 | /** | |||
| 54 | * STIF_TESTDEFINE defines a test case | |||
| 55 | * | |||
| 56 | * Example test case - length of string is checked. | |||
| 57 | * The only argument of macro is a name of test case. | |||
| 58 | */ | |||
| 59 | STIF_TESTDEFINE(t_CreateCommand_login) | |||
| 60 | { | |||
| 61 | vimpstengine_stub engin; | |||
| 62 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 63 | TInt data = 1; | |||
| 64 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ELoginService,&data) ; | |||
| 65 | //delete factory; | |||
| 66 | //factory = NULL; | |||
| 67 | TInt comm_sent = ELoginService; | |||
| 68 | TInt comm_recev = commd->CommandId(); | |||
| 69 | commd->ExecuteLD(); | |||
| 70 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 71 | } | |||
| 72 | ||||
| 73 | ||||
| 74 | STIF_TESTDEFINE(t_CreateCommand_logout) | |||
| 75 | { | |||
| 76 | vimpstengine_stub engin; | |||
| 77 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 78 | TInt data = 1; | |||
| 79 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ELogoutService,&data) ; | |||
| 80 | TInt comm_sent = ELogoutService; | |||
| 81 | TInt comm_recev = commd->CommandId(); | |||
| 82 | commd->ExecuteLD(); | |||
| 83 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 84 | } | |||
| 85 | ||||
| 86 | STIF_TESTDEFINE(t_CreateCommand_LaunchCCA) | |||
| 87 | { | |||
| 88 | vimpstengine_stub engin; | |||
| 89 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 90 | TLaunchCCAData data; | |||
| 91 | data.iIndex = 1; | |||
| 92 | data.iConnection = MCCAConnectionStub::NewL(); | |||
| 93 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ELaunchCCA,&data) ; | |||
| 94 | TInt comm_sent = ELaunchCCA; | |||
| 95 | TInt comm_recev = commd->CommandId(); | |||
| 96 | //commd->ExecuteLD(); | |||
| 97 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 98 | } | |||
| 99 | ||||
| 100 | STIF_TESTDEFINE(t_CreateCommand_AddContact) | |||
| 101 | { | |||
| 102 | vimpstengine_stub engin; | |||
| 103 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 104 | TInt data = 1; | |||
| 105 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EAddContact,&data) ; | |||
| 106 | TInt comm_sent = EAddContact; | |||
| 107 | TInt comm_recev = commd->CommandId(); | |||
| 108 | commd->ExecuteLD(); | |||
| 109 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 110 | } | |||
| 111 | ||||
| 112 | STIF_TESTDEFINE(t_CreateCommand_DeleteContact) | |||
| 113 | { | |||
| 114 | vimpstengine_stub engin; | |||
| 115 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 116 | TInt data = 1; | |||
| 117 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EDeleteContact,&data) ; | |||
| 118 | delete factory; | |||
| 119 | factory = NULL; | |||
| 120 | TInt comm_sent = EDeleteContact; | |||
| 121 | TInt comm_recev = commd->CommandId(); | |||
| 122 | commd->ExecuteLD(); | |||
| 123 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 124 | } | |||
| 125 | ||||
| 126 | ||||
| 127 | STIF_TESTDEFINE(t_CreateCommand_ChangeOwnStatus) | |||
| 128 | { | |||
| 129 | vimpstengine_stub engin; | |||
| 130 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 131 | TStatusAndStatusText status; | |||
| 132 | _LIT(KStatusMsg,"away"); | |||
| 133 | status.iStatusText.Copy(KStatusMsg); | |||
| 134 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EChangeOwnStatus,&status) ; | |||
| 135 | delete factory; | |||
| 136 | factory = NULL; | |||
| 137 | TInt comm_sent = EChangeOwnStatus; | |||
| 138 | TInt comm_recev = commd->CommandId(); | |||
| 139 | commd->ExecuteLD(); | |||
| 140 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 141 | } | |||
| 142 | ||||
| 143 | STIF_TESTDEFINE(t_CreateCommand_ChangeOwnMessage) | |||
| 144 | { | |||
| 145 | vimpstengine_stub engin; | |||
| 146 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 147 | ||||
| 148 | TStatusAndStatusText status; | |||
| 149 | _LIT(KStatusMsg,"away"); | |||
| 150 | status.iStatusText.Copy(KStatusMsg); | |||
| 151 | ||||
| 152 | TInt data = 1; | |||
| 153 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EChangeOwnMessage,&status) ; | |||
| 154 | delete factory; | |||
| 155 | factory = NULL; | |||
| 156 | TInt comm_sent = EChangeOwnMessage; | |||
| 157 | TInt comm_recev = commd->CommandId(); | |||
| 158 | commd->ExecuteLD(); | |||
| 159 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 160 | } | |||
| 161 | ||||
| 162 | STIF_TESTDEFINE(t_CreateCommand_Search) | |||
| 163 | { | |||
| 164 | vimpstengine_stub engin; | |||
| 165 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 166 | RArray<TVIMPSTSearchKeyData> aKeyDataArray; | |||
| 167 | ||||
| 168 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ESearch,&aKeyDataArray) ; | |||
| 169 | delete factory; | |||
| 170 | factory = NULL; | |||
| 171 | TInt comm_sent = ESearch; | |||
| 172 | TInt comm_recev = commd->CommandId(); | |||
| 173 | commd->ExecuteLD(); | |||
| 174 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 175 | } | |||
| 176 | ||||
| 177 | ||||
| 178 | STIF_TESTDEFINE(t_CreateCommand_FriendRejected) | |||
| 179 | { | |||
| 180 | vimpstengine_stub engin; | |||
| 181 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 182 | _LIT(KContactId,"contact"); | |||
| 183 | TBufC<10> buf (KContactId); | |||
| 184 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EFriendRejected, &buf) ; | |||
| 185 | delete factory; | |||
| 186 | factory = NULL; | |||
| 187 | TInt comm_sent = EFriendRejected; | |||
| 188 | TInt comm_recev = commd->CommandId(); | |||
| 189 | commd->ExecuteLD(); | |||
| 190 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 191 | } | |||
| 192 | ||||
| 193 | ||||
| 194 | STIF_TESTDEFINE(t_CreateCommand_ChangeOwnAvtar) | |||
| 195 | { | |||
| 196 | vimpstengine_stub engin; | |||
| 197 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 198 | TAvatarData data; | |||
| 199 | ||||
| 200 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EChangeOwnAvtar,&data) ; | |||
| 201 | delete factory; | |||
| 202 | factory = NULL; | |||
| 203 | TInt comm_sent = EChangeOwnAvtar; | |||
| 204 | TInt comm_recev = commd->CommandId(); | |||
| 205 | commd->ExecuteLD(); | |||
| 206 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 207 | } | |||
| 208 | ||||
| 209 | ||||
| 210 | STIF_TESTDEFINE(t_CreateCommand_CloseConversation) | |||
| 211 | { | |||
| 212 | vimpstengine_stub engin; | |||
| 213 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 214 | _LIT(KContactId,"contact"); | |||
| 215 | TBufC<10> buf(KContactId); | |||
| 216 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECloseConversation,&buf) ; | |||
| 217 | delete factory; | |||
| 218 | factory = NULL; | |||
| 219 | TInt comm_sent = ECloseConversation; | |||
| 220 | TInt comm_recev = commd->CommandId(); | |||
| 221 | commd->ExecuteLD(); | |||
| 222 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 223 | } | |||
| 224 | ||||
| 225 | ||||
| 226 | STIF_TESTDEFINE(t_CreateCommand_AddToPbk) | |||
| 227 | { | |||
| 228 | vimpstengine_stub engin; | |||
| 229 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 230 | ||||
| 231 | vimpststoragecontact_stub store; | |||
| 232 | ||||
| 233 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EAddToPbk,&store) ; | |||
| 234 | delete factory; | |||
| 235 | factory = NULL; | |||
| 236 | TInt comm_sent = EAddToPbk; | |||
| 237 | TInt comm_recev = commd->CommandId(); | |||
| 238 | commd->ExecuteLD(); | |||
| 239 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 240 | } | |||
| 241 | ||||
| 242 | ||||
| 243 | STIF_TESTDEFINE(t_CreateCommand_CancelLogin) | |||
| 244 | { | |||
| 245 | vimpstengine_stub engin; | |||
| 246 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 247 | TInt data = 1; | |||
| 248 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECancelLogin,&data) ; | |||
| 249 | delete factory; | |||
| 250 | factory = NULL; | |||
| 251 | TInt comm_sent = ECancelLogin; | |||
| 252 | TInt comm_recev = commd->CommandId(); | |||
| 253 | commd->ExecuteLD(); | |||
| 254 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 255 | } | |||
| 256 | ||||
| 257 | STIF_TESTDEFINE(t_CreateCommand_ProcessAcceptedContactNew) | |||
| 258 | { | |||
| 259 | vimpstengine_stub engin; | |||
| 260 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 261 | TVPbkSelectedData iSelectedData; | |||
| 262 | ||||
| 263 | _LIT8(KContactId,"contact"); | |||
| 264 | TPtrC8 buddy = KContactId; | |||
| 265 | iSelectedData.iPackedLinks = buddy.AllocL(); | |||
| 266 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessAcceptedContactNew,&iSelectedData) ; | |||
| 267 | //delete factory; | |||
| 268 | //factory = NULL; | |||
| 269 | TInt comm_sent = ECmdProcessAcceptedContactNew; | |||
| 270 | TInt comm_recev = commd->CommandId(); | |||
| 271 | commd->ExecuteLD(); | |||
| 272 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 273 | } | |||
| 274 | STIF_TESTDEFINE(t_CreateCommand_ProcessSelectedContactNew) | |||
| 275 | { | |||
| 276 | vimpstengine_stub engin; | |||
| 277 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 278 | TVPbkSelectedData iSelectedData; | |||
| 279 | ||||
| 280 | _LIT8(KContactId,"contact"); | |||
| 281 | TPtrC8 buddy = KContactId; | |||
| 282 | iSelectedData.iPackedLinks = buddy.AllocL(); | |||
| 283 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessSelectedContactNew,&iSelectedData) ; | |||
| 284 | //delete factory; | |||
| 285 | //factory = NULL; | |||
| 286 | TInt comm_sent = ECmdProcessSelectedContactNew; | |||
| 287 | TInt comm_recev = commd->CommandId(); | |||
| 288 | commd->ExecuteLD(); | |||
| 289 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 290 | } | |||
| 291 | STIF_TESTDEFINE(t_CreateCommand_ProcessAcceptedContactExist) | |||
| 292 | { | |||
| 293 | vimpstengine_stub engin; | |||
| 294 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 295 | TVPbkSelectedData iSelectedData; | |||
| 296 | ||||
| 297 | _LIT8(KContactId,"contact"); | |||
| 298 | TPtrC8 buddy = KContactId; | |||
| 299 | iSelectedData.iPackedLinks = buddy.AllocL(); | |||
| 300 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessAcceptedContactExist,&iSelectedData) ; | |||
| 301 | //delete factory; | |||
| 302 | //factory = NULL; | |||
| 303 | TInt comm_sent = ECmdProcessAcceptedContactExist; | |||
| 304 | TInt comm_recev = commd->CommandId(); | |||
| 305 | commd->ExecuteLD(); | |||
| 306 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 307 | } | |||
| 308 | STIF_TESTDEFINE(t_CreateCommand_ProcessSelectedContactExist) | |||
| 309 | { | |||
| 310 | vimpstengine_stub engin; | |||
| 311 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 312 | TVPbkSelectedData iSelectedData; | |||
| 313 | ||||
| 314 | _LIT8(KContactId,"contact"); | |||
| 315 | TPtrC8 buddy = KContactId; | |||
| 316 | iSelectedData.iPackedLinks = buddy.AllocL(); | |||
| 317 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessSelectedContactExist,&iSelectedData) ; | |||
| 318 | //delete factory; | |||
| 319 | //factory = NULL; | |||
| 320 | TInt comm_sent = ECmdProcessSelectedContactExist; | |||
| 321 | TInt comm_recev = commd->CommandId(); | |||
| 322 | commd->ExecuteLD(); | |||
| 323 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 324 | } | |||
| 325 | ||||
| 326 | //============================ExecuteLD--------------------- | |||
| 327 | ||||
| 328 | STIF_TESTDEFINE(t_ExeCommand_login) | |||
| 329 | { | |||
| 330 | vimpstengine_stub engin; | |||
| 331 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 332 | TInt data = 1; | |||
| 333 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ELoginService,&data) ; | |||
| 334 | TInt comm_sent = ELoginService; | |||
| 335 | TInt comm_recev = commd->CommandId(); | |||
| 336 | vimpstcmdobserver_stub ob; | |||
| 337 | commd->AddObserver(ob); | |||
| 338 | commd->ExecuteLD(); | |||
| 339 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 340 | } | |||
| 341 | ||||
| 342 | ||||
| 343 | STIF_TESTDEFINE(t_ExeCommand_logout) | |||
| 344 | { | |||
| 345 | vimpstengine_stub engin; | |||
| 346 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 347 | TInt data = 1; | |||
| 348 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ELogoutService,&data) ; | |||
| 349 | TInt comm_sent = ELogoutService; | |||
| 350 | TInt comm_recev = commd->CommandId(); | |||
| 351 | vimpstcmdobserver_stub ob; | |||
| 352 | commd->AddObserver(ob); | |||
| 353 | commd->ExecuteLD(); | |||
| 354 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 355 | } | |||
| 356 | ||||
| 357 | STIF_TESTDEFINE(t_ExeCommand_LaunchCCA) | |||
| 358 | {/* | |||
| 359 | vimpstengine_stub engin; | |||
| 360 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 361 | TLaunchCCAData data; | |||
| 362 | data.iIndex = 2; | |||
| 363 | //TInt data = 1; | |||
| 364 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ELaunchCCA,&data) ; | |||
| 365 | TInt comm_sent = ELaunchCCA; | |||
| 366 | TInt comm_recev = commd->CommandId(); | |||
| 367 | vimpstcmdobserver_stub ob; | |||
| 368 | commd->AddObserver(ob); | |||
| 369 | //commd->iIndex = 0; | |||
| 370 | commd->ExecuteLD(); | |||
| 371 | STIF_ASSERT_EQUALS(comm_sent, comm_recev );*/ | |||
| 372 | } | |||
| 373 | STIF_TESTDEFINE(t_ExeCommand_AddContact) | |||
| 374 | { | |||
| 375 | vimpstengine_stub engin; | |||
| 376 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 377 | TInt data = 1; | |||
| 378 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EAddContact,&data) ; | |||
| 379 | TInt comm_sent = EAddContact; | |||
| 380 | TInt comm_recev = commd->CommandId(); | |||
| 381 | vimpstcmdobserver_stub ob; | |||
| 382 | commd->AddObserver(ob); | |||
| 383 | commd->ExecuteLD(); | |||
| 384 | ||||
| 385 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 386 | } | |||
| 387 | ||||
| 388 | STIF_TESTDEFINE(t_ExeCommand_DeleteContact) | |||
| 389 | { | |||
| 390 | vimpstengine_stub engin; | |||
| 391 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 392 | TInt data = 1; | |||
| 393 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EDeleteContact,&data) ; | |||
| 394 | delete factory; | |||
| 395 | factory = NULL; | |||
| 396 | TInt comm_sent = EDeleteContact; | |||
| 397 | TInt comm_recev = commd->CommandId(); | |||
| 398 | vimpstcmdobserver_stub ob; | |||
| 399 | commd->AddObserver(ob); | |||
| 400 | commd->ExecuteLD(); | |||
| 401 | ||||
| 402 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 403 | } | |||
| 404 | ||||
| 405 | ||||
| 406 | STIF_TESTDEFINE(t_ExeCommand_ChangeOwnStatus) | |||
| 407 | { | |||
| 408 | vimpstengine_stub engin; | |||
| 409 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 410 | TStatusAndStatusText status; | |||
| 411 | _LIT(KStatusMsg,"away"); | |||
| 412 | status.iStatusText.Copy(KStatusMsg); | |||
| 413 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EChangeOwnStatus,&status) ; | |||
| 414 | delete factory; | |||
| 415 | factory = NULL; | |||
| 416 | TInt comm_sent = EChangeOwnStatus; | |||
| 417 | TInt comm_recev = commd->CommandId(); | |||
| 418 | vimpstcmdobserver_stub ob; | |||
| 419 | commd->AddObserver(ob); | |||
| 420 | commd->ExecuteLD(); | |||
| 421 | ||||
| 422 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 423 | } | |||
| 424 | ||||
| 425 | STIF_TESTDEFINE(t_ExeCommand_ChangeOwnMessage) | |||
| 426 | { | |||
| 427 | vimpstengine_stub engin; | |||
| 428 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 429 | ||||
| 430 | TStatusAndStatusText status; | |||
| 431 | _LIT(KStatusMsg,"away"); | |||
| 432 | status.iStatusText.Copy(KStatusMsg); | |||
| 433 | ||||
| 434 | TInt data = 1; | |||
| 435 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EChangeOwnMessage,&status) ; | |||
| 436 | delete factory; | |||
| 437 | factory = NULL; | |||
| 438 | TInt comm_sent = EChangeOwnMessage; | |||
| 439 | TInt comm_recev = commd->CommandId(); | |||
| 440 | vimpstcmdobserver_stub ob; | |||
| 441 | commd->AddObserver(ob); | |||
| 442 | commd->ExecuteLD(); | |||
| 443 | ||||
| 444 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 445 | } | |||
| 446 | ||||
| 447 | STIF_TESTDEFINE(t_ExeCommand_Search) | |||
| 448 | { | |||
| 449 | vimpstengine_stub engin; | |||
| 450 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 451 | RArray<TVIMPSTSearchKeyData> aKeyDataArray; | |||
| 452 | ||||
| 453 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ESearch,&aKeyDataArray) ; | |||
| 454 | delete factory; | |||
| 455 | factory = NULL; | |||
| 456 | TInt comm_sent = ESearch; | |||
| 457 | TInt comm_recev = commd->CommandId(); | |||
| 458 | vimpstcmdobserver_stub ob; | |||
| 459 | commd->AddObserver(ob); | |||
| 460 | commd->ExecuteLD(); | |||
| 461 | ||||
| 462 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 463 | } | |||
| 464 | ||||
| 465 | ||||
| 466 | STIF_TESTDEFINE(t_ExeCommand_FriendRejected) | |||
| 467 | { | |||
| 468 | vimpstengine_stub engin; | |||
| 469 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 470 | _LIT(KContactId,"contact"); | |||
| 471 | TBufC<10> buf (KContactId); | |||
| 472 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EFriendRejected, &buf) ; | |||
| 473 | delete factory; | |||
| 474 | factory = NULL; | |||
| 475 | TInt comm_sent = EFriendRejected; | |||
| 476 | TInt comm_recev = commd->CommandId(); | |||
| 477 | vimpstcmdobserver_stub ob; | |||
| 478 | commd->AddObserver(ob); | |||
| 479 | commd->ExecuteLD(); | |||
| 480 | ||||
| 481 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 482 | } | |||
| 483 | ||||
| 484 | ||||
| 485 | STIF_TESTDEFINE(t_ExeCommand_ChangeOwnAvtar) | |||
| 486 | { | |||
| 487 | vimpstengine_stub engin; | |||
| 488 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 489 | TAvatarData data; | |||
| 490 | ||||
| 491 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EChangeOwnAvtar,&data) ; | |||
| 492 | delete factory; | |||
| 493 | factory = NULL; | |||
| 494 | TInt comm_sent = EChangeOwnAvtar; | |||
| 495 | TInt comm_recev = commd->CommandId(); | |||
| 496 | vimpstcmdobserver_stub ob; | |||
| 497 | commd->AddObserver(ob); | |||
| 498 | commd->ExecuteLD(); | |||
| 499 | ||||
| 500 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 501 | } | |||
| 502 | ||||
| 503 | ||||
| 504 | STIF_TESTDEFINE(t_ExeCommand_CloseConversation) | |||
| 505 | { | |||
| 506 | vimpstengine_stub engin; | |||
| 507 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 508 | _LIT(KContactId,"contact"); | |||
| 509 | TBufC<10> buf(KContactId); | |||
| 510 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECloseConversation,&buf) ; | |||
| 511 | delete factory; | |||
| 512 | factory = NULL; | |||
| 513 | TInt comm_sent = ECloseConversation; | |||
| 514 | TInt comm_recev = commd->CommandId(); | |||
| 515 | vimpstcmdobserver_stub ob; | |||
| 516 | commd->AddObserver(ob); | |||
| 517 | commd->ExecuteLD(); | |||
| 518 | ||||
| 519 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 520 | } | |||
| 521 | ||||
| 522 | ||||
| 523 | STIF_TESTDEFINE(t_ExeCommand_AddToPbk) | |||
| 524 | { | |||
| 525 | vimpstengine_stub engin; | |||
| 526 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 527 | ||||
| 528 | vimpststoragecontact_stub store; | |||
| 529 | ||||
| 530 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EAddToPbk,&store) ; | |||
| 531 | delete factory; | |||
| 532 | factory = NULL; | |||
| 533 | TInt comm_sent = EAddToPbk; | |||
| 534 | TInt comm_recev = commd->CommandId(); | |||
| 535 | vimpstcmdobserver_stub ob; | |||
| 536 | commd->AddObserver(ob); | |||
| 537 | commd->ExecuteLD(); | |||
| 538 | ||||
| 539 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 540 | } | |||
| 541 | ||||
| 542 | ||||
| 543 | STIF_TESTDEFINE(t_ExeCommand_CancelLogin) | |||
| 544 | { | |||
| 545 | vimpstengine_stub engin; | |||
| 546 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 547 | TInt data = 1; | |||
| 548 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECancelLogin,&data) ; | |||
| 549 | delete factory; | |||
| 550 | factory = NULL; | |||
| 551 | TInt comm_sent = ECancelLogin; | |||
| 552 | TInt comm_recev = commd->CommandId(); | |||
| 553 | vimpstcmdobserver_stub ob; | |||
| 554 | commd->AddObserver(ob); | |||
| 555 | commd->ExecuteLD(); | |||
| 556 | ||||
| 557 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 558 | } | |||
| 559 | ||||
| 560 | //Test case for Block/unblock... | |||
| 561 | ||||
| 562 | STIF_TESTDEFINE(t_CreateCommand_BlockContact) | |||
| 563 | { | |||
| 564 | vimpstengine_stub engin; | |||
| 565 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 566 | _LIT(KContactId,"contact"); | |||
| 567 | TBufC<10> buf (KContactId); | |||
| 568 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdBlockContact, &buf) ; | |||
| 569 | delete factory; | |||
| 570 | factory = NULL; | |||
| 571 | TInt comm_sent = ECmdBlockContact; | |||
| 572 | TInt comm_recev = commd->CommandId(); | |||
| 573 | ||||
| 574 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 575 | } | |||
| 576 | ||||
| 577 | STIF_TESTDEFINE(t_CreateCommand_UnBlockContact) | |||
| 578 | { | |||
| 579 | vimpstengine_stub engin; | |||
| 580 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 581 | _LIT(KContactId,"contact"); | |||
| 582 | TBufC<10> buf (KContactId); | |||
| 583 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdUnBlockContact, &buf) ; | |||
| 584 | delete factory; | |||
| 585 | factory = NULL; | |||
| 586 | TInt comm_sent = ECmdUnBlockContact; | |||
| 587 | TInt comm_recev = commd->CommandId(); | |||
| 588 | ||||
| 589 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 590 | } | |||
| 591 | ||||
| 592 | STIF_TESTDEFINE(t_ExecuteCommand_BlockContact) | |||
| 593 | { | |||
| 594 | vimpstengine_stub engin; | |||
| 595 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 596 | _LIT(KContactId,"contact"); | |||
| 597 | TBufC<10> buf (KContactId); | |||
| 598 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdBlockContact, &buf) ; | |||
| 599 | delete factory; | |||
| 600 | factory = NULL; | |||
| 601 | vimpstcmdobserver_stub observer; | |||
| 602 | commd->AddObserver(observer); | |||
| 603 | TInt comm_sent = ECmdBlockContact; | |||
| 604 | TInt comm_recev = commd->CommandId(); | |||
| 605 | TRAPD(err,commd->ExecuteLD()); | |||
| 606 | ||||
| 607 | STIF_ASSERT_EQUALS(err, KErrNone ); | |||
| 608 | } | |||
| 609 | ||||
| 610 | STIF_TESTDEFINE(t_ExecuteCommand_UnBlockContact) | |||
| 611 | { | |||
| 612 | vimpstengine_stub engin; | |||
| 613 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 614 | _LIT(KContactId,"contact"); | |||
| 615 | TBufC<10> buf (KContactId); | |||
| 616 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdUnBlockContact, &buf) ; | |||
| 617 | delete factory; | |||
| 618 | factory = NULL; | |||
| 619 | vimpstcmdobserver_stub observer; | |||
| 620 | commd->AddObserver(observer); | |||
| 621 | TInt comm_sent = ECmdUnBlockContact; | |||
| 622 | TInt comm_recev = commd->CommandId(); | |||
| 623 | TRAPD(err,commd->ExecuteLD()); | |||
| 624 | ||||
| 625 | STIF_ASSERT_EQUALS(err, KErrNone); | |||
| 626 | } | |||
| 627 | STIF_TESTDEFINE(t_ExecuteCommand_FetchBlockContactList) | |||
| 628 | { | |||
| 629 | vimpstengine_stub engin; | |||
| 630 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 631 | _LIT(KContactId,"contact"); | |||
| 632 | TBufC<10> buf (KContactId); | |||
| 633 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(EFetchBlockedList) ; | |||
| 634 | delete factory; | |||
| 635 | factory = NULL; | |||
| 636 | vimpstcmdobserver_stub observer; | |||
| 637 | commd->AddObserver(observer); | |||
| 638 | TInt comm_sent = EFetchBlockedList; | |||
| 639 | TInt comm_recev = commd->CommandId(); | |||
| 640 | TRAPD(err,commd->ExecuteLD()); | |||
| 641 | ||||
| 642 | STIF_ASSERT_EQUALS(err, KErrNone); | |||
| 643 | } | |||
| 644 | STIF_TESTDEFINE(t_ExecuteCommand_ProcessAcceptedContactNew) | |||
| 645 | { | |||
| 646 | vimpstengine_stub engin; | |||
| 647 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 648 | TVPbkSelectedData iSelectedData; | |||
| 649 | ||||
| 650 | _LIT8(KPackedlink,"packedlink"); | |||
| 651 | TPtrC8 link = KPackedlink; | |||
| 652 | iSelectedData.iPackedLinks = link.AllocL(); | |||
| 653 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessAcceptedContactNew,&iSelectedData) ; | |||
| 654 | //delete factory; | |||
| 655 | //factory = NULL; | |||
| 656 | vimpstcmdobserver_stub observer; | |||
| 657 | commd->AddObserver(observer); | |||
| 658 | TInt comm_sent = ECmdProcessAcceptedContactNew; | |||
| 659 | TInt comm_recev = commd->CommandId(); | |||
| 660 | commd->ExecuteLD(); | |||
| 661 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 662 | } | |||
| 663 | ||||
| 664 | STIF_TESTDEFINE(t_ExecuteCommand_ProcessSelectedContactNew) | |||
| 665 | { | |||
| 666 | vimpstengine_stub engin; | |||
| 667 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 668 | TVPbkSelectedData iSelectedData; | |||
| 669 | ||||
| 670 | _LIT8(KPackedlink,"packedlink"); | |||
| 671 | TPtrC8 link = KPackedlink; | |||
| 672 | iSelectedData.iPackedLinks = link.AllocL(); | |||
| 673 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessSelectedContactNew,&iSelectedData) ; | |||
| 674 | //delete factory; | |||
| 675 | //factory = NULL; | |||
| 676 | vimpstcmdobserver_stub observer; | |||
| 677 | commd->AddObserver(observer); | |||
| 678 | TInt comm_sent = ECmdProcessSelectedContactNew; | |||
| 679 | TInt comm_recev = commd->CommandId(); | |||
| 680 | commd->ExecuteLD(); | |||
| 681 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 682 | } | |||
| 683 | ||||
| 684 | STIF_TESTDEFINE(t_ExecuteCommand_ProcessAcceptedContactExist) | |||
| 685 | { | |||
| 686 | vimpstengine_stub engin; | |||
| 687 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 688 | TVPbkSelectedData iSelectedData; | |||
| 689 | ||||
| 690 | _LIT8(KPackedlink,"packedlink"); | |||
| 691 | TPtrC8 link = KPackedlink; | |||
| 692 | iSelectedData.iPackedLinks = link.AllocL(); | |||
| 693 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessAcceptedContactExist,&iSelectedData) ; | |||
| 694 | //delete factory; | |||
| 695 | //factory = NULL; | |||
| 696 | vimpstcmdobserver_stub observer; | |||
| 697 | commd->AddObserver(observer); | |||
| 698 | TInt comm_sent = ECmdProcessAcceptedContactExist; | |||
| 699 | TInt comm_recev = commd->CommandId(); | |||
| 700 | commd->ExecuteLD(); | |||
| 701 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 702 | } | |||
| 703 | ||||
| 704 | STIF_TESTDEFINE(t_ExecuteCommand_ProcessSelectedContactExist) | |||
| 705 | { | |||
| 706 | vimpstengine_stub engin; | |||
| 707 | CVIMPSTCmdFactory *factory = CVIMPSTCmdFactory::NewL(engin); | |||
| 708 | TVPbkSelectedData iSelectedData; | |||
| 709 | ||||
| 710 | _LIT8(KPackedlink,"packedlink"); | |||
| 711 | TPtrC8 link = KPackedlink; | |||
| 712 | iSelectedData.iPackedLinks = link.AllocL(); | |||
| 713 | MVIMPSTCmd* commd = factory->CreateCommandForIdL(ECmdProcessSelectedContactExist,&iSelectedData) ; | |||
| 714 | //delete factory; | |||
| 715 | //factory = NULL; | |||
| 716 | vimpstcmdobserver_stub observer; | |||
| 717 | commd->AddObserver(observer); | |||
| 718 | TInt comm_sent = ECmdProcessSelectedContactExist; | |||
| 719 | TInt comm_recev = commd->CommandId(); | |||
| 720 | commd->ExecuteLD(); | |||
| 721 | STIF_ASSERT_EQUALS(comm_sent, comm_recev ); | |||
| 722 | } | |||
| 723 | ||||
| 724 | #endif | |||
| 725 | /** | |||
| 726 | * END OF TEST CASES SECTION | |||
| 727 | */ | |||
| ***TER 100% (0/0) of SOURCE FILE t_vimpstcmdprocess_cmdfactory_utestcases.cpp | ||||