|
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 "CMtfTestActionSendEMsvGetResultCount.h" |
|
17 |
|
18 #include <e32std.h> |
|
19 #include <e32base.h> |
|
20 |
|
21 #include <msvipc.h> |
|
22 #include "MCLIENT.H" |
|
23 #include "MSERVER.H" |
|
24 |
|
25 |
|
26 #include "CMtfTestCase.h" |
|
27 #include "CMtfTestActionParameters.h" |
|
28 |
|
29 #include "IPCCommandForCapsPermissions.h" |
|
30 #include "SendProxyClient.h" |
|
31 #include "SendProxyserver.h" |
|
32 |
|
33 |
|
34 /** |
|
35 Function : NewL |
|
36 Description : |
|
37 @internalTechnology |
|
38 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
39 @param : aActionParams - CMtfTestActionParameters |
|
40 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSendEMsvGetEntry object |
|
41 @pre none |
|
42 @post none |
|
43 */ |
|
44 CMtfTestAction* CMtfTestActionSendEMsvGetResultCount::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
45 { |
|
46 CMtfTestActionSendEMsvGetResultCount* self = new (ELeave) CMtfTestActionSendEMsvGetResultCount(aTestCase); |
|
47 CleanupStack::PushL(self); |
|
48 self->ConstructL(aActionParameters); |
|
49 CleanupStack::Pop(self); |
|
50 return self; |
|
51 } |
|
52 |
|
53 /** |
|
54 Function : CMtfTestActionSendEMsvGetEntry |
|
55 Description : Constructor |
|
56 @internalTechnology |
|
57 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
58 @return : N/A |
|
59 @pre none |
|
60 @post none |
|
61 */ |
|
62 CMtfTestActionSendEMsvGetResultCount::CMtfTestActionSendEMsvGetResultCount(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
63 { |
|
64 } |
|
65 |
|
66 /** |
|
67 Function : ~CMtfTestActionSendEMsvGetEntry |
|
68 Description : Destructor |
|
69 @internalTechnology |
|
70 @param : |
|
71 @return : |
|
72 @pre |
|
73 @post |
|
74 */ |
|
75 CMtfTestActionSendEMsvGetResultCount::~CMtfTestActionSendEMsvGetResultCount() |
|
76 { |
|
77 } |
|
78 |
|
79 /** |
|
80 Function : ExecuteActionL |
|
81 Description : Entry point for the this test action in the test framework |
|
82 @internalTechnology |
|
83 @param : none |
|
84 @return : void |
|
85 @pre none |
|
86 @post none |
|
87 */ |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 void CMtfTestActionSendEMsvGetResultCount::ExecuteActionL() |
|
93 { |
|
94 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvGetResultCount); |
|
95 TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0) ); |
|
96 |
|
97 RProxyServerSession RPSS; |
|
98 // Will auto start the ProxyServer( which will start the MessagingServer(MSExe.exe) ) if not started. |
|
99 |
|
100 TInt error = RPSS.Connect(); |
|
101 CleanupClosePushL(RPSS); |
|
102 |
|
103 if (error!=KErrNone) |
|
104 { |
|
105 TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvGetEntry :: Unable to start proxy server. !")); |
|
106 TestCase().SetTestStepResult(EFail); |
|
107 } |
|
108 else |
|
109 { |
|
110 TInt32 serverCaps; |
|
111 RPSS.GetServerCapabilities(serverCaps); |
|
112 TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps); |
|
113 |
|
114 HBufC8* buffer = HBufC8::NewLC(KMsvSessionBufferLength); |
|
115 if (buffer==NULL) |
|
116 { |
|
117 TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvGetResultCount :: Unable to allocate mem. !")); |
|
118 TestCase().SetTestStepResult(EFail); |
|
119 } |
|
120 |
|
121 |
|
122 CMsvSearchSortQuery* searchQuery = CMsvSearchSortQuery::NewL(); |
|
123 CleanupStack::PushL(searchQuery); |
|
124 |
|
125 searchQuery->SetParentId(KMsvGlobalOutBoxIndexEntryIdValue); |
|
126 searchQuery->SetResultType(EMsvResultAsTMsvId); |
|
127 searchQuery->SetWholeWord(ETrue); |
|
128 searchQuery->SetCaseSensitiveOption(ETrue); |
|
129 searchQuery->SetWildCardSearch(EFalse); |
|
130 |
|
131 |
|
132 TInt error = KErrNone; |
|
133 |
|
134 |
|
135 |
|
136 error = 0; |
|
137 TPtr8 ptr=buffer->Des(); |
|
138 |
|
139 TBool markquery=0; |
|
140 TInt iterator=0; |
|
141 TInt queryid=0; |
|
142 |
|
143 TMsvPackQuery packedQuery(buffer); |
|
144 error = packedQuery.PackQuery(searchQuery); |
|
145 while(error!=KErrNone) |
|
146 { |
|
147 // increase the size of the buffer and try again |
|
148 buffer->Des().SetLength(0); // to avoid copying contents |
|
149 buffer = buffer->ReAllocL(buffer->Des().MaxSize() + KMsvSessionBufferLength); |
|
150 error = packedQuery.PackQuery(searchQuery); |
|
151 } |
|
152 TInt aMarkQuery = 0; |
|
153 TInt aOperationId =78; |
|
154 error=RPSS.SendReceiveProxyAsync(EMsvSearchSortOperation, TIpcArgs(aOperationId, buffer, aMarkQuery)); |
|
155 |
|
156 if(!error) |
|
157 { |
|
158 TestCase().ERR_PRINTF2(_L("Executed :: %S"), &KTestActionSearchSortOperation); |
|
159 } |
|
160 |
|
161 aOperationId++; |
|
162 error=RPSS.SendReceiveProxyAsync(EMsvSearchSortOnIndexEntry, TIpcArgs(aOperationId, buffer, markquery,iterator)); |
|
163 if(!error) |
|
164 { |
|
165 TestCase().ERR_PRINTF2(_L("Executed :: %S"), &KTestActionSearchSortOnIndexEntry); |
|
166 } |
|
167 |
|
168 aOperationId++; |
|
169 error=RPSS.SendReceiveProxyAsync(EMsvSearchSortQueryId, TIpcArgs(aOperationId, queryid, iterator)); |
|
170 if(!error) |
|
171 { |
|
172 TestCase().ERR_PRINTF2(_L("Executed :: %S"), &KTestActionSearchSortQueryId); |
|
173 } |
|
174 |
|
175 aOperationId++; |
|
176 TInt aQueryId=1001; |
|
177 error=RPSS.SendReceiveProxyAsync(EMsvQueryData, TIpcArgs(aOperationId, aQueryId, &ptr)); |
|
178 if(!error) |
|
179 { |
|
180 TestCase().ERR_PRINTF2(_L("Executed :: %S"), &KTestActionQueryData); |
|
181 } |
|
182 |
|
183 |
|
184 aOperationId++; |
|
185 error=RPSS.SendReceiveProxyAsync(EMsvCancelSearchSortOp, TIpcArgs(aOperationId)); |
|
186 if(!error) |
|
187 { |
|
188 TestCase().ERR_PRINTF2(_L("Executed :: %S"), &KTestActionCancelSearchSortOp); |
|
189 } |
|
190 |
|
191 |
|
192 IPCCommandReportPassOrFailForCapsPermissions( TestCase(), KMsvServerName, error , pass ); |
|
193 |
|
194 CleanupStack::PopAndDestroy(searchQuery); |
|
195 CleanupStack::PopAndDestroy(buffer); |
|
196 |
|
197 |
|
198 } |
|
199 |
|
200 CleanupStack::Check(&RPSS); |
|
201 CleanupStack::PopAndDestroy(); // RPSS |
|
202 |
|
203 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendEMsvGetResultCount); |
|
204 TestCase().ActionCompletedL(*this); |
|
205 |
|
206 } |