email/imap4mtm/imapservermtm/test/src/ctestimapservermtmsynchronise.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "cactivewaiter.h"
       
    17 #include "ctestimapservermtmsynchronise.h"
       
    18 
       
    19 
       
    20 CTestImapServerMtmSynchronise::CTestImapServerMtmSynchronise( )
       
    21 	{
       
    22 	
       
    23 	}
       
    24 	
       
    25 CTestImapServerMtmSynchronise::~CTestImapServerMtmSynchronise( )
       
    26 	{
       
    27 	
       
    28 	}
       
    29 	
       
    30 void CTestImapServerMtmSynchronise::TestSynchroniseWithInboxSelectedL( )
       
    31 	{
       
    32 	
       
    33 	INFO_PRINTF1( _L( "TestSynchroniseWithInboxSelectedL" ) );
       
    34 	
       
    35 	DoStartSpoofServerL( _L( "spoofserver_synchronise_with_inbox_selected_script" ) );
       
    36 
       
    37 	DoConnectL( );
       
    38 	ASSERT_EQUALS( iActiveWaiter->iStatus.Int( ), KErrNone );
       
    39 
       
    40 	DoSynchroniseL( );
       
    41 	ASSERT_EQUALS( iActiveWaiter->iStatus.Int( ), KErrNone );
       
    42 	
       
    43 	// check progress
       
    44 	const TDesC8& progBuf = iImapServerMtm->Progress( );
       
    45 	
       
    46 	TImap4CompoundProgress temp;    
       
    47 	TPckgC<TImap4CompoundProgress> paramPack( temp );
       
    48 
       
    49 	paramPack.Set( progBuf );
       
    50 	TImap4CompoundProgress progress = paramPack( );   
       
    51 /*	
       
    52 	ASSERT_EQUALS( progress.iGenericProgress.iType, EImap4GenericProgressType );
       
    53 	ASSERT_EQUALS( progress.iGenericProgress.iOperation, TImap4GenericProgress::EDisconnect );
       
    54 	ASSERT_EQUALS( progress.iGenericProgress.iState, TImap4GenericProgress::EDisconnected );
       
    55 	ASSERT_EQUALS( progress.iGenericProgress.iImap4SubStateProgress, TImap4GenericProgress::EIdle );
       
    56 	ASSERT_EQUALS( progress.iGenericProgress.iMsgsToDo, 0 );
       
    57 	ASSERT_EQUALS( progress.iGenericProgress.iMsgsDone, 0 );
       
    58 	ASSERT_EQUALS( progress.iGenericProgress.iPartsToDo, 0 );
       
    59 	ASSERT_EQUALS( progress.iGenericProgress.iPartsDone, 0 );
       
    60 	ASSERT_EQUALS( progress.iGenericProgress.iBytesToDo, 0 );
       
    61 	ASSERT_EQUALS( progress.iGenericProgress.iBytesDone, 0 );
       
    62 	ASSERT_EQUALS( progress.iGenericProgress.iErrorCode, 0 );
       
    63 	ASSERT_EQUALS( progress.iGenericProgress.iReturnedMsvId, ( TMsvId ) 0 );
       
    64 	ASSERT_EQUALS( progress.iGenericProgress.iTotalSize, 0 );
       
    65 
       
    66 	ASSERT_EQUALS( progress.iSyncProgress.iType, EImap4SyncProgressType );
       
    67 	ASSERT_EQUALS( progress.iSyncProgress.iState, TImap4SyncProgress::EIdle );
       
    68 	ASSERT_EQUALS( progress.iSyncProgress.iFoldersToDo, 0 );
       
    69 	ASSERT_EQUALS( progress.iSyncProgress.iFoldersDone, 0 );
       
    70 	ASSERT_EQUALS( progress.iSyncProgress.iMsgsToDo, 0 );
       
    71 	ASSERT_EQUALS( progress.iSyncProgress.iMsgsDone, 0 );
       
    72 	ASSERT_EQUALS( progress.iSyncProgress.iHeadersFetched, 0 );
       
    73 	ASSERT_EQUALS( progress.iSyncProgress.iOrphanedFolders, 0 );
       
    74 	ASSERT_EQUALS( progress.iSyncProgress.iNewFolders, 0 );
       
    75 	ASSERT_EQUALS( progress.iSyncProgress.iOrphanedMessages, 0 );
       
    76 	ASSERT_EQUALS( progress.iSyncProgress.iRemoteMessagesDeleteTagged, 0 );
       
    77 	ASSERT_EQUALS( progress.iSyncProgress.iMessagesFetchedOK, 0 );
       
    78 	ASSERT_EQUALS( progress.iSyncProgress.iMessagePartsFetchedOK, 0 );
       
    79 	ASSERT_EQUALS( progress.iSyncProgress.iMessagePartsNotFound, 0 );
       
    80 	ASSERT_EQUALS( progress.iSyncProgress.iFoldersNotFound, 0 );
       
    81 	ASSERT_EQUALS( progress.iSyncProgress.iErrorCode, 0 );	
       
    82 */
       
    83 
       
    84 	DoDisconnectL( );
       
    85 	ASSERT_EQUALS( iActiveWaiter->iStatus.Int( ), KErrNone );
       
    86 
       
    87 	INFO_PRINTF1( _L( "TestSynchroniseWithInboxSelectedL completed" ) );
       
    88 	
       
    89 	}
       
    90 	
       
    91 void CTestImapServerMtmSynchronise::DoSynchroniseL( )
       
    92 	{
       
    93 	INFO_PRINTF1( _L( "Synchronising" ) );
       
    94 	iSelection->Reset( );
       
    95 	iImapServerMtm->StartCommandL( *iSelection,
       
    96 								   KIMAP4MTMSynchronise,
       
    97 								   KNullDesC8,
       
    98 								   iActiveWaiter->iStatus );
       
    99 	iActiveWaiter->WaitActive( );
       
   100 	INFO_PRINTF1( _L( "Synchronising completed" ) );
       
   101 	}
       
   102 	
       
   103 CTestSuite* CTestImapServerMtmSynchronise::CreateSuiteL( const TDesC& aName )
       
   104 	{
       
   105 	SUB_SUITE;
       
   106 	ADD_ASYNC_TEST_STEP( TestSynchroniseWithInboxSelectedL );
       
   107 	END_SUITE;
       
   108 	
       
   109 	}