author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
24 |
//#include <SAPI_TEST\testprg.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
25 |
#include <StifTestInterface.h> |
19 | 26 |
#include <msvids.h> |
27 |
#include <msvapi.h> |
|
28 |
#include "messageheader.h" |
|
29 |
#include "messagingservice.h" |
|
30 |
////#include <senduiconsts.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
31 |
#include "tdeletemessagetest.h" |
19 | 32 |
|
33 |
||
34 |
||
35 |
||
36 |
// ----------------------------------------------------------------------------- |
|
37 |
// CTDeleteMessageTest::Delete |
|
38 |
// Delete here all resources allocated and opened from test methods. |
|
39 |
// Called from destructor. |
|
40 |
// ----------------------------------------------------------------------------- |
|
41 |
// |
|
42 |
void CTDeleteMessageTest::Delete() |
|
43 |
{ |
|
44 |
||
45 |
} |
|
46 |
||
47 |
// ----------------------------------------------------------------------------- |
|
48 |
// CTDeleteMessageTest::RunMethodL |
|
49 |
// Run specified method. Contains also table of test mothods and their names. |
|
50 |
// ----------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
TInt CTDeleteMessageTest::RunMethodL( |
|
53 |
CStifItemParser& aItem ) |
|
54 |
{ |
|
55 |
||
56 |
static TStifFunctionInfo const KFunctions[] = |
|
57 |
{ |
|
58 |
// Copy this line for every implemented function. |
|
59 |
// First string is the function name used in TestScripter script file. |
|
60 |
// Second is the actual implementation member function. |
|
61 |
//TRY( "SendMessage", CTDeleteMessageTest::SendMessage ), |
|
62 |
||
63 |
ENTRY( "DeleteMessageSms", CTDeleteMessageTest::DeleteMessageSms), |
|
64 |
ENTRY( "DeleteMessageMms", CTDeleteMessageTest::DeleteMessageMms), |
|
65 |
ENTRY( "DeleteMessageInvalid", CTDeleteMessageTest::DeleteMessageInvalid), |
|
66 |
||
67 |
}; |
|
68 |
||
69 |
const TInt count = sizeof( KFunctions ) / |
|
70 |
sizeof( TStifFunctionInfo ); |
|
71 |
||
72 |
return RunInternalL( KFunctions, count, aItem ); |
|
73 |
||
74 |
} |
|
75 |
||
76 |
||
77 |
||
78 |
||
79 |
||
80 |
TInt CTDeleteMessageTest::DeleteMessageSms(CStifItemParser& /*aItem*/) |
|
81 |
{ |
|
82 |
__UHEAP_MARK; |
|
83 |
||
84 |
TInt result = KErrNone; |
|
85 |
||
86 |
CMessagingService* test = (CMessagingService* ) CMessagingService::NewL() ; |
|
87 |
||
88 |
CleanupStack::PushL(test); |
|
89 |
||
90 |
CFilterParamInfo* filterParams = CFilterParamInfo::NewL(); |
|
91 |
||
92 |
filterParams->AddMtmL(_L("SMS")); |
|
93 |
||
94 |
CMsvEntrySelection* entrySelection = NULL; |
|
95 |
||
96 |
test->GetIdListL( filterParams, 0, NULL, entrySelection ); |
|
97 |
||
98 |
if ( entrySelection && ( entrySelection->Count() > 0 )) |
|
99 |
{ |
|
100 |
TMsvId messageid; |
|
101 |
||
102 |
CMessageHeader* header = NULL; |
|
103 |
||
104 |
TInt index = 0; |
|
105 |
test->GetNextHeaderL( filterParams, entrySelection, index, NULL, header ); |
|
106 |
if ( header ) |
|
107 |
{ |
|
108 |
header->GetMessageId( messageid ); |
|
109 |
delete header; |
|
110 |
header = NULL; |
|
111 |
||
112 |
test->DeleteMessageL( messageid, NULL ); |
|
113 |
||
114 |
TRAPD( err, test->DeleteMessageL( messageid, NULL )); |
|
115 |
||
116 |
if ( err == KErrNone ) |
|
117 |
result = KErrGeneral; |
|
118 |
} |
|
119 |
} |
|
120 |
||
121 |
entrySelection->Reset(); |
|
122 |
delete entrySelection; |
|
123 |
delete filterParams; |
|
124 |
||
125 |
CleanupStack::PopAndDestroy(test); |
|
126 |
||
127 |
__UHEAP_MARKEND; |
|
128 |
||
129 |
return result; |
|
130 |
} |
|
131 |
||
132 |
||
133 |
||
134 |
TInt CTDeleteMessageTest::DeleteMessageMms(CStifItemParser& /*aItem*/) |
|
135 |
{ |
|
136 |
__UHEAP_MARK; |
|
137 |
||
138 |
TInt result = KErrNone; |
|
139 |
||
140 |
CMessagingService* test = (CMessagingService* ) CMessagingService::NewL() ; |
|
141 |
||
142 |
CleanupStack::PushL(test); |
|
143 |
||
144 |
CFilterParamInfo* filterParams = CFilterParamInfo::NewL(); |
|
145 |
||
146 |
filterParams->AddMtmL(_L("MMS")); |
|
147 |
||
148 |
CMsvEntrySelection* entrySelection = NULL; |
|
149 |
||
150 |
test->GetIdListL( filterParams, 0, NULL, entrySelection ); |
|
151 |
||
152 |
if ( entrySelection && ( entrySelection->Count() > 0 )) |
|
153 |
{ |
|
154 |
TMsvId messageid; |
|
155 |
||
156 |
CMessageHeader* header = NULL; |
|
157 |
||
158 |
TInt index = 0; |
|
159 |
test->GetNextHeaderL( filterParams, entrySelection, index, NULL, header ); |
|
160 |
if ( header ) |
|
161 |
{ |
|
162 |
header->GetMessageId( messageid ); |
|
163 |
delete header; |
|
164 |
header = NULL; |
|
165 |
||
166 |
test->DeleteMessageL( messageid, NULL ); |
|
167 |
||
168 |
TRAPD( err, test->DeleteMessageL( messageid, NULL )); |
|
169 |
||
170 |
if ( err == KErrNone ) |
|
171 |
result = KErrGeneral; |
|
172 |
||
173 |
} |
|
174 |
} |
|
175 |
||
176 |
entrySelection->Reset(); |
|
177 |
delete entrySelection; |
|
178 |
delete filterParams; |
|
179 |
||
180 |
CleanupStack::PopAndDestroy(test); |
|
181 |
||
182 |
__UHEAP_MARKEND; |
|
183 |
||
184 |
return result; |
|
185 |
} |
|
186 |
||
187 |
||
188 |
TInt CTDeleteMessageTest::DeleteMessageInvalid(CStifItemParser& /*aItem*/) |
|
189 |
{ |
|
190 |
||
191 |
__UHEAP_MARK; |
|
192 |
||
193 |
CMessagingService* test = (CMessagingService* ) CMessagingService::NewL() ; |
|
194 |
CleanupStack::PushL(test); |
|
195 |
||
196 |
||
197 |
TRAPD(err, test->DeleteMessageL(-1,NULL)); |
|
198 |
||
199 |
||
200 |
CleanupStack::PopAndDestroy(1) ; |
|
201 |
||
202 |
__UHEAP_MARKEND; |
|
203 |
||
204 |
if(err != KErrNone) |
|
205 |
{ |
|
206 |
return KErrNone; |
|
207 |
} |
|
208 |
else |
|
209 |
{ |
|
210 |
return err; |
|
211 |
} |
|
212 |
} |
|
213 |