|
1 // Copyright (c) 2004-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 #ifndef __CMTF_TEST_ACTION_COMPARE_EMAIL_MESSAGES_H__ |
|
17 #define __CMTF_TEST_ACTION_COMPARE_EMAIL_MESSAGES_H__ |
|
18 |
|
19 // System include |
|
20 #include <msvapi.h> |
|
21 |
|
22 |
|
23 // User include |
|
24 #include "CMtfSynchronousTestAction.h" |
|
25 #include "CMtfTestActionUtilsEmailMessage.h" |
|
26 |
|
27 /*@{*/ |
|
28 // Literal defined for the name of the Test Action |
|
29 _LIT(KTestActionCompareEmailMessages,"CompareEmailMessages"); |
|
30 /*@}*/ |
|
31 |
|
32 |
|
33 // class forward declaration |
|
34 class CMtfTestParameter; |
|
35 |
|
36 |
|
37 /** |
|
38 Implements the test action to compare the sent and received email messages |
|
39 based on the partial/full download limits set. |
|
40 @internalTechnology |
|
41 */ |
|
42 class CMtfTestActionCompareEmailMessages : public CMtfSynchronousTestAction |
|
43 { |
|
44 public: |
|
45 |
|
46 static CMtfTestAction* NewL(CMtfTestCase& aTestCase, |
|
47 CMtfTestActionParameters* ActionParameters |
|
48 ); |
|
49 // Destructor |
|
50 virtual ~CMtfTestActionCompareEmailMessages(); |
|
51 |
|
52 virtual void ExecuteActionL(); |
|
53 |
|
54 private: |
|
55 // Constructor |
|
56 CMtfTestActionCompareEmailMessages( CMtfTestCase& aTestCase ); |
|
57 |
|
58 // Store the partial or full download limits received as input |
|
59 void SetDownloadLimits(); |
|
60 |
|
61 // Delete the sent and received message information stored |
|
62 void DeleteEmailMessageInfo(); |
|
63 |
|
64 // Set the sent and received message information |
|
65 void SetEmailMessageInfoL( CMsvEntry& sentMsvEntry, CMsvEntry& recvMsvEntry ); |
|
66 |
|
67 // Main function for comparing the sent and received messages |
|
68 void CompareEmailMessagesL( const CMsvEntrySelection& aSentMsgSelection, |
|
69 const CMsvEntrySelection& aRecvMsgSelection ); |
|
70 |
|
71 |
|
72 // Compare the sent and received messages which have the same Subject field |
|
73 // when partial download limits is set |
|
74 void CompareMessagesWithPartialDownloadLimitsSetL(); |
|
75 |
|
76 // Compare the sent and received messages which have the same Subject field |
|
77 // when full download limits is set |
|
78 void CompareMessagesWithFullDownloadLimitsSetL(); |
|
79 |
|
80 // Compare messages when Full download limits with Headers Only option is set |
|
81 void CompareMessageWithGetHeadersOptionSetL(); |
|
82 |
|
83 // Compare messages when the whole message has to be downloaded |
|
84 void CompareCompleteDownloadOfMessageL(); |
|
85 |
|
86 // Compare messages when Download Attachments Only option is set |
|
87 void CompareMessageWithAttachmentsOnlyOptionSetL(); |
|
88 |
|
89 // Compare messages when Full download limits is set and the message size is |
|
90 // greater than the size limit |
|
91 void CompareMessageFullDownloadWhenMsgSizeGreaterThanLimitL(); |
|
92 |
|
93 // Compare messages when Partial download with Body text and Attachment option is set |
|
94 void CompareMessagePartialDownloadWithBodyTextAndAttachmentsL(); |
|
95 |
|
96 // Compare messages when Partial download with ECumulative option is set |
|
97 void CompareMessageDownloadWithCumulativeOptionSetL(); |
|
98 |
|
99 // Compares the contents and flags of the Plain text part of the message. |
|
100 void ComparePlainBodyTextL(TBool aCompleteDownload); |
|
101 |
|
102 // Check if the footer message exists in the Body text part |
|
103 TInt CheckIfFooterMessageExists(TPtrC aBodyText); |
|
104 |
|
105 // Checks if any server message has been added to the Body text |
|
106 void CheckIfServerMessageExists(TPtrC aBodyText, TInt& aServerMsgLentght, |
|
107 TInt& aServerMsgPosition); |
|
108 |
|
109 // Compares the contents and the flags for the Html part of the message |
|
110 void CompareHtmlL(); |
|
111 |
|
112 // Compares the flag settings and contents of attachments |
|
113 void CompareAttachmentsL(); |
|
114 |
|
115 // Check if the count of attachments in the received message is correct |
|
116 void CheckAttachmentCountL(TInt aSentMsgAttachmentCount, TInt aRecvMsgAttachmentCount); |
|
117 |
|
118 // Checks if the attachment was supposed to be downloaded when |
|
119 // Partial download limit is set |
|
120 TBool CheckIfAttachmentTobeDownloadedWithPartialDownloadSet(const TDesC& aAttachmentName, TInt32 aAttachmentSize); |
|
121 |
|
122 // Checks if the attachment was supposed to be downloaded when |
|
123 // Full download limit is set |
|
124 TBool CheckIfAttachmentTobeDownloadedWithCompleteDownloadSet(const TDesC& aAttachmentName); |
|
125 |
|
126 |
|
127 // Checks the complete and partial flag settings for the specified message part |
|
128 void CheckFlagSettingsL(TMsvId aMsgPartId, TBool expectedCompleteFlagVal, |
|
129 TBool expectedPartialFlagVal); |
|
130 |
|
131 // Checks the complete flag setting for specified attachment |
|
132 void CheckFlagSettingsL(CMsvAttachment& aMsgPart, TBool aExpectedCompleteFlagVal); |
|
133 |
|
134 // Compares the contents of two files, the file path are provided as inputs |
|
135 void CompareFilesL(const TPtrC aSentFilePath, const TPtrC aRecvFilePath, |
|
136 TInt& aError, TBool& aDiffFlag); |
|
137 |
|
138 // Check if the Test Case result is EPass |
|
139 inline TBool IsTestCaseStatusPass(); |
|
140 |
|
141 private: |
|
142 enum TMtfDownloadType |
|
143 { |
|
144 /** Partial download limit is set */ |
|
145 EPartialDownload, |
|
146 /** Full download limit is */ |
|
147 EFullDownload |
|
148 }; |
|
149 |
|
150 /** Session object */ |
|
151 CMsvSession* iParamSession; |
|
152 |
|
153 /** To know whether a partial for download limit is set */ |
|
154 TMtfDownloadType iDownloadType; |
|
155 |
|
156 /** To store Full download limits */ |
|
157 TImImap4GetMailInfo iImapCompleteDownloadLimits; |
|
158 |
|
159 /** To store Partial download limits */ |
|
160 TImImap4GetPartialMailInfo iImapPartialDownloadLimits; |
|
161 |
|
162 /** To store cumulative size when TImImap4PartialMailOptions::ECumulative is set */ |
|
163 TInt32 iCumulativeSize; |
|
164 |
|
165 /** Utility class object storing the information of the sent email message*/ |
|
166 CMtfTestActionUtilsEmailMessage* iSentMessageInfo; |
|
167 |
|
168 /** Utility class object storing the information of the received email message*/ |
|
169 CMtfTestActionUtilsEmailMessage* iRecvMessageInfo; |
|
170 }; |
|
171 |
|
172 #include "CMtfTestActionCompareEmailMessages.inl" |
|
173 |
|
174 #endif //__CMTF_TEST_ACTION_COMPARE_EMAIL_MESSAGES_H__ |