|
1 // Copyright (c) 2005-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 // The server waits for the idle read to be cancelled by the sync command, and then sends a '* 2 EXISTS' command to indicate that |
|
15 // a new message has arrived. |
|
16 // 2. The client connects to the server, requests a sync and a populate. |
|
17 // 3. Client / server interact to complete the sync and populate. One message is fetched. |
|
18 // 4. The client requests a full sync (causing the idle read cancel). |
|
19 // 5. The server indicates a new message has arrived |
|
20 // 6. Client / server interact to complete the full sync. The new message is fetched |
|
21 // 7. The client requests a full sync (causing the idle read cancel). |
|
22 // 8. The server indicates a new message has arrived |
|
23 // 9. Client / server interact to complete the full sync. The new message is fetched |
|
24 // 10. The client disconnects. |
|
25 // |
|
26 // |
|
27 |
|
28 /** |
|
29 @SYMTestCaseID DEF067159 |
|
30 @SYMTestType UT |
|
31 @SYMTestPriority High |
|
32 @SYMDEF DEF067159 |
|
33 @SYMTestCaseDesc IMAP spoof server test that checks that a new message indication is correctly handled if idle read is being cancelled during a sync |
|
34 @SYMTestActions 1. The Server is started and listens on port 143. |
|
35 @SYMTestExpectedResults Client should have fetched three messages |
|
36 */ |
|
37 |
|
38 #include "T_ImapNewMsgDuringSyncIdleCancelServer.h" |
|
39 #include "T_ImapNewMsgDuringSyncIdleCancelStep.h" |
|
40 |
|
41 _LIT(KServerName,"T_ImapNewMsgDuringSyncIdleCancel"); |
|
42 |
|
43 CImapNewMsgDuringSyncIdleCancelServer* CImapNewMsgDuringSyncIdleCancelServer::NewL() |
|
44 { |
|
45 CImapNewMsgDuringSyncIdleCancelServer * server = new (ELeave) CImapNewMsgDuringSyncIdleCancelServer(); |
|
46 CleanupStack::PushL(server); |
|
47 server->ConstructL(KServerName); |
|
48 |
|
49 CleanupStack::Pop(server); |
|
50 return server; |
|
51 } |
|
52 |
|
53 CImapNewMsgDuringSyncIdleCancelServer::CImapNewMsgDuringSyncIdleCancelServer() |
|
54 {} |
|
55 |
|
56 CImapNewMsgDuringSyncIdleCancelServer::~CImapNewMsgDuringSyncIdleCancelServer() |
|
57 {} |
|
58 |
|
59 LOCAL_C void MainL() |
|
60 { |
|
61 CActiveScheduler* sched=NULL; |
|
62 sched=new(ELeave) CActiveScheduler; |
|
63 CleanupStack::PushL(sched); |
|
64 CActiveScheduler::Install(sched); |
|
65 CImapNewMsgDuringSyncIdleCancelServer* server = NULL; |
|
66 // Create the CTestServer derived server |
|
67 TRAPD(err,server = CImapNewMsgDuringSyncIdleCancelServer::NewL()); |
|
68 CleanupStack::PushL(server); |
|
69 if(!err) |
|
70 { |
|
71 // Sync with the client and enter the active scheduler |
|
72 RProcess::Rendezvous(KErrNone); |
|
73 sched->Start(); |
|
74 } |
|
75 CleanupStack::PopAndDestroy(2,sched); |
|
76 } |
|
77 |
|
78 GLDEF_C TInt E32Main() |
|
79 { |
|
80 __UHEAP_MARK; |
|
81 |
|
82 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
83 if(cleanup == NULL) |
|
84 { |
|
85 return KErrNoMemory; |
|
86 } |
|
87 TRAPD(err,MainL()); |
|
88 delete cleanup; |
|
89 |
|
90 __UHEAP_MARKEND; |
|
91 return err; |
|
92 } |
|
93 |
|
94 RFs& CImapNewMsgDuringSyncIdleCancelServer::Fs() |
|
95 { |
|
96 return iFs; |
|
97 }; |
|
98 |
|
99 CTestStep* CImapNewMsgDuringSyncIdleCancelServer::CreateTestStep(const TDesC& aStepName) |
|
100 { |
|
101 CTestStep* testStep = NULL; |
|
102 |
|
103 if(aStepName == KTestImapNewMsgDuringSyncIdleCancel) |
|
104 testStep = new CImapNewMsgDuringSyncIdleCancelStep(); |
|
105 |
|
106 return testStep; |
|
107 } |