|
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 #include "CMtfTestActionSendEMsvDeleteEntries.h" |
|
17 |
|
18 #include <e32std.h> |
|
19 #include <e32base.h> |
|
20 |
|
21 #include <msvipc.h> |
|
22 #include <msvstd.h> |
|
23 |
|
24 #include "MCLIENT.H" |
|
25 #include "MSERVER.H" |
|
26 |
|
27 |
|
28 #include "CMtfTestCase.h" |
|
29 #include "CMtfTestActionParameters.h" |
|
30 |
|
31 #include "IPCCommandForCapsPermissions.h" |
|
32 #include "SendProxyClient.h" |
|
33 #include "SendProxyserver.h" |
|
34 |
|
35 |
|
36 /** |
|
37 Function : NewL |
|
38 Description : |
|
39 @internalTechnology |
|
40 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
41 @param : aActionParams - CMtfTestActionParameters |
|
42 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSendEMsvDeleteEntries object |
|
43 @pre none |
|
44 @post none |
|
45 */ |
|
46 CMtfTestAction* CMtfTestActionSendEMsvDeleteEntries::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
47 { |
|
48 CMtfTestActionSendEMsvDeleteEntries* self = new (ELeave) CMtfTestActionSendEMsvDeleteEntries(aTestCase); |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(aActionParameters); |
|
51 CleanupStack::Pop(self); |
|
52 return self; |
|
53 } |
|
54 |
|
55 /** |
|
56 Function : CMtfTestActionSendEMsvDeleteEntries |
|
57 Description : Constructor |
|
58 @internalTechnology |
|
59 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
60 @return : N/A |
|
61 @pre none |
|
62 @post none |
|
63 */ |
|
64 CMtfTestActionSendEMsvDeleteEntries::CMtfTestActionSendEMsvDeleteEntries(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
65 { |
|
66 } |
|
67 |
|
68 /** |
|
69 Function : ~CMtfTestActionSendEMsvDeleteEntries |
|
70 Description : Destructor |
|
71 @internalTechnology |
|
72 @param : |
|
73 @return : |
|
74 @pre |
|
75 @post |
|
76 */ |
|
77 CMtfTestActionSendEMsvDeleteEntries::~CMtfTestActionSendEMsvDeleteEntries() |
|
78 { |
|
79 } |
|
80 |
|
81 /** |
|
82 Function : ExecuteActionL |
|
83 Description : Entry point for the this test action in the test framework |
|
84 @internalTechnology |
|
85 @param : none |
|
86 @return : void |
|
87 @pre none |
|
88 @post none |
|
89 */ |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 void CMtfTestActionSendEMsvDeleteEntries::ExecuteActionL() |
|
95 { |
|
96 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvDeleteEntries); |
|
97 // input params |
|
98 TMsvId messageId = ObtainValueParameterL<TMsvId>( TestCase(), ActionParameters().Parameter(0) ); |
|
99 TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1)); |
|
100 |
|
101 RProxyServerSession RPSS; |
|
102 TInt error = RPSS.Connect(); |
|
103 // Will auto start the server if not started. |
|
104 |
|
105 if (error!=KErrNone) |
|
106 { |
|
107 TestCase().ERR_PRINTF2(_L("%S :: Unable to start proxy server. !") , &KTestActionSendEMsvDeleteEntries); |
|
108 TestCase().SetTestStepResult(EFail); |
|
109 } |
|
110 else |
|
111 { |
|
112 TInt32 serverCaps; |
|
113 RPSS.GetServerCapabilities(serverCaps); |
|
114 TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps); |
|
115 |
|
116 error = 0; |
|
117 CleanupClosePushL(RPSS); |
|
118 |
|
119 HBufC8* buffer = HBufC8::NewLC(KMsvSessionBufferLength); |
|
120 TPtr8 ptr=buffer->Des(); |
|
121 |
|
122 CMsvEntrySelection* entrySelection = new (ELeave) (CMsvEntrySelection); |
|
123 CleanupDeletePushL(entrySelection); |
|
124 |
|
125 entrySelection->SetReserveL(1); |
|
126 entrySelection->AppendL(messageId); |
|
127 |
|
128 TMsvPackedOperation packedOperation(buffer); |
|
129 error = packedOperation.Pack(*entrySelection); |
|
130 if (error) |
|
131 { |
|
132 TestCase().ERR_PRINTF2(_L("%S :: FAIL :: Unable to pack the message") , &KTestActionSendEMsvDeleteEntries ); |
|
133 TestCase().SetTestStepResult(EFail); |
|
134 User::LeaveIfError(error); |
|
135 } |
|
136 |
|
137 |
|
138 TMsvOp operationId=1; |
|
139 |
|
140 error= RPSS.SendReceive(EMsvOperationData, TIpcArgs(operationId,buffer)); |
|
141 if (error) |
|
142 { |
|
143 TestCase().ERR_PRINTF2(_L("%S :: FAIL :: Unable to send the created message") , &KTestActionSendEMsvDeleteEntries ); |
|
144 TestCase().SetTestStepResult(EFail); |
|
145 User::LeaveIfError(error); |
|
146 } |
|
147 |
|
148 error=RPSS.SendReceive(EMsvDeleteEntries , TIpcArgs(operationId)); |
|
149 |
|
150 IPCCommandReportPassOrFailForCapsPermissions( TestCase(), KTestActionSendEMsvDeleteEntries, error , pass ); |
|
151 if ( (pass == 0) && (error!=KErrNone ) ) |
|
152 { // We expected it to fail and it did so do nothing else basically ignore the error. |
|
153 // Appears to be no need to do EMsvOperationCompletion. |
|
154 } |
|
155 else |
|
156 { |
|
157 |
|
158 TMsvLocalOperationProgress progress; |
|
159 TPckg<TMsvLocalOperationProgress> progressPack(progress); |
|
160 TInt ret=RPSS.SendReceive(EMsvOperationCompletion , TIpcArgs(operationId, &progressPack)); |
|
161 // We need to indicate that we have finished and clean up otherwise we will get |
|
162 // a panic. |
|
163 |
|
164 if (ret>0) |
|
165 { // We are happy some sort of length returned. |
|
166 } |
|
167 else if (ret<0) |
|
168 { |
|
169 TestCase().ERR_PRINTF2(_L("%S :: FAIL :: Unable to finish deleting the message") , &KTestActionSendEMsvDeleteEntries ); |
|
170 TestCase().SetTestStepResult(EFail); |
|
171 User::LeaveIfError(error); |
|
172 } |
|
173 // else KErrNone |
|
174 |
|
175 } |
|
176 |
|
177 CleanupStack::Check(entrySelection); |
|
178 CleanupStack::PopAndDestroy(); |
|
179 |
|
180 CleanupStack::Check(buffer); |
|
181 CleanupStack::PopAndDestroy(); |
|
182 |
|
183 CleanupStack::Check(&RPSS); |
|
184 CleanupStack::PopAndDestroy(); |
|
185 |
|
186 |
|
187 } |
|
188 |
|
189 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendEMsvDeleteEntries); |
|
190 TestCase().ActionCompletedL(*this); |
|
191 } |