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) 2006-2007 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 |
// INCLUDE FILES |
|
21 |
#include <e32svr.h> |
|
22 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
23 |
#include <StifTestInterface.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
25 |
#include <liwbufferextension.h> |
19 | 26 |
#include <f32file.h> |
27 |
#include <e32des16.h> |
|
28 |
#include <e32base.h> |
|
29 |
||
30 |
#include "ttestmediathumbobserver.h" |
|
31 |
#include "tmediathumbnailtest.h" |
|
32 |
// GETthumb |
|
33 |
_LIT8(KService, "Service.MediaManagement"); |
|
34 |
_LIT8(KIDataSource,"IDataSource"); |
|
35 |
||
36 |
_LIT8(KGetThumbnail,"GetThumbnail"); |
|
37 |
_LIT8(KCmdCancel,"Cancel"); |
|
38 |
//Input Keys/arguments |
|
39 |
_LIT8(KTransactionID,"TransactionID"); |
|
40 |
// for Url |
|
41 |
_LIT8(KUrl,"Url"); |
|
42 |
||
43 |
// thumbnailsize |
|
44 |
_LIT8(KThumbnailSize,"ThumbnailSize"); |
|
45 |
||
46 |
// Width |
|
47 |
_LIT8(KWidth,"width"); |
|
48 |
//height |
|
49 |
_LIT8(KHeight,"height"); |
|
50 |
||
51 |
//_LIT8(KResponse,"ReturnValue"); |
|
52 |
_LIT8(KErrorCode,"ErrorCode"); |
|
53 |
//_LIT8(KThumbNailUrl,"ThumbnailUrl"); |
|
54 |
||
55 |
//_LIT(KImageUrl,"C:\\Data\\images\\ant.jpg"); |
|
56 |
// EXTERNAL DATA STRUCTURES |
|
57 |
//extern ?external_data; |
|
58 |
||
59 |
// EXTERNAL FUNCTION PROTOTYPES |
|
60 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
61 |
||
62 |
// CONSTANTS |
|
63 |
//const ?type ?constant_var = ?constant; |
|
64 |
||
65 |
// MACROS |
|
66 |
//#define ?macro ?macro_def |
|
67 |
||
68 |
// LOCAL CONSTANTS AND MACROS |
|
69 |
//const ?type ?constant_var = ?constant; |
|
70 |
//#define ?macro_name ?macro_def |
|
71 |
||
72 |
// MODULE DATA STRUCTURES |
|
73 |
//enum ?declaration |
|
74 |
//typedef ?declaration |
|
75 |
||
76 |
// LOCAL FUNCTION PROTOTYPES |
|
77 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
78 |
||
79 |
// FORWARD DECLARATIONS |
|
80 |
//class ?FORWARD_CLASSNAME; |
|
81 |
||
82 |
// ============================= LOCAL FUNCTIONS =============================== |
|
83 |
||
84 |
// ----------------------------------------------------------------------------- |
|
85 |
// ?function_name ?description. |
|
86 |
// ?description |
|
87 |
// Returns: ?value_1: ?description |
|
88 |
// ?value_n: ?description_line1 |
|
89 |
// ?description_line2 |
|
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// |
|
92 |
/* |
|
93 |
?type ?function_name( |
|
94 |
?arg_type arg, // ?description |
|
95 |
?arg_type arg) // ?description |
|
96 |
{ |
|
97 |
||
98 |
?code // ?comment |
|
99 |
||
100 |
// ?comment |
|
101 |
?code |
|
102 |
} |
|
103 |
*/ |
|
104 |
||
105 |
// ============================ MEMBER FUNCTIONS =============================== |
|
106 |
// ----------------------------------------------------------------------------- |
|
107 |
// Csapi_getheader:Delete |
|
108 |
// Delete here all resources allocated and opened from test methods. |
|
109 |
// Called from destructor. |
|
110 |
// ----------------------------------------------------------------------------- |
|
111 |
// |
|
112 |
void CMediaThumbTest::Delete() |
|
113 |
{ |
|
114 |
||
115 |
} |
|
116 |
||
117 |
// ----------------------------------------------------------------------------- |
|
118 |
// Csapi_getheader:RunMethodL |
|
119 |
// Run specified method. Contains also table of test mothods and their names. |
|
120 |
// ----------------------------------------------------------------------------- |
|
121 |
// |
|
122 |
TInt CMediaThumbTest::RunMethodL( |
|
123 |
CStifItemParser& aItem ) |
|
124 |
{ |
|
125 |
||
126 |
static TStifFunctionInfo const KFunctions[] = |
|
127 |
{ |
|
128 |
ENTRY( "getthumbnailtest", CMediaThumbTest::getthumbnailL ), |
|
129 |
ENTRY( "cancelthumbnail", CMediaThumbTest::CancelThumbnailL ), |
|
130 |
ENTRY( "gethumbanilwrongtype", CMediaThumbTest::GetThumbnailWrrongURLType ), |
|
131 |
ENTRY( "getThumbnailwrongthumbnailsize", CMediaThumbTest::GetThumbnailWrongThumnailSizeType ), |
|
132 |
ENTRY( "getThumbnailwrongwidthtype", CMediaThumbTest::getThumbnail_WrongWidthType ), |
|
133 |
ENTRY( "getThumbnailwrongheighttype", CMediaThumbTest::getThumbnail_WrongHeightType ), |
|
134 |
}; |
|
135 |
||
136 |
const TInt count = sizeof( KFunctions ) / |
|
137 |
sizeof( TStifFunctionInfo ); |
|
138 |
||
139 |
return RunInternalL( KFunctions, count, aItem ); |
|
140 |
||
141 |
} |
|
142 |
||
143 |
// ----------------------------------------------------------------------------- |
|
144 |
// CMediaThumbTest:getlistapplication1_testL |
|
145 |
// Example test method function. |
|
146 |
// (other items were commented in a header). |
|
147 |
// ----------------------------------------------------------------------------- |
|
148 |
// |
|
149 |
TInt CMediaThumbTest::getthumbnailL( CStifItemParser& aItem ) |
|
150 |
{ |
|
151 |
RFs fs; |
|
152 |
User::LeaveIfError(fs.Connect()); |
|
153 |
RFile file; |
|
154 |
User::LeaveIfError(file.Replace(fs,_L("C:\\Data\\TestCase.txt"),EFileRead | EFileStreamText )); |
|
155 |
||
156 |
file.Write(_L8("Testcase staretd\n")); |
|
157 |
// Type Url val Type ThumbnailSize Type width val type height val |
|
158 |
__UHEAP_MARK; |
|
159 |
TPtrC16 url; |
|
160 |
TPtrC16 heightstr; |
|
161 |
TPtrC16 widthstr; |
|
162 |
TInt widthVal=-1; |
|
163 |
TInt heightVal=-1; |
|
164 |
TInt ExpectedResult = 0; |
|
165 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
166 |
iLog->Log(_L("read varibale ")); |
|
167 |
||
168 |
/*-------------------------------------------------------------------------------------------*/ |
|
169 |
||
170 |
||
171 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
172 |
CleanupStack::PushL(iServiceHandler);//1 |
|
173 |
||
174 |
if ( iServiceHandler ) |
|
175 |
iLog->Log(_L("Got Service Handler ")); |
|
176 |
else |
|
177 |
iLog->Log(_L("Didn't get service handler")); |
|
178 |
||
179 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,KIDataSource,KService); |
|
180 |
iLog->Log(_L("Create criterai Item")); |
|
181 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
182 |
CleanupStack::PushL(crit);//2 |
|
183 |
||
184 |
||
185 |
RCriteriaArray critArray; |
|
186 |
iLog->Log(_L("Append in Crit")); |
|
187 |
critArray.AppendL(crit); |
|
188 |
CleanupClosePushL(critArray);//3 |
|
189 |
||
190 |
iServiceHandler->AttachL(critArray); |
|
191 |
//critArray.Reset(); |
|
192 |
//critArray.Close(); |
|
193 |
||
194 |
iLog->Log(_L("Creating Output")); |
|
195 |
||
196 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
197 |
CleanupStack::PushL(output);//4 |
|
198 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
199 |
CleanupStack::PushL(input);//5 |
|
200 |
||
201 |
iLog->Log(_L("call Service cmd L")); |
|
202 |
||
203 |
iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
204 |
||
205 |
iLog->Log(_L("Service cmdl is over")); |
|
206 |
||
207 |
// Create the Instance of SAPI class and the Input Param and output Param |
|
208 |
TInt pos = 0; |
|
209 |
MLiwInterface* Interface = NULL; |
|
210 |
output->FindFirst(pos,KIDataSource ); |
|
211 |
if(pos != KErrNotFound) |
|
212 |
{ |
|
213 |
Interface = (*output)[pos].Value().AsInterface(); |
|
214 |
} |
|
215 |
output->Reset(); |
|
216 |
||
217 |
||
218 |
||
219 |
CleanupClosePushL(*Interface);//6 |
|
220 |
||
221 |
||
222 |
iLog->Log(_L("got Interface")); |
|
223 |
||
224 |
||
225 |
//======= Now creating input============================================================================ |
|
226 |
||
227 |
||
228 |
// Getting Url value |
|
229 |
||
230 |
||
231 |
aItem.GetNextString(url); // Taking value as string for url |
|
232 |
||
233 |
TLiwGenericParam urlVal(KUrl,TLiwVariant(url)); |
|
234 |
input->AppendL(urlVal); |
|
235 |
||
236 |
// ThumbnailSize as Ma |
|
237 |
CLiwDefaultMap *ThumbnailSizeMap = CLiwDefaultMap::NewL(); |
|
238 |
CleanupStack::PushL(ThumbnailSizeMap); |
|
239 |
// Getting width value |
|
240 |
aItem.GetNextString(widthstr); |
|
241 |
if(widthstr.Compare(_L("NULL")) != 0 ) |
|
242 |
{ |
|
243 |
aItem.GetNextInt(widthVal); |
|
244 |
ThumbnailSizeMap->InsertL(KWidth,TLiwVariant((TInt32)widthVal)); |
|
245 |
} |
|
246 |
aItem.GetNextString(heightstr); |
|
247 |
if(heightstr.Compare(_L("NULL")) != 0 ) |
|
248 |
{ |
|
249 |
aItem.GetNextInt(heightVal); |
|
250 |
ThumbnailSizeMap->InsertL(KHeight,TLiwVariant((TInt32)heightVal)); |
|
251 |
} |
|
252 |
TLiwGenericParam thumbsizemap(KThumbnailSize, TLiwVariant(ThumbnailSizeMap)); |
|
253 |
input->AppendL(thumbsizemap); |
|
254 |
CleanupStack::Pop(ThumbnailSizeMap); |
|
255 |
ThumbnailSizeMap->DecRef(); |
|
256 |
||
257 |
aItem.GetNextInt(ExpectedResult); |
|
258 |
||
259 |
// Creating callback |
|
260 |
||
261 |
||
262 |
||
263 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait(); |
|
264 |
CleanupStack::PushL( wait); |
|
265 |
CThumbnailObserver* callback = CThumbnailObserver::NewL(wait,widthVal,heightVal); |
|
266 |
CleanupStack::PushL( callback); |
|
267 |
file.Write(_L8("Instance of callback and Activewait schedual is created\n")); |
|
268 |
file.Write(_L8("Calling execute commandL\n")); |
|
269 |
||
270 |
Interface->ExecuteCmdL(KGetThumbnail,*input,*output,KLiwOptASyncronous,callback); |
|
271 |
file.Write(_L8("Returning to test case\n")); |
|
272 |
const TLiwGenericParam* p= NULL; |
|
273 |
pos = 0; |
|
274 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
275 |
if(p) |
|
276 |
{ |
|
277 |
result = p->Value().AsTInt32(); |
|
278 |
} |
|
279 |
else |
|
280 |
{ |
|
281 |
result = KErrGeneral; |
|
282 |
} |
|
283 |
TBuf8<50> bufer; |
|
284 |
bufer.AppendNum(result); |
|
285 |
||
286 |
file.Write(_L8("Got errcode from provider : ")); |
|
287 |
file.Write(bufer); |
|
288 |
if ( result == KErrNone) |
|
289 |
{ |
|
290 |
// Asynch request properly accepted |
|
291 |
file.Write(_L8("Starting schdular\n")); |
|
292 |
wait->Start(); |
|
293 |
result = callback->iErrorReturn; |
|
294 |
file.Write(_L8("Schedual is returned\n")); |
|
295 |
} |
|
296 |
||
297 |
||
298 |
CleanupStack::PopAndDestroy(callback);//Callback |
|
299 |
CleanupStack::PopAndDestroy(wait);//Active Wait Scheduler |
|
300 |
||
301 |
||
302 |
||
303 |
||
304 |
output->Reset(); |
|
305 |
input->Reset(); |
|
306 |
||
307 |
CleanupStack::PopAndDestroy();// interface |
|
308 |
CleanupStack::PopAndDestroy(input); |
|
309 |
CleanupStack::PopAndDestroy(output); |
|
310 |
CleanupStack::PopAndDestroy(&critArray); |
|
311 |
CleanupStack::PopAndDestroy(crit); |
|
312 |
CleanupStack::PopAndDestroy(iServiceHandler); |
|
313 |
file.Write(_L8("Cleanup done\n")); |
|
314 |
||
315 |
__UHEAP_MARKEND; |
|
316 |
||
317 |
file.Write(_L8("No memory Leak\n")); |
|
318 |
file.Close(); |
|
319 |
fs.Close(); |
|
320 |
||
321 |
if(ExpectedResult == result) |
|
322 |
return KErrNone; |
|
323 |
else |
|
324 |
return KErrGeneral; |
|
325 |
||
326 |
||
327 |
} |
|
328 |
||
329 |
||
330 |
TInt CMediaThumbTest::CancelThumbnailL( CStifItemParser& aItem ) |
|
331 |
{ |
|
332 |
RFs fs; |
|
333 |
User::LeaveIfError(fs.Connect()); |
|
334 |
RFile file; |
|
335 |
User::LeaveIfError(file.Replace(fs,_L("C:\\Data\\CancelTestCase.txt"),EFileRead | EFileStreamText )); |
|
336 |
||
337 |
file.Write(_L8("Testcase staretd\n")); |
|
338 |
// Type Url val Type ThumbnailSize Type width val type height val |
|
339 |
__UHEAP_MARK; |
|
340 |
TPtrC16 url; |
|
341 |
TPtrC16 heightstr; |
|
342 |
TPtrC16 widthstr; |
|
343 |
TInt widthVal=-1; |
|
344 |
TInt heightVal=-1; |
|
345 |
TInt ExpectedResult = 0; |
|
346 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
347 |
iLog->Log(_L("read varibale ")); |
|
348 |
||
349 |
/*-------------------------------------------------------------------------------------------*/ |
|
350 |
||
351 |
||
352 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
353 |
CleanupStack::PushL(iServiceHandler);//1 |
|
354 |
||
355 |
if ( iServiceHandler ) |
|
356 |
iLog->Log(_L("Got Service Handler ")); |
|
357 |
else |
|
358 |
iLog->Log(_L("Didn't get service handler")); |
|
359 |
||
360 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,KIDataSource,KService); |
|
361 |
iLog->Log(_L("Create criterai Item")); |
|
362 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
363 |
CleanupStack::PushL(crit);//2 |
|
364 |
||
365 |
||
366 |
RCriteriaArray critArray; |
|
367 |
iLog->Log(_L("Append in Crit")); |
|
368 |
critArray.AppendL(crit); |
|
369 |
CleanupClosePushL(critArray);//3 |
|
370 |
||
371 |
iServiceHandler->AttachL(critArray); |
|
372 |
//critArray.Reset(); |
|
373 |
//critArray.Close(); |
|
374 |
||
375 |
iLog->Log(_L("Creating Output")); |
|
376 |
||
377 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
378 |
CleanupStack::PushL(output);//4 |
|
379 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
380 |
CleanupStack::PushL(input);//5 |
|
381 |
||
382 |
iLog->Log(_L("call Service cmd L")); |
|
383 |
||
384 |
iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
385 |
||
386 |
iLog->Log(_L("Service cmdl is over")); |
|
387 |
||
388 |
// Create the Instance of SAPI class and the Input Param and output Param |
|
389 |
TInt pos = 0; |
|
390 |
MLiwInterface* Interface = NULL; |
|
391 |
output->FindFirst(pos,KIDataSource ); |
|
392 |
if(pos != KErrNotFound) |
|
393 |
{ |
|
394 |
Interface = (*output)[pos].Value().AsInterface(); |
|
395 |
} |
|
396 |
output->Reset(); |
|
397 |
||
398 |
||
399 |
||
400 |
CleanupClosePushL(*Interface);//6 |
|
401 |
||
402 |
||
403 |
iLog->Log(_L("got Interface")); |
|
404 |
||
405 |
||
406 |
//======= Now creating input============================================================================ |
|
407 |
||
408 |
||
409 |
// Getting Url value |
|
410 |
||
411 |
||
412 |
aItem.GetNextString(url); // Taking value as string for url |
|
413 |
||
414 |
TLiwGenericParam urlVal(KUrl,TLiwVariant(url)); |
|
415 |
input->AppendL(urlVal); |
|
416 |
||
417 |
// ThumbnailSize as Ma |
|
418 |
CLiwDefaultMap *ThumbnailSizeMap = CLiwDefaultMap::NewL(); |
|
419 |
CleanupStack::PushL(ThumbnailSizeMap); |
|
420 |
// Getting width value |
|
421 |
aItem.GetNextString(widthstr); |
|
422 |
if(widthstr.Compare(_L("NULL")) != 0 ) |
|
423 |
{ |
|
424 |
aItem.GetNextInt(widthVal); |
|
425 |
ThumbnailSizeMap->InsertL(KWidth,TLiwVariant((TInt32)widthVal)); |
|
426 |
} |
|
427 |
aItem.GetNextString(heightstr); |
|
428 |
if(heightstr.Compare(_L("NULL")) != 0 ) |
|
429 |
{ |
|
430 |
aItem.GetNextInt(heightVal); |
|
431 |
ThumbnailSizeMap->InsertL(KHeight,TLiwVariant((TInt32)heightVal)); |
|
432 |
} |
|
433 |
TLiwGenericParam thumbsizemap(KThumbnailSize, TLiwVariant(ThumbnailSizeMap)); |
|
434 |
input->AppendL(thumbsizemap); |
|
435 |
CleanupStack::Pop(ThumbnailSizeMap); |
|
436 |
ThumbnailSizeMap->DecRef(); |
|
437 |
||
438 |
aItem.GetNextInt(ExpectedResult); |
|
439 |
||
440 |
// Creating callback |
|
441 |
||
442 |
||
443 |
||
444 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait(); |
|
445 |
CleanupStack::PushL( wait); |
|
446 |
CThumbnailObserver* callback = CThumbnailObserver::NewL(wait,widthVal,heightVal); |
|
447 |
CleanupStack::PushL( callback); |
|
448 |
file.Write(_L8("Instance of callback and Activewait schedual is created\n")); |
|
449 |
file.Write(_L8("Calling execute commandL\n")); |
|
450 |
||
451 |
Interface->ExecuteCmdL(KGetThumbnail,*input,*output,KLiwOptASyncronous,callback); |
|
452 |
file.Write(_L8("Returning to test case\n")); |
|
453 |
const TLiwGenericParam* p= NULL; |
|
454 |
pos = 0; |
|
455 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
456 |
if(p) |
|
457 |
{ |
|
458 |
result = p->Value().AsTInt32(); |
|
459 |
} |
|
460 |
else |
|
461 |
{ |
|
462 |
result = KErrGeneral; |
|
463 |
} |
|
464 |
TBuf8<50> bufer; |
|
465 |
bufer.AppendNum(result); |
|
466 |
||
467 |
file.Write(_L8("Got errcode from provider : ")); |
|
468 |
file.Write(bufer); |
|
469 |
if ( result == KErrNone) |
|
470 |
{ |
|
471 |
pos = 0; |
|
472 |
p = output->FindFirst(pos, KTransactionID); |
|
473 |
TInt TransId = p->Value().AsTInt32(); |
|
474 |
output->Reset(); |
|
475 |
||
476 |
input->AppendL( TLiwGenericParam (KTransactionID, TLiwVariant ((TInt32) TransId ) ) ); |
|
477 |
file.Write(_L8("Calling cancel \n")); |
|
478 |
Interface->ExecuteCmdL(KCmdCancel,*input,*output,KLiwOptCancel); |
|
479 |
||
480 |
pos = 0; |
|
481 |
||
482 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
483 |
if(p) |
|
484 |
{ |
|
485 |
result = p->Value().AsTInt32(); |
|
486 |
} |
|
487 |
else |
|
488 |
{ |
|
489 |
result = KErrGeneral; |
|
490 |
} |
|
491 |
TBuf8<20> buf; |
|
492 |
buf.AppendNum(result); |
|
493 |
file.Write(_L8("Result is ")); |
|
494 |
file.Write(buf); |
|
495 |
||
496 |
||
497 |
} |
|
498 |
if(callback->iCancel) |
|
499 |
result = KErrNone; |
|
500 |
else |
|
501 |
result = KErrGeneral; |
|
502 |
||
503 |
CleanupStack::PopAndDestroy(callback);//Callback |
|
504 |
CleanupStack::PopAndDestroy(wait);//Active Wait Scheduler |
|
505 |
||
506 |
||
507 |
||
508 |
||
509 |
output->Reset(); |
|
510 |
input->Reset(); |
|
511 |
||
512 |
CleanupStack::PopAndDestroy();// interface |
|
513 |
CleanupStack::PopAndDestroy(input); |
|
514 |
CleanupStack::PopAndDestroy(output); |
|
515 |
CleanupStack::PopAndDestroy(&critArray); |
|
516 |
CleanupStack::PopAndDestroy(crit); |
|
517 |
CleanupStack::PopAndDestroy(iServiceHandler); |
|
518 |
file.Write(_L8("Cleanup done\n")); |
|
519 |
||
520 |
__UHEAP_MARKEND; |
|
521 |
||
522 |
file.Write(_L8("No memory Leak\n")); |
|
523 |
file.Close(); |
|
524 |
fs.Close(); |
|
525 |
||
526 |
if(ExpectedResult == result) |
|
527 |
return KErrNone; |
|
528 |
else |
|
529 |
return KErrGeneral; |
|
530 |
||
531 |
||
532 |
} |
|
533 |
||
534 |
||
535 |
TInt CMediaThumbTest::GetThumbnailWrrongURLType( CStifItemParser& aItem ) |
|
536 |
{ |
|
537 |
||
538 |
// Type Url val Type ThumbnailSize Type width val type height val |
|
539 |
__UHEAP_MARK; |
|
540 |
TPtrC16 url; |
|
541 |
TInt widthVal=-1; |
|
542 |
TInt heightVal=-1; |
|
543 |
// TInt ExpectedResult = 0; |
|
544 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
545 |
iLog->Log(_L("read varibale ")); |
|
546 |
||
547 |
/*-------------------------------------------------------------------------------------------*/ |
|
548 |
||
549 |
||
550 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
551 |
CleanupStack::PushL(iServiceHandler);//1 |
|
552 |
||
553 |
if ( iServiceHandler ) |
|
554 |
iLog->Log(_L("Got Service Handler ")); |
|
555 |
else |
|
556 |
iLog->Log(_L("Didn't get service handler")); |
|
557 |
||
558 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,KIDataSource,KService); |
|
559 |
iLog->Log(_L("Create criterai Item")); |
|
560 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
561 |
CleanupStack::PushL(crit);//2 |
|
562 |
||
563 |
||
564 |
RCriteriaArray critArray; |
|
565 |
iLog->Log(_L("Append in Crit")); |
|
566 |
critArray.AppendL(crit); |
|
567 |
CleanupClosePushL(critArray);//3 |
|
568 |
||
569 |
iServiceHandler->AttachL(critArray); |
|
570 |
//critArray.Reset(); |
|
571 |
//critArray.Close(); |
|
572 |
||
573 |
iLog->Log(_L("Creating Output")); |
|
574 |
||
575 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
576 |
CleanupStack::PushL(output);//4 |
|
577 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
578 |
CleanupStack::PushL(input);//5 |
|
579 |
||
580 |
iLog->Log(_L("call Service cmd L")); |
|
581 |
||
582 |
iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
583 |
||
584 |
iLog->Log(_L("Service cmdl is over")); |
|
585 |
||
586 |
// Create the Instance of SAPI class and the Input Param and output Param |
|
587 |
TInt pos = 0; |
|
588 |
MLiwInterface* Interface = NULL; |
|
589 |
output->FindFirst(pos,KIDataSource ); |
|
590 |
if(pos != KErrNotFound) |
|
591 |
{ |
|
592 |
Interface = (*output)[pos].Value().AsInterface(); |
|
593 |
} |
|
594 |
output->Reset(); |
|
595 |
||
596 |
||
597 |
||
598 |
CleanupClosePushL(*Interface);//6 |
|
599 |
||
600 |
||
601 |
iLog->Log(_L("got Interface")); |
|
602 |
||
603 |
||
604 |
//======= Now creating input============================================================================ |
|
605 |
||
606 |
||
607 |
// Getting Url value |
|
608 |
||
609 |
aItem.GetNextString(url); |
|
610 |
||
611 |
// Giving an integer as url |
|
612 |
TInt uRL = 50; |
|
613 |
TLiwGenericParam urlVal(KUrl,TLiwVariant(uRL)); |
|
614 |
input->AppendL(urlVal); |
|
615 |
||
616 |
||
617 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait(); |
|
618 |
CleanupStack::PushL( wait); |
|
619 |
CThumbnailObserver* callback = CThumbnailObserver::NewL(wait,widthVal,heightVal); |
|
620 |
CleanupStack::PushL( callback); |
|
621 |
Interface->ExecuteCmdL(KGetThumbnail,*input,*output,KLiwOptASyncronous,callback); |
|
622 |
||
623 |
const TLiwGenericParam* p= NULL; |
|
624 |
pos = 0; |
|
625 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
626 |
if(p) |
|
627 |
{ |
|
628 |
result = p->Value().AsTInt32(); |
|
629 |
} |
|
630 |
else |
|
631 |
{ |
|
632 |
result = KErrGeneral; |
|
633 |
} |
|
634 |
||
635 |
if(1002 == result) |
|
636 |
result = KErrNone; |
|
637 |
else |
|
638 |
result = KErrGeneral; |
|
639 |
||
640 |
||
641 |
CleanupStack::PopAndDestroy(callback);//Callback |
|
642 |
CleanupStack::PopAndDestroy(wait);//Active Wait Scheduler |
|
643 |
||
644 |
||
645 |
||
646 |
||
647 |
output->Reset(); |
|
648 |
input->Reset(); |
|
649 |
||
650 |
CleanupStack::PopAndDestroy();// interface |
|
651 |
CleanupStack::PopAndDestroy(input); |
|
652 |
CleanupStack::PopAndDestroy(output); |
|
653 |
CleanupStack::PopAndDestroy(&critArray); |
|
654 |
CleanupStack::PopAndDestroy(crit); |
|
655 |
CleanupStack::PopAndDestroy(iServiceHandler); |
|
656 |
__UHEAP_MARKEND; |
|
657 |
||
658 |
return result; |
|
659 |
||
660 |
||
661 |
||
662 |
} |
|
663 |
||
664 |
||
665 |
TInt CMediaThumbTest::GetThumbnailWrongThumnailSizeType( CStifItemParser& aItem ) |
|
666 |
{ |
|
667 |
// Type Url val Type ThumbnailSize Type width val type height val |
|
668 |
__UHEAP_MARK; |
|
669 |
TPtrC16 url; |
|
670 |
TPtrC16 heightstr; |
|
671 |
TPtrC16 widthstr; |
|
672 |
TInt widthVal=-1; |
|
673 |
TInt heightVal=-1; |
|
674 |
TInt ExpectedResult = 0; |
|
675 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
676 |
iLog->Log(_L("read varibale ")); |
|
677 |
||
678 |
/*-------------------------------------------------------------------------------------------*/ |
|
679 |
||
680 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
681 |
CleanupStack::PushL(iServiceHandler);//1 |
|
682 |
||
683 |
if ( iServiceHandler ) |
|
684 |
iLog->Log(_L("Got Service Handler ")); |
|
685 |
else |
|
686 |
iLog->Log(_L("Didn't get service handler")); |
|
687 |
||
688 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,KIDataSource,KService); |
|
689 |
iLog->Log(_L("Create criterai Item")); |
|
690 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
691 |
CleanupStack::PushL(crit);//2 |
|
692 |
||
693 |
||
694 |
RCriteriaArray critArray; |
|
695 |
iLog->Log(_L("Append in Crit")); |
|
696 |
critArray.AppendL(crit); |
|
697 |
CleanupClosePushL(critArray);//3 |
|
698 |
||
699 |
iServiceHandler->AttachL(critArray); |
|
700 |
//critArray.Reset(); |
|
701 |
//critArray.Close(); |
|
702 |
||
703 |
iLog->Log(_L("Creating Output")); |
|
704 |
||
705 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
706 |
CleanupStack::PushL(output);//4 |
|
707 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
708 |
CleanupStack::PushL(input);//5 |
|
709 |
||
710 |
iLog->Log(_L("call Service cmd L")); |
|
711 |
||
712 |
iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
713 |
||
714 |
iLog->Log(_L("Service cmdl is over")); |
|
715 |
||
716 |
// Create the Instance of SAPI class and the Input Param and output Param |
|
717 |
TInt pos = 0; |
|
718 |
MLiwInterface* Interface = NULL; |
|
719 |
output->FindFirst(pos,KIDataSource ); |
|
720 |
if(pos != KErrNotFound) |
|
721 |
{ |
|
722 |
Interface = (*output)[pos].Value().AsInterface(); |
|
723 |
} |
|
724 |
output->Reset(); |
|
725 |
||
726 |
||
727 |
||
728 |
CleanupClosePushL(*Interface);//6 |
|
729 |
||
730 |
||
731 |
iLog->Log(_L("got Interface")); |
|
732 |
||
733 |
||
734 |
//======= Now creating input============================================================================ |
|
735 |
||
736 |
||
737 |
// Getting Url value |
|
738 |
||
739 |
||
740 |
aItem.GetNextString(url); // Taking value as string for url |
|
741 |
||
742 |
TLiwGenericParam urlVal(KUrl,TLiwVariant(url)); |
|
743 |
input->AppendL(urlVal); |
|
744 |
||
745 |
// ThumbnailSize as List |
|
746 |
CLiwDefaultList* ThumbnailSizeList = CLiwDefaultList::NewL(); |
|
747 |
CleanupStack::PushL(ThumbnailSizeList); |
|
748 |
||
749 |
||
750 |
||
751 |
TLiwGenericParam thumbsizelist(KThumbnailSize, TLiwVariant(ThumbnailSizeList)); |
|
752 |
input->AppendL(thumbsizelist); |
|
753 |
CleanupStack::Pop(ThumbnailSizeList); |
|
754 |
ThumbnailSizeList->DecRef(); |
|
755 |
||
756 |
aItem.GetNextInt(ExpectedResult); |
|
757 |
||
758 |
// Creating callback |
|
759 |
||
760 |
||
761 |
||
762 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait(); |
|
763 |
CleanupStack::PushL( wait); |
|
764 |
CThumbnailObserver* callback = CThumbnailObserver::NewL(wait,widthVal,heightVal); |
|
765 |
CleanupStack::PushL( callback); |
|
766 |
Interface->ExecuteCmdL(KGetThumbnail,*input,*output,KLiwOptASyncronous,callback); |
|
767 |
||
768 |
const TLiwGenericParam* p= NULL; |
|
769 |
pos = 0; |
|
770 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
771 |
if(p) |
|
772 |
{ |
|
773 |
result = p->Value().AsTInt32(); |
|
774 |
} |
|
775 |
else |
|
776 |
{ |
|
777 |
result = KErrGeneral; |
|
778 |
} |
|
779 |
||
780 |
if ( ExpectedResult == result ) |
|
781 |
{ |
|
782 |
result =KErrNone; |
|
783 |
} |
|
784 |
else |
|
785 |
result =KErrGeneral; |
|
786 |
||
787 |
||
788 |
CleanupStack::PopAndDestroy(callback);//Callback |
|
789 |
CleanupStack::PopAndDestroy(wait);//Active Wait Scheduler |
|
790 |
||
791 |
||
792 |
||
793 |
||
794 |
output->Reset(); |
|
795 |
input->Reset(); |
|
796 |
||
797 |
CleanupStack::PopAndDestroy();// interface |
|
798 |
CleanupStack::PopAndDestroy(input); |
|
799 |
CleanupStack::PopAndDestroy(output); |
|
800 |
CleanupStack::PopAndDestroy(&critArray); |
|
801 |
CleanupStack::PopAndDestroy(crit); |
|
802 |
CleanupStack::PopAndDestroy(iServiceHandler); |
|
803 |
__UHEAP_MARKEND; |
|
804 |
||
805 |
return result; |
|
806 |
||
807 |
} |
|
808 |
||
809 |
||
810 |
TInt CMediaThumbTest::getThumbnail_WrongWidthType( CStifItemParser& aItem ) |
|
811 |
{ |
|
812 |
// Type Url val Type ThumbnailSize Type width val type height val |
|
813 |
__UHEAP_MARK; |
|
814 |
TPtrC16 url; |
|
815 |
TPtrC16 heightstr; |
|
816 |
TPtrC16 widthstr; |
|
817 |
TInt widthVal=-1; |
|
818 |
TInt heightVal=-1; |
|
819 |
TInt ExpectedResult = 0; |
|
820 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
821 |
iLog->Log(_L("read varibale ")); |
|
822 |
||
823 |
/*-------------------------------------------------------------------------------------------*/ |
|
824 |
||
825 |
||
826 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
827 |
CleanupStack::PushL(iServiceHandler);//1 |
|
828 |
||
829 |
if ( iServiceHandler ) |
|
830 |
iLog->Log(_L("Got Service Handler ")); |
|
831 |
else |
|
832 |
iLog->Log(_L("Didn't get service handler")); |
|
833 |
||
834 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,KIDataSource,KService); |
|
835 |
iLog->Log(_L("Create criterai Item")); |
|
836 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
837 |
CleanupStack::PushL(crit);//2 |
|
838 |
||
839 |
||
840 |
RCriteriaArray critArray; |
|
841 |
iLog->Log(_L("Append in Crit")); |
|
842 |
critArray.AppendL(crit); |
|
843 |
CleanupClosePushL(critArray);//3 |
|
844 |
||
845 |
iServiceHandler->AttachL(critArray); |
|
846 |
//critArray.Reset(); |
|
847 |
//critArray.Close(); |
|
848 |
||
849 |
iLog->Log(_L("Creating Output")); |
|
850 |
||
851 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
852 |
CleanupStack::PushL(output);//4 |
|
853 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
854 |
CleanupStack::PushL(input);//5 |
|
855 |
||
856 |
iLog->Log(_L("call Service cmd L")); |
|
857 |
||
858 |
iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
859 |
||
860 |
iLog->Log(_L("Service cmdl is over")); |
|
861 |
||
862 |
// Create the Instance of SAPI class and the Input Param and output Param |
|
863 |
TInt pos = 0; |
|
864 |
MLiwInterface* Interface = NULL; |
|
865 |
output->FindFirst(pos,KIDataSource ); |
|
866 |
if(pos != KErrNotFound) |
|
867 |
{ |
|
868 |
Interface = (*output)[pos].Value().AsInterface(); |
|
869 |
} |
|
870 |
output->Reset(); |
|
871 |
||
872 |
||
873 |
||
874 |
CleanupClosePushL(*Interface);//6 |
|
875 |
||
876 |
||
877 |
iLog->Log(_L("got Interface")); |
|
878 |
||
879 |
||
880 |
//======= Now creating input============================================================================ |
|
881 |
||
882 |
||
883 |
// Getting Url value |
|
884 |
||
885 |
||
886 |
aItem.GetNextString(url); // Taking value as string for url |
|
887 |
||
888 |
TLiwGenericParam urlVal(KUrl,TLiwVariant(url)); |
|
889 |
input->AppendL(urlVal); |
|
890 |
||
891 |
// ThumbnailSize as Map |
|
892 |
CLiwDefaultMap *ThumbnailSizeMap = CLiwDefaultMap::NewL(); |
|
893 |
CleanupStack::PushL(ThumbnailSizeMap); |
|
894 |
// Getting width value |
|
895 |
aItem.GetNextString(widthstr); |
|
896 |
if(widthstr.Compare(_L("NULL")) != 0 ) |
|
897 |
{ |
|
898 |
aItem.GetNextInt(widthVal); |
|
899 |
TBuf<50> widthbuf; |
|
900 |
widthbuf.Append(_L("String")); |
|
901 |
ThumbnailSizeMap->InsertL(KWidth,TLiwVariant(widthbuf)); |
|
902 |
} |
|
903 |
aItem.GetNextString(heightstr); |
|
904 |
if(heightstr.Compare(_L("NULL")) != 0 ) |
|
905 |
{ |
|
906 |
aItem.GetNextInt(heightVal); |
|
907 |
ThumbnailSizeMap->InsertL(KHeight,TLiwVariant((TInt32)heightVal)); |
|
908 |
} |
|
909 |
TLiwGenericParam thumbsizemap(KThumbnailSize, TLiwVariant(ThumbnailSizeMap)); |
|
910 |
input->AppendL(thumbsizemap); |
|
911 |
CleanupStack::Pop(ThumbnailSizeMap); |
|
912 |
ThumbnailSizeMap->DecRef(); |
|
913 |
||
914 |
aItem.GetNextInt(ExpectedResult); |
|
915 |
||
916 |
// Creating callback |
|
917 |
||
918 |
||
919 |
||
920 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait(); |
|
921 |
CleanupStack::PushL( wait); |
|
922 |
CThumbnailObserver* callback = CThumbnailObserver::NewL(wait,widthVal,heightVal); |
|
923 |
CleanupStack::PushL( callback); |
|
924 |
Interface->ExecuteCmdL(KGetThumbnail,*input,*output,KLiwOptASyncronous,callback); |
|
925 |
||
926 |
const TLiwGenericParam* p= NULL; |
|
927 |
pos = 0; |
|
928 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
929 |
if(p) |
|
930 |
{ |
|
931 |
result = p->Value().AsTInt32(); |
|
932 |
} |
|
933 |
else |
|
934 |
{ |
|
935 |
result = KErrGeneral; |
|
936 |
} |
|
937 |
||
938 |
if ( ExpectedResult == result) |
|
939 |
{ |
|
940 |
result= KErrNone; |
|
941 |
||
942 |
} |
|
943 |
else |
|
944 |
result = KErrGeneral; |
|
945 |
||
946 |
||
947 |
CleanupStack::PopAndDestroy(callback);//Callback |
|
948 |
CleanupStack::PopAndDestroy(wait);//Active Wait Scheduler |
|
949 |
||
950 |
||
951 |
||
952 |
||
953 |
output->Reset(); |
|
954 |
input->Reset(); |
|
955 |
||
956 |
CleanupStack::PopAndDestroy();// interface |
|
957 |
CleanupStack::PopAndDestroy(input); |
|
958 |
CleanupStack::PopAndDestroy(output); |
|
959 |
CleanupStack::PopAndDestroy(&critArray); |
|
960 |
CleanupStack::PopAndDestroy(crit); |
|
961 |
CleanupStack::PopAndDestroy(iServiceHandler); |
|
962 |
__UHEAP_MARKEND; |
|
963 |
||
964 |
return result; |
|
965 |
||
966 |
||
967 |
} |
|
968 |
||
969 |
||
970 |
TInt CMediaThumbTest::getThumbnail_WrongHeightType( CStifItemParser& aItem ) |
|
971 |
{ |
|
972 |
// Type Url val Type ThumbnailSize Type width val type height val |
|
973 |
__UHEAP_MARK; |
|
974 |
TPtrC16 url; |
|
975 |
TPtrC16 heightstr; |
|
976 |
TPtrC16 widthstr; |
|
977 |
TInt widthVal=-1; |
|
978 |
TInt heightVal=-1; |
|
979 |
TInt ExpectedResult = 0; |
|
980 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
981 |
iLog->Log(_L("read varibale ")); |
|
982 |
||
983 |
/*-------------------------------------------------------------------------------------------*/ |
|
984 |
||
985 |
||
986 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
987 |
CleanupStack::PushL(iServiceHandler);//1 |
|
988 |
||
989 |
if ( iServiceHandler ) |
|
990 |
iLog->Log(_L("Got Service Handler ")); |
|
991 |
else |
|
992 |
iLog->Log(_L("Didn't get service handler")); |
|
993 |
||
994 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,KIDataSource,KService); |
|
995 |
iLog->Log(_L("Create criterai Item")); |
|
996 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
997 |
CleanupStack::PushL(crit);//2 |
|
998 |
||
999 |
||
1000 |
RCriteriaArray critArray; |
|
1001 |
iLog->Log(_L("Append in Crit")); |
|
1002 |
critArray.AppendL(crit); |
|
1003 |
CleanupClosePushL(critArray);//3 |
|
1004 |
||
1005 |
iServiceHandler->AttachL(critArray); |
|
1006 |
//critArray.Reset(); |
|
1007 |
//critArray.Close(); |
|
1008 |
||
1009 |
iLog->Log(_L("Creating Output")); |
|
1010 |
||
1011 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
1012 |
CleanupStack::PushL(output);//4 |
|
1013 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
1014 |
CleanupStack::PushL(input);//5 |
|
1015 |
||
1016 |
iLog->Log(_L("call Service cmd L")); |
|
1017 |
||
1018 |
iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
1019 |
||
1020 |
iLog->Log(_L("Service cmdl is over")); |
|
1021 |
||
1022 |
// Create the Instance of SAPI class and the Input Param and output Param |
|
1023 |
TInt pos = 0; |
|
1024 |
MLiwInterface* Interface = NULL; |
|
1025 |
output->FindFirst(pos,KIDataSource ); |
|
1026 |
if(pos != KErrNotFound) |
|
1027 |
{ |
|
1028 |
Interface = (*output)[pos].Value().AsInterface(); |
|
1029 |
} |
|
1030 |
output->Reset(); |
|
1031 |
||
1032 |
||
1033 |
||
1034 |
CleanupClosePushL(*Interface);//6 |
|
1035 |
||
1036 |
||
1037 |
iLog->Log(_L("got Interface")); |
|
1038 |
||
1039 |
||
1040 |
//======= Now creating input============================================================================ |
|
1041 |
||
1042 |
||
1043 |
// Getting Url value |
|
1044 |
||
1045 |
||
1046 |
aItem.GetNextString(url); // Taking value as string for url |
|
1047 |
||
1048 |
TLiwGenericParam urlVal(KUrl,TLiwVariant(url)); |
|
1049 |
input->AppendL(urlVal); |
|
1050 |
||
1051 |
// ThumbnailSize as Map |
|
1052 |
CLiwDefaultMap *ThumbnailSizeMap = CLiwDefaultMap::NewL(); |
|
1053 |
CleanupStack::PushL(ThumbnailSizeMap); |
|
1054 |
// Getting width value |
|
1055 |
aItem.GetNextString(widthstr); |
|
1056 |
if(widthstr.Compare(_L("NULL")) != 0 ) |
|
1057 |
{ |
|
1058 |
aItem.GetNextInt(widthVal); |
|
1059 |
||
1060 |
ThumbnailSizeMap->InsertL(KWidth,TLiwVariant(widthVal)); |
|
1061 |
} |
|
1062 |
aItem.GetNextString(heightstr); |
|
1063 |
if(heightstr.Compare(_L("NULL")) != 0 ) |
|
1064 |
{ |
|
1065 |
aItem.GetNextInt(heightVal); |
|
1066 |
TBuf<50> heightbuf; |
|
1067 |
heightbuf.Append(_L("String")); |
|
1068 |
ThumbnailSizeMap->InsertL(KHeight,TLiwVariant(heightbuf)); |
|
1069 |
} |
|
1070 |
TLiwGenericParam thumbsizemap(KThumbnailSize, TLiwVariant(ThumbnailSizeMap)); |
|
1071 |
input->AppendL(thumbsizemap); |
|
1072 |
CleanupStack::Pop(ThumbnailSizeMap); |
|
1073 |
ThumbnailSizeMap->DecRef(); |
|
1074 |
||
1075 |
aItem.GetNextInt(ExpectedResult); |
|
1076 |
||
1077 |
// Creating callback |
|
1078 |
||
1079 |
||
1080 |
||
1081 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait(); |
|
1082 |
CleanupStack::PushL( wait); |
|
1083 |
CThumbnailObserver* callback = CThumbnailObserver::NewL(wait,widthVal,heightVal); |
|
1084 |
CleanupStack::PushL( callback); |
|
1085 |
Interface->ExecuteCmdL(KGetThumbnail,*input,*output,KLiwOptASyncronous,callback); |
|
1086 |
||
1087 |
const TLiwGenericParam* p= NULL; |
|
1088 |
pos = 0; |
|
1089 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
1090 |
if(p) |
|
1091 |
{ |
|
1092 |
result = p->Value().AsTInt32(); |
|
1093 |
} |
|
1094 |
else |
|
1095 |
{ |
|
1096 |
result = KErrGeneral; |
|
1097 |
} |
|
1098 |
||
1099 |
if ( ExpectedResult == result) |
|
1100 |
{ |
|
1101 |
result= KErrNone; |
|
1102 |
||
1103 |
} |
|
1104 |
else |
|
1105 |
result = KErrGeneral; |
|
1106 |
||
1107 |
||
1108 |
CleanupStack::PopAndDestroy(callback);//Callback |
|
1109 |
CleanupStack::PopAndDestroy(wait);//Active Wait Scheduler |
|
1110 |
||
1111 |
||
1112 |
||
1113 |
||
1114 |
output->Reset(); |
|
1115 |
input->Reset(); |
|
1116 |
||
1117 |
CleanupStack::PopAndDestroy();// interface |
|
1118 |
CleanupStack::PopAndDestroy(input); |
|
1119 |
CleanupStack::PopAndDestroy(output); |
|
1120 |
CleanupStack::PopAndDestroy(&critArray); |
|
1121 |
CleanupStack::PopAndDestroy(crit); |
|
1122 |
CleanupStack::PopAndDestroy(iServiceHandler); |
|
1123 |
__UHEAP_MARKEND; |
|
1124 |
||
1125 |
return result; |
|
1126 |
||
1127 |
||
1128 |
} |
|
1129 |
||
1130 |
||
1131 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1132 |
// None |
|
1133 |
||
1134 |
// End of File |