imservices/instantmessagingcache/tsrc/src/imcache_testBlocks.cpp
branchRCL_3
changeset 44 482d5cf4c4b4
parent 0 e6b17d312c8b
child 50 338724211739
equal deleted inserted replaced
43:113b91e0a2ad 44:482d5cf4c4b4
   271 //
   271 //
   272 TInt Cimcache_test::FetchExistingMessageL( CStifItemParser& /*aItem*/ )
   272 TInt Cimcache_test::FetchExistingMessageL( CStifItemParser& /*aItem*/ )
   273     {
   273     {
   274      CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
   274      CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
   275 	 TInt error = KErrNotFound;  
   275 	 TInt error = KErrNotFound;  
       
   276 	 iMessageFetch = 0;
   276 	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
   277 	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue);
   277 	 // tow message appended hence counter will be two.
   278 	 // tow message appended hence counter will be two.
   278 	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test first message appended") ) ;
   279 	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test first message appended") ) ;
   279 	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test second message appended") ) ;
   280 	 updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test second message appended") ) ;
   280 	  
   281 	  
   281      updater->RegisterObserverL(*this);
   282      updater->RegisterObserverL(*this);
   282      
   283      
   283      if( !iWait.IsStarted() )
   284  /*    if( !iWait.IsStarted() )
   284           {
   285           {
   285           iWait.Start(); 
   286           iWait.Start(); 
   286           }
   287           }*/
   287      
   288      
   288  	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
   289  	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
   289 	 
   290 	 
   290 	 if( !iWait.IsStarted() )
   291 	 if( !iWait.IsStarted() )
   291          {
   292          {
   413 // -----------------------------------------------------------------------------
   414 // -----------------------------------------------------------------------------
   414 //
   415 //
   415 TInt Cimcache_test::ConversationUnExistTestL(CStifItemParser& /*aItem*/) 
   416 TInt Cimcache_test::ConversationUnExistTestL(CStifItemParser& /*aItem*/) 
   416 	{
   417 	{
   417 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
   418 	 CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); 
   418 	   
   419 	 MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue );
       
   420 	 updater->RegisterObserverL(*this);
       
   421 	 
       
   422 	 updater->StartNewConversationL( _L("testui123@gmail.com") ) ;
       
   423 	  	
       
   424 	 	 if( !iWait.IsStarted() )
       
   425 	 		 {
       
   426 	 		 iWait.Start();	
       
   427 	 		 }
       
   428 	 	 
       
   429 	 updater->CloseAllConversationL();	
       
   430 	 	 
   419 	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
   431 	 MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") );
   420 	// not yest conversation open so must be EFalse here
   432 	// not yest conversation open so must be EFalse here
   421  	 TBool ret = accessor->IsConversationExistL(_L("testui123@gmail.com") );
   433  	 TBool ret = accessor->IsConversationExistL(_L("testui123@gmail.com") );
   422  	 
   434  	 updater->UnRegisterObserver(*this);
   423 	 CIMCacheFactory::Release();
   435 	 CIMCacheFactory::Release();
   424 	 
   436 	 
   425 	 if(!ret)
   437 	 if(!ret)
   426 		 {
   438 		 {
   427 		 return KErrNone;	
   439 		 return KErrNone;	
   615 				break;
   627 				break;
   616 				}
   628 				}
   617 			case EIMCacheNewMessage :
   629 			case EIMCacheNewMessage :
   618 				{
   630 				{
   619 				iMessageFetch++;
   631 				iMessageFetch++;
   620                 if( iWait.IsStarted() && iMessageFetch == 2 )
   632                 if( iWait.IsStarted() /*&& iMessageFetch == 2 */)
   621                     {
   633                     {
   622                     iWait.AsyncStop(); 
   634                     iWait.AsyncStop(); 
   623                     }
   635                     }
   624 				break;
   636 				break;
   625 				}
   637 				}