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