5
|
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>
|
|
23 |
#include <Stiftestinterface.h>
|
|
24 |
#include "appmanagertest.h"
|
|
25 |
#include "appmanagerservice.h"
|
|
26 |
#include "appmanagercommon.h"
|
|
27 |
#include <f32file.h>
|
|
28 |
#include <e32des16.h>
|
|
29 |
#include <e32base.h>
|
|
30 |
|
|
31 |
#include "testappobserver.h"
|
|
32 |
const TInt KDocMaxDigitsInHexString = 8; // 32 bits.
|
|
33 |
// EXTERNAL DATA STRUCTURES
|
|
34 |
//extern ?external_data;
|
|
35 |
|
|
36 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
37 |
//extern ?external_function( ?arg_type,?arg_type );
|
|
38 |
|
|
39 |
// CONSTANTS
|
|
40 |
//const ?type ?constant_var = ?constant;
|
|
41 |
|
|
42 |
// MACROS
|
|
43 |
//#define ?macro ?macro_def
|
|
44 |
|
|
45 |
// LOCAL CONSTANTS AND MACROS
|
|
46 |
//const ?type ?constant_var = ?constant;
|
|
47 |
//#define ?macro_name ?macro_def
|
|
48 |
|
|
49 |
// MODULE DATA STRUCTURES
|
|
50 |
//enum ?declaration
|
|
51 |
//typedef ?declaration
|
|
52 |
|
|
53 |
// LOCAL FUNCTION PROTOTYPES
|
|
54 |
//?type ?function_name( ?arg_type, ?arg_type );
|
|
55 |
|
|
56 |
// FORWARD DECLARATIONS
|
|
57 |
//class ?FORWARD_CLASSNAME;
|
|
58 |
|
|
59 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
60 |
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
// ?function_name ?description.
|
|
63 |
// ?description
|
|
64 |
// Returns: ?value_1: ?description
|
|
65 |
// ?value_n: ?description_line1
|
|
66 |
// ?description_line2
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
/*
|
|
70 |
?type ?function_name(
|
|
71 |
?arg_type arg, // ?description
|
|
72 |
?arg_type arg) // ?description
|
|
73 |
{
|
|
74 |
|
|
75 |
?code // ?comment
|
|
76 |
|
|
77 |
// ?comment
|
|
78 |
?code
|
|
79 |
}
|
|
80 |
*/
|
|
81 |
|
|
82 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
83 |
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
// Csapi_getheader:Delete
|
|
86 |
// Delete here all resources allocated and opened from test methods.
|
|
87 |
// Called from destructor.
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void CAppManagerTest::Delete()
|
|
91 |
{
|
|
92 |
|
|
93 |
}
|
|
94 |
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
// Csapi_getheader:RunMethodL
|
|
97 |
// Run specified method. Contains also table of test mothods and their names.
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
TInt CAppManagerTest::RunMethodL(
|
|
101 |
CStifItemParser& aItem )
|
|
102 |
{
|
|
103 |
|
|
104 |
static TStifFunctionInfo const KFunctions[] =
|
|
105 |
{
|
|
106 |
ENTRY( "getlisttest", CAppManagerTest::getlisttestL ),
|
|
107 |
ENTRY( "launchApp", CAppManagerTest::launchAppL ),
|
|
108 |
ENTRY( "launchDoc", CAppManagerTest::launchDocL ),
|
|
109 |
};
|
|
110 |
|
|
111 |
const TInt count = sizeof( KFunctions ) /
|
|
112 |
sizeof( TStifFunctionInfo );
|
|
113 |
|
|
114 |
return RunInternalL( KFunctions, count, aItem );
|
|
115 |
|
|
116 |
}
|
|
117 |
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
// CAppManagerTest:getlistapplication1_testL
|
|
120 |
// Example test method function.
|
|
121 |
// (other items were commented in a header).
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
TInt CAppManagerTest::getlisttestL( CStifItemParser& aItem )
|
|
125 |
{
|
|
126 |
|
|
127 |
__UHEAP_MARK;
|
|
128 |
TPtrC16 content;
|
|
129 |
TPtrC16 docname;
|
|
130 |
TPtrC16 mimetype16;
|
|
131 |
TInt expected;
|
|
132 |
TInt noOfmaps;
|
|
133 |
TPtrC16 filename;
|
|
134 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail
|
|
135 |
|
|
136 |
aItem.GetNextString(content);
|
|
137 |
aItem.GetNextString(docname);
|
|
138 |
aItem.GetNextString(mimetype16);
|
|
139 |
aItem.GetNextInt(expected);
|
|
140 |
aItem.GetNextString(filename);
|
|
141 |
aItem.GetNextInt(noOfmaps);
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
// Convert 16 Bit values into 8 bit as SAPI accept 8 bit Des
|
|
147 |
TBuf8<30> mimetype ;
|
|
148 |
mimetype.Copy(mimetype16);
|
|
149 |
|
|
150 |
|
|
151 |
CAppManagerService* test = CAppManagerService::NewL();
|
|
152 |
CleanupStack::PushL(test);
|
|
153 |
|
|
154 |
|
|
155 |
CFilterParam* param = NULL;
|
|
156 |
|
|
157 |
if(docname.CompareF(_L("NULL")) != 0 )
|
|
158 |
{
|
|
159 |
param = CFilterParam::NewL();
|
|
160 |
CleanupStack::PushL(param);
|
|
161 |
param->SetDocName(docname);
|
|
162 |
}
|
|
163 |
|
|
164 |
|
|
165 |
if(mimetype.CompareF(_L8("NULL")) != 0)
|
|
166 |
{
|
|
167 |
if(!param)
|
|
168 |
{
|
|
169 |
param = CFilterParam::NewL();
|
|
170 |
CleanupStack::PushL(param);
|
|
171 |
}
|
|
172 |
|
|
173 |
param->SetmimeType(mimetype);
|
|
174 |
}
|
|
175 |
|
|
176 |
TInt err= 0;
|
|
177 |
MIterator* iter;
|
|
178 |
if(param)
|
|
179 |
{
|
|
180 |
TRAP(err,test->GetListL(iter,content,param));
|
|
181 |
}
|
|
182 |
else
|
|
183 |
{
|
|
184 |
TRAP(err,test->GetListL(iter,content));
|
|
185 |
}
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
CleanupStack::PushL(iter);
|
|
193 |
|
|
194 |
|
|
195 |
if(noOfmaps > 0)
|
|
196 |
{
|
|
197 |
RArray<TInt> uidArray;
|
|
198 |
TInt matchedOutput =0;
|
|
199 |
TInt32 appuid;
|
|
200 |
TInt index;
|
|
201 |
TPtrC16 appuidstring;
|
|
202 |
for(TInt i =0 ;i < noOfmaps; i++ )
|
|
203 |
{
|
|
204 |
aItem.GetNextString( appuidstring );
|
|
205 |
ConvertHexStringToInt32(appuidstring,appuid );
|
|
206 |
uidArray.Append(appuid);
|
|
207 |
}
|
|
208 |
|
|
209 |
MInfoMap* infomap = NULL;
|
|
210 |
_LIT8(UidKey,"Uid");// Key In The Map
|
|
211 |
TPtrC KeyValue;// value of that key
|
|
212 |
|
|
213 |
|
|
214 |
while( (uidArray.Count()>0) && iter->NextL(infomap) )
|
|
215 |
{
|
|
216 |
//KeyValue.Zero();
|
|
217 |
infomap->FindL(UidKey, KeyValue);
|
|
218 |
ConvertHexStringToInt32(KeyValue,appuid );
|
|
219 |
|
|
220 |
if( ( index = uidArray.Find( appuid ) )!= KErrNotFound)
|
|
221 |
{
|
|
222 |
matchedOutput++;
|
|
223 |
uidArray.Remove(index);
|
|
224 |
uidArray.Compress();
|
|
225 |
}
|
|
226 |
|
|
227 |
delete infomap;
|
|
228 |
infomap = NULL;
|
|
229 |
}
|
|
230 |
|
|
231 |
//iter->Reset(); has to implement by lokesh
|
|
232 |
if( matchedOutput != noOfmaps )
|
|
233 |
{
|
|
234 |
//Test case failed
|
|
235 |
err = KErrGeneral;
|
|
236 |
}
|
|
237 |
uidArray.Reset();
|
|
238 |
uidArray.Close();
|
|
239 |
}
|
|
240 |
|
|
241 |
|
|
242 |
/*------------------------------------Output For Manual Testing ---------------------------------*/
|
|
243 |
if(filename.CompareF(_L("NULL"))!= 0)
|
|
244 |
{
|
|
245 |
|
|
246 |
// Convert 16 Bit values into 8 bit as SAPI accept 8 bit Des
|
|
247 |
TBuf8<30> content8 ;
|
|
248 |
content8.Copy(content);
|
|
249 |
|
|
250 |
|
|
251 |
// Show the output
|
|
252 |
RFs fs;
|
|
253 |
RFile file;
|
|
254 |
User::LeaveIfError(fs.Connect());
|
|
255 |
CleanupClosePushL(fs);
|
|
256 |
TInt errfile=0;
|
|
257 |
TEntry entry;
|
|
258 |
if( fs.Entry(_L("c:\\Data\\AppManager\\"),entry) != KErrNone)
|
|
259 |
{
|
|
260 |
TInt ret = fs.MkDir(_L("c:\\Data\\AppManager\\"));
|
|
261 |
}
|
|
262 |
TBuf<100> flname(_L("c:\\data\\AppManager\\"));
|
|
263 |
|
|
264 |
flname.Append(filename);
|
|
265 |
flname.Append(_L(".txt"));
|
|
266 |
|
|
267 |
errfile =file.Replace(fs,flname, EFileWrite | EFileStreamText);
|
|
268 |
CleanupClosePushL(file);
|
|
269 |
|
|
270 |
MInfoMap* infomap = NULL;
|
|
271 |
TBuf8<100> filebuf;
|
|
272 |
TInt index =0 ;
|
|
273 |
TBuf8<50> Key;// Key In The Map
|
|
274 |
TPtrC KeyValue;// value of that key
|
|
275 |
|
|
276 |
filebuf.Append(_L8("TestCase \n"));
|
|
277 |
filebuf.Append(_L8("Content = "));
|
|
278 |
filebuf.Append(content8);
|
|
279 |
filebuf.Append(_L8(","));
|
|
280 |
|
|
281 |
filebuf.Append(_L8("docname = "));
|
|
282 |
filebuf.Append(docname);
|
|
283 |
filebuf.Append(_L8(","));
|
|
284 |
|
|
285 |
filebuf.Append(_L8("mimetype16 = "));
|
|
286 |
filebuf.Append(mimetype16);
|
|
287 |
filebuf.Append(_L8("\n"));
|
|
288 |
|
|
289 |
file.Write(filebuf);
|
|
290 |
filebuf.Zero();
|
|
291 |
|
|
292 |
TInt count =1;
|
|
293 |
|
|
294 |
while(iter->NextL(infomap))
|
|
295 |
{
|
|
296 |
filebuf.Append(_L8(" :- "));
|
|
297 |
filebuf.AppendNum(count);
|
|
298 |
file.Write(content8);
|
|
299 |
file.Write(filebuf);
|
|
300 |
file.Write(_L8("\n"));
|
|
301 |
filebuf.Zero();
|
|
302 |
file.Write(_L8("----------------------------------------------------\n"));
|
|
303 |
|
|
304 |
for(index =0 ;index <infomap->Count(); index++ )
|
|
305 |
{
|
|
306 |
infomap->AtL(index,Key);
|
|
307 |
infomap->FindL(Key, KeyValue);
|
|
308 |
file.Write(Key);
|
|
309 |
file.Write(_L8("\t"));
|
|
310 |
filebuf.Copy(KeyValue);
|
|
311 |
file.Write(filebuf);
|
|
312 |
file.Write(_L8("\n"));
|
|
313 |
filebuf.Zero();
|
|
314 |
Key.Zero();
|
|
315 |
//KeyValue.Zero();
|
|
316 |
}// Map
|
|
317 |
|
|
318 |
delete infomap;
|
|
319 |
infomap = NULL;
|
|
320 |
file.Write(_L8("----------------------------------------------------\n\n"));
|
|
321 |
|
|
322 |
count++;
|
|
323 |
}//Iterator
|
|
324 |
|
|
325 |
CleanupStack::PopAndDestroy();//File
|
|
326 |
CleanupStack::PopAndDestroy();//File Session
|
|
327 |
|
|
328 |
}
|
|
329 |
|
|
330 |
/*------------------------------------Output For Manual Testing ---------------------------------*/
|
|
331 |
|
|
332 |
CleanupStack::Pop(iter);//Iterator release
|
|
333 |
delete iter;
|
|
334 |
iter = NULL;
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
|
|
341 |
if(!expected)
|
|
342 |
{
|
|
343 |
//Postive Test Case
|
|
344 |
if(err != KErrNone)
|
|
345 |
{
|
|
346 |
result = KErrGeneral;
|
|
347 |
}
|
|
348 |
|
|
349 |
}
|
|
350 |
else
|
|
351 |
{
|
|
352 |
if (err == KErrNone)
|
|
353 |
{
|
|
354 |
result = KErrGeneral;
|
|
355 |
}
|
|
356 |
//Neagative Test Case
|
|
357 |
}
|
|
358 |
|
|
359 |
|
|
360 |
if(param)
|
|
361 |
CleanupStack::PopAndDestroy();//Filter Parameter
|
|
362 |
|
|
363 |
CleanupStack::PopAndDestroy();//core class
|
|
364 |
__UHEAP_MARKEND;
|
|
365 |
return result;
|
|
366 |
|
|
367 |
|
|
368 |
}
|
|
369 |
|
|
370 |
|
|
371 |
// -----------------------------------------------------------------------------
|
|
372 |
// CAppManagerTest:launchAppL
|
|
373 |
// Example test method function.
|
|
374 |
// (other items were commented in a header).
|
|
375 |
// -----------------------------------------------------------------------------
|
|
376 |
//
|
|
377 |
|
|
378 |
TInt CAppManagerTest::launchAppL( CStifItemParser& aItem )
|
|
379 |
{
|
|
380 |
__UHEAP_MARK;
|
|
381 |
TOptions options;
|
|
382 |
TDocument criteria;
|
|
383 |
TInt expected;
|
|
384 |
CAppManagerService* coreClass = CAppManagerService::NewL();
|
|
385 |
CleanupStack::PushL(coreClass);
|
|
386 |
/*--------Test Logic Starts-----------*/
|
|
387 |
TPtrC16 temp;
|
|
388 |
TBuf<30> appId;
|
|
389 |
TPtrC16 cmdLine16;
|
|
390 |
TPtrC16 document;
|
|
391 |
TPtrC16 mode;
|
|
392 |
TPtrC16 postion;
|
|
393 |
TPtrC16 callback;
|
|
394 |
TInt err;
|
|
395 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail
|
|
396 |
|
|
397 |
aItem.GetNextString( temp );
|
|
398 |
appId.Append( temp );
|
|
399 |
appId.Append(_L("//"));
|
|
400 |
aItem.GetNextString( temp );
|
|
401 |
appId.Append( temp );
|
|
402 |
|
|
403 |
|
|
404 |
aItem.GetNextString(cmdLine16);
|
|
405 |
aItem.GetNextString(document);
|
|
406 |
aItem.GetNextString(mode);
|
|
407 |
aItem.GetNextString(postion);
|
|
408 |
aItem.GetNextString(callback);
|
|
409 |
aItem.GetNextInt(expected);
|
|
410 |
|
|
411 |
TBuf8<30> cmdLine ;
|
|
412 |
if( cmdLine16.CompareF(_L("NULL")) != 0 )
|
|
413 |
{
|
|
414 |
// Convert 16 Bit values into 8 bit as SAPI accept 8 bit Des
|
|
415 |
cmdLine.Copy(cmdLine16);
|
|
416 |
}
|
|
417 |
else
|
|
418 |
{
|
|
419 |
cmdLine.Copy(KNullDesC8);
|
|
420 |
}
|
|
421 |
|
|
422 |
if( document.CompareF(_L("NULL")) != 0 )
|
|
423 |
{
|
|
424 |
options.iDocument.Set(document);
|
|
425 |
}
|
|
426 |
|
|
427 |
if( mode.CompareF(_L("NULL")) != 0 )
|
|
428 |
{
|
|
429 |
options.iMode.Set(mode);
|
|
430 |
}
|
|
431 |
|
|
432 |
if( postion.CompareF(_L("NULL")) != 0 )
|
|
433 |
{
|
|
434 |
options.iPostion.Set(postion);
|
|
435 |
}
|
|
436 |
|
|
437 |
if( callback.CompareF(_L("NULL")) != 0 )
|
|
438 |
{
|
|
439 |
//Aysnch Call;
|
|
440 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait();
|
|
441 |
CleanupStack::PushL( wait);
|
|
442 |
CAppObserver* callback = CAppObserver::NewL(wait);
|
|
443 |
CleanupStack::PushL( callback);
|
|
444 |
TRAP( err,coreClass->LaunchApplicationL( appId,cmdLine,options,callback,1) );
|
|
445 |
|
|
446 |
|
|
447 |
//Reason of failure can be either 0 or some negative value which incates
|
|
448 |
//error but it cant be greater than 0
|
|
449 |
|
|
450 |
if(err == 0)
|
|
451 |
{
|
|
452 |
wait->Start();
|
|
453 |
// application launch
|
|
454 |
if ( callback->iReason > 0 )
|
|
455 |
{
|
|
456 |
//but we didn't get notifaction
|
|
457 |
|
|
458 |
//Reason of failure can be either 0 or some negative value which incates
|
|
459 |
//error but it cant be greater than 0
|
|
460 |
err = KErrGeneral;
|
|
461 |
}
|
|
462 |
}
|
|
463 |
|
|
464 |
CleanupStack::PopAndDestroy();
|
|
465 |
CleanupStack::PopAndDestroy();
|
|
466 |
}
|
|
467 |
else
|
|
468 |
{
|
|
469 |
//Synch call
|
|
470 |
TRAP( err,coreClass->LaunchApplicationL( appId,cmdLine,options) );
|
|
471 |
}
|
|
472 |
|
|
473 |
if(!expected)
|
|
474 |
{
|
|
475 |
//Postive Test Case
|
|
476 |
if(err != KErrNone)
|
|
477 |
{
|
|
478 |
result = KErrGeneral;
|
|
479 |
}
|
|
480 |
|
|
481 |
}
|
|
482 |
else
|
|
483 |
{
|
|
484 |
if (err == KErrNone)
|
|
485 |
{
|
|
486 |
result = KErrGeneral;
|
|
487 |
}
|
|
488 |
//Neagative Test Case
|
|
489 |
}
|
|
490 |
|
|
491 |
|
|
492 |
/*--------Test Logic Ends -----------*/
|
|
493 |
CleanupStack::PopAndDestroy(coreClass);
|
|
494 |
__UHEAP_MARK;
|
|
495 |
return result;
|
|
496 |
|
|
497 |
}
|
|
498 |
|
|
499 |
|
|
500 |
// -----------------------------------------------------------------------------
|
|
501 |
// CAppManagerTest:launchDocL
|
|
502 |
// Example test method function.
|
|
503 |
// (other items were commented in a header).
|
|
504 |
// -----------------------------------------------------------------------------
|
|
505 |
//
|
|
506 |
|
|
507 |
TInt CAppManagerTest::launchDocL( CStifItemParser& aItem )
|
|
508 |
{
|
|
509 |
|
|
510 |
|
|
511 |
__UHEAP_MARK;
|
|
512 |
TOptions options;
|
|
513 |
TDocument criteria;
|
|
514 |
TInt expected;
|
|
515 |
CAppManagerService* coreClass = CAppManagerService::NewL();
|
|
516 |
CleanupStack::PushL(coreClass);
|
|
517 |
/*--------Test Logic Starts-----------*/
|
|
518 |
|
|
519 |
TBuf<30> filename;
|
|
520 |
TPtrC16 path;
|
|
521 |
TPtrC16 handle;
|
|
522 |
TPtrC16 mimetype16;
|
|
523 |
TPtrC16 mode;
|
|
524 |
TPtrC16 callback;
|
|
525 |
TInt err;
|
|
526 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail
|
|
527 |
|
|
528 |
|
|
529 |
aItem.GetNextString(path);
|
|
530 |
aItem.GetNextString(handle);
|
|
531 |
aItem.GetNextString(mimetype16);
|
|
532 |
aItem.GetNextString(mode);
|
|
533 |
aItem.GetNextString(callback);
|
|
534 |
aItem.GetNextInt(expected);
|
|
535 |
|
|
536 |
|
|
537 |
if( path.CompareF(_L("NULL")) != 0 )
|
|
538 |
{
|
|
539 |
criteria.iPath.Set(path);
|
|
540 |
}
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
if( handle.CompareF(_L("NULL")) != 0 )
|
|
546 |
{
|
|
547 |
RFs fileSession;
|
|
548 |
User::LeaveIfError(fileSession.Connect());
|
|
549 |
RFile file;
|
|
550 |
User::LeaveIfError(fileSession.ShareProtected());
|
|
551 |
file.Open(fileSession,handle,EFileShareReadersOnly);
|
|
552 |
criteria.iHandle.Duplicate(file);
|
|
553 |
}
|
|
554 |
|
|
555 |
|
|
556 |
|
|
557 |
if( mode.CompareF(_L("NULL")) != 0 )
|
|
558 |
{
|
|
559 |
options.iMode.Set(mode);
|
|
560 |
}
|
|
561 |
|
|
562 |
|
|
563 |
|
|
564 |
TBuf8<30> mimetype ;
|
|
565 |
if( mimetype16.CompareF(_L("NULL")) != 0 )
|
|
566 |
{
|
|
567 |
// Convert 16 Bit values into 8 bit as SAPI accept 8 bit Des
|
|
568 |
mimetype.Copy(mimetype16);
|
|
569 |
}
|
|
570 |
else
|
|
571 |
{
|
|
572 |
mimetype.Copy(KNullDesC8);
|
|
573 |
}
|
|
574 |
|
|
575 |
|
|
576 |
|
|
577 |
if( callback.CompareF(_L("NULL")) != 0 )
|
|
578 |
{
|
|
579 |
//Aysnch Call;
|
|
580 |
CActiveSchedulerWait *wait = new CActiveSchedulerWait();
|
|
581 |
CleanupStack::PushL( wait);
|
|
582 |
CAppObserver* callback = CAppObserver::NewL(wait);
|
|
583 |
CleanupStack::PushL( callback);
|
|
584 |
TRAP( err,coreClass->LaunchDocumentL(criteria,mimetype,options,filename,callback,1) );
|
|
585 |
|
|
586 |
//Reason of failure can be either 0 or some negative value which incates
|
|
587 |
//error but it cant be greater than 0
|
|
588 |
|
|
589 |
if(err == 0)
|
|
590 |
{
|
|
591 |
wait->Start();
|
|
592 |
// application launch
|
|
593 |
if ( callback->iReason > 0 )
|
|
594 |
{
|
|
595 |
//but we didn't get notifaction
|
|
596 |
|
|
597 |
//Reason of failure can be either 0 or some negative value which incates
|
|
598 |
//error but it cant be greater than 0
|
|
599 |
err = KErrGeneral;
|
|
600 |
}
|
|
601 |
}
|
|
602 |
|
|
603 |
CleanupStack::PopAndDestroy();
|
|
604 |
CleanupStack::PopAndDestroy();
|
|
605 |
}
|
|
606 |
else
|
|
607 |
{
|
|
608 |
//Synch call
|
|
609 |
TRAP( err,coreClass->LaunchDocumentL(criteria,mimetype,options,filename) );
|
|
610 |
}
|
|
611 |
|
|
612 |
if(!expected)
|
|
613 |
{
|
|
614 |
//Postive Test Case
|
|
615 |
if(err != KErrNone)
|
|
616 |
{
|
|
617 |
result = err;
|
|
618 |
}
|
|
619 |
|
|
620 |
}
|
|
621 |
else
|
|
622 |
{
|
|
623 |
if (err == KErrNone)
|
|
624 |
{
|
|
625 |
result = KErrGeneral;
|
|
626 |
}
|
|
627 |
//Neagative Test Case
|
|
628 |
}
|
|
629 |
|
|
630 |
|
|
631 |
/*--------Test Logic Ends -----------*/
|
|
632 |
CleanupStack::PopAndDestroy(coreClass);
|
|
633 |
__UHEAP_MARK;
|
|
634 |
return result;
|
|
635 |
|
|
636 |
}
|
|
637 |
|
|
638 |
|
|
639 |
|
|
640 |
//Helper Function
|
|
641 |
|
|
642 |
TInt CAppManagerTest::ConvertHexStringToInt32(const TDesC& aHexString,TInt32& aInt32 )
|
|
643 |
{
|
|
644 |
aInt32 = 0;
|
|
645 |
|
|
646 |
TInt pos = aHexString.LocateF( 'x' );
|
|
647 |
if ( pos == KErrNotFound )
|
|
648 |
{
|
|
649 |
pos = 0;
|
|
650 |
}
|
|
651 |
else
|
|
652 |
{
|
|
653 |
pos++;
|
|
654 |
}
|
|
655 |
|
|
656 |
if( ( aHexString.Length() - pos ) > KDocMaxDigitsInHexString )
|
|
657 |
{
|
|
658 |
return KErrArgument; // Error: value too big.
|
|
659 |
}
|
|
660 |
TPtrC aHexStringPtr( aHexString.Mid( pos ) );
|
|
661 |
|
|
662 |
TInt64 value64;
|
|
663 |
if ( TLex( aHexStringPtr ).Val( value64, EHex ) != KErrNone )
|
|
664 |
{
|
|
665 |
return KErrArgument; // Error: conversion failed.
|
|
666 |
}
|
|
667 |
aInt32 = value64;
|
|
668 |
|
|
669 |
return KErrNone;
|
|
670 |
}
|
|
671 |
|
|
672 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
673 |
// None
|
|
674 |
|
|
675 |
// End of File
|