|
1 // Copyright (c) 2008-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 "ctestimapservermtmbase.h" |
|
18 #include "ctestimapservermtmcreate.h" |
|
19 |
|
20 #include <miuthdr.h> |
|
21 |
|
22 CTestImapServerMtmCreate::CTestImapServerMtmCreate( ) |
|
23 { |
|
24 |
|
25 } |
|
26 |
|
27 CTestImapServerMtmCreate::~CTestImapServerMtmCreate( ) |
|
28 { |
|
29 |
|
30 } |
|
31 |
|
32 void CTestImapServerMtmCreate::TestCreateFolderWhenNotOnlineL( ) |
|
33 { |
|
34 INFO_PRINTF1( _L( "TestCreateFolderWhenNotOnlineL" ) ); |
|
35 |
|
36 // No Spoofserver needed |
|
37 DoFolderCreateL( (TMsvId) iImapAccount.iImapService, _L( "testfolder" ) ); |
|
38 ASSERT_EQUALS( iActiveWaiter->iStatus.Int( ), KErrNone ); |
|
39 |
|
40 // check progress |
|
41 const TDesC8& progBuf = iImapServerMtm->Progress( ); |
|
42 |
|
43 TImap4CompoundProgress temp; |
|
44 TPckgC<TImap4CompoundProgress> paramPack( temp ); |
|
45 |
|
46 paramPack.Set( progBuf ); |
|
47 TImap4CompoundProgress progress = paramPack( ); |
|
48 |
|
49 ASSERT_EQUALS( progress.iGenericProgress.iType, EImap4GenericProgressType ); |
|
50 ASSERT_EQUALS( progress.iGenericProgress.iOperation, TImap4GenericProgress::EConnect ); |
|
51 ASSERT_EQUALS( progress.iGenericProgress.iState, TImap4GenericProgress::EDisconnected ); |
|
52 ASSERT_EQUALS( progress.iGenericProgress.iImap4SubStateProgress, TImap4GenericProgress::EDisconnected ); |
|
53 ASSERT_EQUALS( progress.iGenericProgress.iMsgsToDo, 0 ); |
|
54 ASSERT_EQUALS( progress.iGenericProgress.iMsgsDone, 0 ); |
|
55 ASSERT_EQUALS( progress.iGenericProgress.iPartsToDo, 0 ); |
|
56 ASSERT_EQUALS( progress.iGenericProgress.iPartsDone, 0 ); |
|
57 ASSERT_EQUALS( progress.iGenericProgress.iBytesToDo, 0 ); |
|
58 ASSERT_EQUALS( progress.iGenericProgress.iBytesDone, 0 ); |
|
59 ASSERT_EQUALS( progress.iGenericProgress.iErrorCode, KErrDisconnected ); |
|
60 ASSERT_EQUALS( progress.iGenericProgress.iReturnedMsvId, ( TMsvId ) 0 ); |
|
61 ASSERT_EQUALS( progress.iGenericProgress.iTotalSize, 0 ); |
|
62 |
|
63 ASSERT_EQUALS( progress.iSyncProgress.iType, EImap4SyncProgressType ); |
|
64 ASSERT_EQUALS( progress.iSyncProgress.iState, TImap4SyncProgress::EIdle ); |
|
65 ASSERT_EQUALS( progress.iSyncProgress.iFoldersToDo, 0 ); |
|
66 ASSERT_EQUALS( progress.iSyncProgress.iFoldersDone, 0 ); |
|
67 ASSERT_EQUALS( progress.iSyncProgress.iMsgsToDo, 0 ); |
|
68 ASSERT_EQUALS( progress.iSyncProgress.iMsgsDone, 0 ); |
|
69 ASSERT_EQUALS( progress.iSyncProgress.iHeadersFetched, 0 ); |
|
70 ASSERT_EQUALS( progress.iSyncProgress.iOrphanedFolders, 0 ); |
|
71 ASSERT_EQUALS( progress.iSyncProgress.iNewFolders, 0 ); |
|
72 ASSERT_EQUALS( progress.iSyncProgress.iOrphanedMessages, 0 ); |
|
73 ASSERT_EQUALS( progress.iSyncProgress.iRemoteMessagesDeleteTagged, 0 ); |
|
74 ASSERT_EQUALS( progress.iSyncProgress.iMessagesFetchedOK, 0 ); |
|
75 ASSERT_EQUALS( progress.iSyncProgress.iMessagePartsFetchedOK, 0 ); |
|
76 ASSERT_EQUALS( progress.iSyncProgress.iMessagePartsNotFound, 0 ); |
|
77 ASSERT_EQUALS( progress.iSyncProgress.iFoldersNotFound, 0 ); |
|
78 ASSERT_EQUALS( progress.iSyncProgress.iErrorCode, 0 ); |
|
79 |
|
80 INFO_PRINTF1( _L( "TestCreateFolderWhenNotOnlineL completed" ) ); |
|
81 } |
|
82 |
|
83 void CTestImapServerMtmCreate::TestCreateFolderWhenOnlineL( ) |
|
84 { |
|
85 INFO_PRINTF1( _L( "TestCreateFolderWhenOnlineL" ) ); |
|
86 DoStartSpoofServerL( _L( "spoofserver_connect_when_connected_script" ) ); |
|
87 |
|
88 DoConnectL( ); |
|
89 ASSERT_EQUALS( iActiveWaiter->iStatus.Int( ), KErrNone ); |
|
90 |
|
91 DoFolderCreateL( (TMsvId) iImapAccount.iImapService, _L( "testfolder" ) ); |
|
92 ASSERT_EQUALS( iActiveWaiter->iStatus.Int( ), KErrNone ); |
|
93 |
|
94 // check progress |
|
95 const TDesC8& progBuf = iImapServerMtm->Progress( ); |
|
96 |
|
97 TImap4CompoundProgress temp; |
|
98 TPckgC<TImap4CompoundProgress> paramPack( temp ); |
|
99 |
|
100 paramPack.Set( progBuf ); |
|
101 TImap4CompoundProgress progress = paramPack( ); |
|
102 |
|
103 DoDisconnectL( ); |
|
104 ASSERT_EQUALS( iActiveWaiter->iStatus.Int( ), KErrNone ); |
|
105 |
|
106 INFO_PRINTF1( _L( "TestCreateFolderWhenOnlineL completed" ) ); |
|
107 } |
|
108 |
|
109 void CTestImapServerMtmCreate::TestCreateMailboxWhenNotOnlineL( ) |
|
110 { |
|
111 INFO_PRINTF1( _L( "TestCreateMailboxWhenNotOnlineL" ) ); |
|
112 |
|
113 INFO_PRINTF1( _L( "TestCreateMailboxWhenNotOnlineL completed" ) ); |
|
114 } |
|
115 |
|
116 void CTestImapServerMtmCreate::TestCreateMailboxWhenOnlineL( ) |
|
117 { |
|
118 INFO_PRINTF1( _L( "TestCreateMailboxWhenOnlineL" ) ); |
|
119 |
|
120 INFO_PRINTF1( _L( "TestCreateMailboxWhenOnlineL completed" ) ); |
|
121 } |
|
122 |
|
123 CTestSuite* CTestImapServerMtmCreate::CreateSuiteL( const TDesC& aName ) |
|
124 { |
|
125 SUB_SUITE; |
|
126 // ADD_ASYNC_TEST_STEP( TestCreateFolderWhenNotOnlineL ); |
|
127 ADD_ASYNC_TEST_STEP( TestCreateFolderWhenOnlineL ); |
|
128 // ADD_ASYNC_TEST_STEP( TestCreateMailboxWhenNotOnlineL ); |
|
129 // ADD_ASYNC_TEST_STEP( TestCreateMailboxWhenOnlineL ); |
|
130 END_SUITE; |
|
131 } |
|
132 |
|
133 void CTestImapServerMtmCreate::DoFolderCreateL( TMsvId /*aParent*/, const TDesC& /*aName*/ ) |
|
134 { |
|
135 // TODO |
|
136 |
|
137 /* // create the msventry |
|
138 TMsvEmailEntry newEntry; |
|
139 newEntry.iType = KUidMsvFolderEntry; |
|
140 newEntry.iMtm = KUidMsgTypeIMAP4; |
|
141 newEntry.iServiceId = iImapAccount.iImapService; |
|
142 newEntry.iSize = 0; |
|
143 newEntry.iDetails.Set( aName ); |
|
144 newEntry.SetMailbox( ETrue ); |
|
145 newEntry.SetValidUID( EFalse ); |
|
146 newEntry.SetComplete( ETrue ); |
|
147 newEntry.SetVisible( ETrue ); |
|
148 // User::LeaveIfError( entry->CreateEntry( newEntry ) ); |
|
149 |
|
150 // tell the IMAP server about it |
|
151 iImapServerMtm->CreateL( newEntry, iActiveWaiter->iStatus ); |
|
152 iActiveWaiter->WaitActive( ); |
|
153 */ |
|
154 } |