|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32math.h> |
|
23 #include <es_sock.h> |
|
24 #include "DownloadMgrClientApiTest.h" |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 // None |
|
28 |
|
29 // EXTERNAL FUNCTION PROTOTYPES |
|
30 // None |
|
31 |
|
32 // CONSTANTS |
|
33 // None |
|
34 |
|
35 // MACROS |
|
36 // None |
|
37 |
|
38 // LOCAL CONSTANTS AND MACROS |
|
39 // None |
|
40 |
|
41 // MODULE DATA STRUCTURES |
|
42 // None |
|
43 |
|
44 // LOCAL FUNCTION PROTOTYPES |
|
45 // None |
|
46 |
|
47 // FORWARD DECLARATIONS |
|
48 // None |
|
49 |
|
50 // ==================== LOCAL FUNCTIONS ======================================= |
|
51 |
|
52 // ============================ MEMBER FUNCTIONS =============================== |
|
53 |
|
54 /* |
|
55 ------------------------------------------------------------------------------- |
|
56 |
|
57 Class: CDownloadMgrClientApiTest |
|
58 |
|
59 Method: ManagerConnectLTest |
|
60 |
|
61 Description: Test the RHttpDownloadMgr ConnectL method. |
|
62 |
|
63 Parameters: TTestResult& aErrorDescription: out: |
|
64 Test result and on error case a short description of error |
|
65 |
|
66 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
67 |
|
68 Errors/Exceptions: None |
|
69 |
|
70 Status: Approved |
|
71 |
|
72 ------------------------------------------------------------------------------- |
|
73 */ |
|
74 TInt CDownloadMgrClientApiTest::ManagerConnectLTest( TTestResult& aResult ) |
|
75 { |
|
76 /* Simple server connect */ |
|
77 _LIT( KDefinition ,"State"); |
|
78 _LIT( KData ,"Test the RHttpDownloadMgr ConnectL method"); |
|
79 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
80 |
|
81 RHttpDownloadMgr downloadMgr; |
|
82 |
|
83 // Added To avoid user Input while Automation in is Progress |
|
84 // 7 - SONERA GPRS Access Point |
|
85 TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 ); |
|
86 |
|
87 downloadMgr.ConnectL( TUid::Uid( KThisAppUid ), *this, EFalse ); |
|
88 |
|
89 _LIT( KData2 ,"Finished"); |
|
90 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
91 |
|
92 // RHttpDownloadMgr::ConnectL provides no results, so if we've gotten this far assume success |
|
93 _LIT( KDescription , "Test case passed" ); |
|
94 aResult.SetResult( KErrNone, KDescription ); |
|
95 |
|
96 downloadMgr.Close(); |
|
97 |
|
98 // Case was executed |
|
99 return KErrNone; |
|
100 } |
|
101 |
|
102 /* |
|
103 ------------------------------------------------------------------------------- |
|
104 |
|
105 Class: CDownloadMgrClientApiTest |
|
106 |
|
107 Method: ManagerVersionTest |
|
108 |
|
109 Description: Test the RHttpDownloadMgr Version method. |
|
110 |
|
111 Parameters: TTestResult& aErrorDescription: out: |
|
112 Test result and on error case a short description of error |
|
113 |
|
114 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
115 |
|
116 Errors/Exceptions: None |
|
117 |
|
118 Status: Approved |
|
119 |
|
120 ------------------------------------------------------------------------------- |
|
121 */ |
|
122 TInt CDownloadMgrClientApiTest::ManagerVersionTest( TTestResult& aResult ) |
|
123 { |
|
124 /* Simple server connect */ |
|
125 _LIT( KDefinition ,"State"); |
|
126 _LIT( KData ,"Test the RHttpDownloadMgr Version method"); |
|
127 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
128 |
|
129 _LIT( KData2 ,"Finished"); |
|
130 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
131 |
|
132 TVersion version; |
|
133 |
|
134 version = iDownloadManager.Version(); |
|
135 |
|
136 if (version.iMinor > 0) |
|
137 { |
|
138 _LIT( KDescription , "Test case passed" ); |
|
139 aResult.SetResult( KErrNone, KDescription ); |
|
140 } |
|
141 else |
|
142 { |
|
143 _LIT( KDescription , "Test case failed" ); |
|
144 aResult.SetResult( KErrGeneral, KDescription ); |
|
145 } |
|
146 |
|
147 // Case was executed |
|
148 return KErrNone; |
|
149 } |
|
150 |
|
151 /* |
|
152 ------------------------------------------------------------------------------- |
|
153 |
|
154 Class: CDownloadMgrClientApiTest |
|
155 |
|
156 Method: ManagerCloseTest |
|
157 |
|
158 Description: Test the RHttpDownloadMgr Close method. |
|
159 |
|
160 Parameters: TTestResult& aErrorDescription: out: |
|
161 Test result and on error case a short description of error |
|
162 |
|
163 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
164 |
|
165 Errors/Exceptions: None |
|
166 |
|
167 Status: Approved |
|
168 |
|
169 ------------------------------------------------------------------------------- |
|
170 */ |
|
171 TInt CDownloadMgrClientApiTest::ManagerCloseTest( TTestResult& aResult ) |
|
172 { |
|
173 /* Simple server connect */ |
|
174 _LIT( KDefinition ,"State"); |
|
175 _LIT( KData ,"Test the RHttpDownloadMgr Close method"); |
|
176 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
177 |
|
178 RHttpDownloadMgr downloadMgr; |
|
179 |
|
180 downloadMgr.ConnectL( TUid::Uid( KThisAppUid ), *this, EFalse ); |
|
181 |
|
182 downloadMgr.Close(); |
|
183 |
|
184 _LIT( KData2 ,"Finished"); |
|
185 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
186 |
|
187 // RHttpDownloadMgr::Close provides no results, so if we've gotten this far assume success |
|
188 _LIT( KDescription , "Test case passed" ); |
|
189 aResult.SetResult( KErrNone, KDescription ); |
|
190 |
|
191 // Case was executed |
|
192 return KErrNone; |
|
193 } |
|
194 |
|
195 /* |
|
196 ------------------------------------------------------------------------------- |
|
197 |
|
198 Class: CDownloadMgrClientApiTest |
|
199 |
|
200 Method: ManagerCurrentDownloadsTest |
|
201 |
|
202 Description: Test the RHttpDownloadMgr CurrentDownloads method. |
|
203 |
|
204 Parameters: TTestResult& aErrorDescription: out: |
|
205 Test result and on error case a short description of error |
|
206 |
|
207 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
208 |
|
209 Errors/Exceptions: None |
|
210 |
|
211 Status: Approved |
|
212 |
|
213 ------------------------------------------------------------------------------- |
|
214 */ |
|
215 TInt CDownloadMgrClientApiTest::ManagerCurrentDownloadsTest( TTestResult& aResult ) |
|
216 { |
|
217 /* Simple server connect */ |
|
218 _LIT( KDefinition ,"State"); |
|
219 _LIT( KData ,"Test the RHttpDownloadMgr CurrentDownloads method"); |
|
220 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
221 |
|
222 const CDownloadArray* array; |
|
223 array = &iDownloadManager.CurrentDownloads(); |
|
224 |
|
225 _LIT( KData2 ,"Finished"); |
|
226 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
227 |
|
228 if (array->Count() == 0) |
|
229 { |
|
230 _LIT( KDescription , "Test case passed" ); |
|
231 aResult.SetResult( KErrNone, KDescription ); |
|
232 } |
|
233 else |
|
234 { |
|
235 _LIT( KDescription , "Test case failed" ); |
|
236 aResult.SetResult( KErrGeneral, KDescription ); |
|
237 } |
|
238 |
|
239 // Case was executed |
|
240 return KErrNone; |
|
241 } |
|
242 |
|
243 /* |
|
244 ------------------------------------------------------------------------------- |
|
245 |
|
246 Class: CDownloadMgrClientApiTest |
|
247 |
|
248 Method: ManagerCreateDownloadLWithBoolTest |
|
249 |
|
250 Description: Test the RHttpDownloadMgr CreateDownloadL method with TBool argument. |
|
251 |
|
252 Parameters: TTestResult& aErrorDescription: out: |
|
253 Test result and on error case a short description of error |
|
254 |
|
255 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
256 |
|
257 Errors/Exceptions: None |
|
258 |
|
259 Status: Approved |
|
260 |
|
261 ------------------------------------------------------------------------------- |
|
262 */ |
|
263 TInt CDownloadMgrClientApiTest::ManagerCreateDownloadLWithBoolTest( TTestResult& aResult ) |
|
264 { |
|
265 /* Simple server connect */ |
|
266 _LIT( KDefinition ,"State"); |
|
267 _LIT( KData ,"Test the RHttpDownloadMgr CreateDownloadL method with TBool argument"); |
|
268 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
269 |
|
270 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
271 CleanupStack::PushL( scheduler ); |
|
272 CActiveScheduler::Install( scheduler ); |
|
273 |
|
274 TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
275 |
|
276 TBool isNewDl = ETrue; |
|
277 RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl ); |
|
278 |
|
279 _LIT( KData2 ,"Finished"); |
|
280 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
281 |
|
282 if ( &download != NULL ) |
|
283 { |
|
284 _LIT( KDescription , "Test case passed" ); |
|
285 aResult.SetResult( KErrNone, KDescription ); |
|
286 } |
|
287 else |
|
288 { |
|
289 _LIT( KDescription , "Test case failed" ); |
|
290 aResult.SetResult( KErrGeneral, KDescription ); |
|
291 } |
|
292 |
|
293 iDownloadManager.DeleteAll(); |
|
294 CleanupStack::PopAndDestroy(); // scheduler |
|
295 |
|
296 // Case was executed |
|
297 return KErrNone; |
|
298 } |
|
299 |
|
300 /* |
|
301 ------------------------------------------------------------------------------- |
|
302 |
|
303 Class: CDownloadMgrClientApiTest |
|
304 |
|
305 Method: ManagerCreateDownloadLTest |
|
306 |
|
307 Description: Test the RHttpDownloadMgr CreateDownloadL method. |
|
308 |
|
309 Parameters: TTestResult& aErrorDescription: out: |
|
310 Test result and on error case a short description of error |
|
311 |
|
312 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
313 |
|
314 Errors/Exceptions: None |
|
315 |
|
316 Status: Approved |
|
317 |
|
318 ------------------------------------------------------------------------------- |
|
319 */ |
|
320 TInt CDownloadMgrClientApiTest::ManagerCreateDownloadLTest( TTestResult& aResult ) |
|
321 { |
|
322 /* Simple server connect */ |
|
323 _LIT( KDefinition ,"State"); |
|
324 _LIT( KData ,"Test the RHttpDownloadMgr CreateDownloadL method"); |
|
325 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
326 |
|
327 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
328 CleanupStack::PushL( scheduler ); |
|
329 CActiveScheduler::Install( scheduler ); |
|
330 |
|
331 TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
332 |
|
333 RHttpDownload& download = iDownloadManager.CreateDownloadL( url ); |
|
334 |
|
335 _LIT( KData2 ,"Finished"); |
|
336 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
337 |
|
338 if ( &download != NULL ) |
|
339 { |
|
340 _LIT( KDescription , "Test case passed" ); |
|
341 aResult.SetResult( KErrNone, KDescription ); |
|
342 } |
|
343 else |
|
344 { |
|
345 _LIT( KDescription , "Test case failed" ); |
|
346 aResult.SetResult( KErrGeneral, KDescription ); |
|
347 } |
|
348 |
|
349 iDownloadManager.DeleteAll(); |
|
350 CleanupStack::PopAndDestroy(); // scheduler |
|
351 |
|
352 // Case was executed |
|
353 return KErrNone; |
|
354 } |
|
355 |
|
356 /* |
|
357 ------------------------------------------------------------------------------- |
|
358 |
|
359 Class: CDownloadMgrClientApiTest |
|
360 |
|
361 Method: ManagerCreateClientSideDownloadLTest |
|
362 |
|
363 Description: Test the RHttpDownloadMgr CreateClientSideDownloadL method. |
|
364 |
|
365 Parameters: TTestResult& aErrorDescription: out: |
|
366 Test result and on error case a short description of error |
|
367 |
|
368 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
369 |
|
370 Errors/Exceptions: None |
|
371 |
|
372 Status: Approved |
|
373 |
|
374 ------------------------------------------------------------------------------- |
|
375 */ |
|
376 TInt CDownloadMgrClientApiTest::ManagerCreateClientSideDownloadLTest( TTestResult& aResult ) |
|
377 { |
|
378 /* Simple server connect */ |
|
379 _LIT( KDefinition ,"State"); |
|
380 _LIT( KData ,"Test the RHttpDownloadMgr CreateClientSideDownloadL method"); |
|
381 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
382 |
|
383 _LIT( KUnableToTest1 ,"Unable to test CreateClientSideDownloadL method"); |
|
384 TestModuleIf().Printf( 0, KDefinition, KUnableToTest1 ); |
|
385 |
|
386 _LIT( KUnableToTest2 ,"S60 3rd Edition SDK does not provide a way to create the required CHttpTransaction"); |
|
387 TestModuleIf().Printf( 0, KDefinition, KUnableToTest2 ); |
|
388 |
|
389 // CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
390 // CleanupStack::PushL( scheduler ); |
|
391 // CActiveScheduler::Install( scheduler ); |
|
392 |
|
393 // CUrlRequestInfo* requestInfo = CUrlRequestInfo::NewL(); |
|
394 // CleanupStack::NewL( requestInfo ); |
|
395 // _LIT( KUrl, "http://testsuite.nokia-boston.com"); |
|
396 // requestInfo->SetUrlL( KUrl() ); |
|
397 |
|
398 // TBool isNewDl = ETrue; |
|
399 // RHttpDownload& download = iDownloadManager.CreateClientSideDownloadL( NULL, isNewDl ); |
|
400 // RHttpDownload& download = NULL; |
|
401 |
|
402 _LIT( KData2 ,"Finished"); |
|
403 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
404 |
|
405 // if ( &download != NULL ) |
|
406 // { |
|
407 // _LIT( KDescription , "Test case passed" ); |
|
408 // aResult.SetResult( KErrNone, KDescription ); |
|
409 // } |
|
410 // else |
|
411 // { |
|
412 _LIT( KDescription , "Test case failed" ); |
|
413 aResult.SetResult( KErrGeneral, KDescription ); |
|
414 // } |
|
415 |
|
416 // iDownloadManager.DeleteAll(); |
|
417 // CleanupStack::PopAndDestroy( 2 ); // scheduler, requestInfo |
|
418 |
|
419 // Case was executed |
|
420 return KErrNone; |
|
421 } |
|
422 |
|
423 /* |
|
424 ------------------------------------------------------------------------------- |
|
425 |
|
426 Class: CDownloadMgrClientApiTest |
|
427 |
|
428 Method: ManagerCreateCodDownloadLTest |
|
429 |
|
430 Description: Test the RHttpDownloadMgr CreateCodDownloadL method. |
|
431 |
|
432 Parameters: TTestResult& aErrorDescription: out: |
|
433 Test result and on error case a short description of error |
|
434 |
|
435 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
436 |
|
437 Errors/Exceptions: None |
|
438 |
|
439 Status: Approved |
|
440 |
|
441 ------------------------------------------------------------------------------- |
|
442 */ |
|
443 TInt CDownloadMgrClientApiTest::ManagerCreateCodDownloadLTest( TTestResult& aResult ) |
|
444 { |
|
445 /* Simple server connect */ |
|
446 _LIT( KDefinition ,"State"); |
|
447 _LIT( KData ,"Test the RHttpDownloadMgr CreateCodDownloadL method"); |
|
448 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
449 |
|
450 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
451 CleanupStack::PushL( scheduler ); |
|
452 CActiveScheduler::Install( scheduler ); |
|
453 |
|
454 _LIT8( KCodUrl, "testsuite.nokia-boston.com" ); |
|
455 HBufC8* buf = HBufC8::NewLC( KCodUrl().Length() ); |
|
456 buf->Des().Copy( KCodUrl() ); |
|
457 _LIT8( KCodMimeType, "text/x-co-desc" ); |
|
458 |
|
459 |
|
460 TInt retVal; |
|
461 RHttpDownload* download; |
|
462 download = &iDownloadManager.CreateCodDownloadL( KCodUrl(), |
|
463 buf->Des(), |
|
464 KCodMimeType(), |
|
465 NULL, |
|
466 retVal ); |
|
467 |
|
468 _LIT( KData2 ,"Finished"); |
|
469 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
470 |
|
471 if ( &download != NULL ) |
|
472 { |
|
473 _LIT( KDescription , "Test case passed" ); |
|
474 aResult.SetResult( KErrNone, KDescription ); |
|
475 } |
|
476 else |
|
477 { |
|
478 _LIT( KDescription , "Test case failed" ); |
|
479 aResult.SetResult( KErrGeneral, KDescription ); |
|
480 } |
|
481 |
|
482 iDownloadManager.DeleteAll(); |
|
483 CleanupStack::PopAndDestroy( 2 ); // scheduler, buf |
|
484 |
|
485 // Case was executed |
|
486 return KErrNone; |
|
487 } |
|
488 |
|
489 /* |
|
490 ------------------------------------------------------------------------------- |
|
491 |
|
492 Class: CDownloadMgrClientApiTest |
|
493 |
|
494 Method: ManagerFindDownloadTest |
|
495 |
|
496 Description: Test the RHttpDownloadMgr FindDownload method. |
|
497 |
|
498 Parameters: TTestResult& aErrorDescription: out: |
|
499 Test result and on error case a short description of error |
|
500 |
|
501 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
502 |
|
503 Errors/Exceptions: None |
|
504 |
|
505 Status: Approved |
|
506 |
|
507 ------------------------------------------------------------------------------- |
|
508 */ |
|
509 TInt CDownloadMgrClientApiTest::ManagerFindDownloadTest( TTestResult& aResult ) |
|
510 { |
|
511 /* Simple server connect */ |
|
512 _LIT( KDefinition ,"State"); |
|
513 _LIT( KData ,"Test the RHttpDownloadMgr FindDownload method"); |
|
514 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
515 |
|
516 TBuf<128> url = _L("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
517 _LIT8( KMsgBody, "123456789123456789123456789"); |
|
518 |
|
519 HBufC8* urlToFind = HBufC8::NewLC( url.Length() ); |
|
520 urlToFind->Des().Copy( url ); |
|
521 |
|
522 // Added To avoid user Input while Automation in is Progress |
|
523 // 7 - SONERA GPRS Access Point |
|
524 TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 ); |
|
525 |
|
526 RHttpDownload* download = iDownloadManager.FindDownload( *urlToFind, KMsgBody() ); |
|
527 |
|
528 _LIT( KData2 ,"Finished"); |
|
529 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
530 |
|
531 if ( download == NULL ) |
|
532 { |
|
533 _LIT( KDescription , "Test case passed" ); |
|
534 aResult.SetResult( KErrNone, KDescription ); |
|
535 } |
|
536 else |
|
537 { |
|
538 _LIT( KDescription , "Test case failed" ); |
|
539 aResult.SetResult( KErrGeneral, KDescription ); |
|
540 } |
|
541 |
|
542 CleanupStack::PopAndDestroy(); // urlToFind |
|
543 |
|
544 // Case was executed |
|
545 return KErrNone; |
|
546 } |
|
547 |
|
548 /* |
|
549 ------------------------------------------------------------------------------- |
|
550 |
|
551 Class: CDownloadMgrClientApiTest |
|
552 |
|
553 Method: ManagerPauseAllTest |
|
554 |
|
555 Description: Test the RHttpDownloadMgr PauseAll method. |
|
556 |
|
557 Parameters: TTestResult& aErrorDescription: out: |
|
558 Test result and on error case a short description of error |
|
559 |
|
560 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
561 |
|
562 Errors/Exceptions: None |
|
563 |
|
564 Status: Approved |
|
565 |
|
566 ------------------------------------------------------------------------------- |
|
567 */ |
|
568 TInt CDownloadMgrClientApiTest::ManagerPauseAllTest( TTestResult& aResult ) |
|
569 { |
|
570 /* Simple server connect */ |
|
571 _LIT( KDefinition ,"State"); |
|
572 _LIT( KData ,"Test the RHttpDownloadMgr PauseAll method"); |
|
573 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
574 |
|
575 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
576 CleanupStack::PushL( scheduler ); |
|
577 CActiveScheduler::Install( scheduler ); |
|
578 |
|
579 // Added To avoid user Input while Automation in is Progress |
|
580 // 7 - SONERA GPRS Access Point |
|
581 TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 ); |
|
582 |
|
583 TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
584 |
|
585 RHttpDownload& download = iDownloadManager.CreateDownloadL( url ); |
|
586 |
|
587 download.Start(); |
|
588 |
|
589 TInt result = iDownloadManager.PauseAll(); |
|
590 |
|
591 _LIT( KData2 ,"Finished"); |
|
592 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
593 |
|
594 if ( result == KErrNone ) |
|
595 { |
|
596 _LIT( KDescription , "Test case passed" ); |
|
597 aResult.SetResult( KErrNone, KDescription ); |
|
598 } |
|
599 else |
|
600 { |
|
601 _LIT( KDescription , "Test case failed" ); |
|
602 aResult.SetResult( KErrGeneral, KDescription ); |
|
603 } |
|
604 |
|
605 iDownloadManager.DeleteAll(); |
|
606 CleanupStack::PopAndDestroy(); // scheduler |
|
607 |
|
608 // Case was executed |
|
609 return KErrNone; |
|
610 } |
|
611 |
|
612 /* |
|
613 ------------------------------------------------------------------------------- |
|
614 |
|
615 Class: CDownloadMgrClientApiTest |
|
616 |
|
617 Method: ManagerStartAllTest |
|
618 |
|
619 Description: Test the RHttpDownloadMgr StartAll method. |
|
620 |
|
621 Parameters: TTestResult& aErrorDescription: out: |
|
622 Test result and on error case a short description of error |
|
623 |
|
624 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
625 |
|
626 Errors/Exceptions: None |
|
627 |
|
628 Status: Approved |
|
629 |
|
630 ------------------------------------------------------------------------------- |
|
631 */ |
|
632 TInt CDownloadMgrClientApiTest::ManagerStartAllTest( TTestResult& aResult ) |
|
633 { |
|
634 /* Simple server connect */ |
|
635 _LIT( KDefinition ,"State"); |
|
636 _LIT( KData ,"Test the RHttpDownloadMgr StartAll method"); |
|
637 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
638 |
|
639 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
640 CleanupStack::PushL( scheduler ); |
|
641 CActiveScheduler::Install( scheduler ); |
|
642 |
|
643 // Added To avoid user Input while Automation in is Progress |
|
644 // 7 - SONERA GPRS Access Point |
|
645 TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 ); |
|
646 TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
647 |
|
648 RHttpDownload& download = iDownloadManager.CreateDownloadL( url ); |
|
649 |
|
650 TInt result = iDownloadManager.StartAll(); |
|
651 |
|
652 _LIT( KData2 ,"Finished"); |
|
653 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
654 |
|
655 if ( result == KErrNone ) |
|
656 { |
|
657 _LIT( KDescription , "Test case passed" ); |
|
658 aResult.SetResult( KErrNone, KDescription ); |
|
659 } |
|
660 else |
|
661 { |
|
662 _LIT( KDescription , "Test case failed" ); |
|
663 aResult.SetResult( KErrGeneral, KDescription ); |
|
664 } |
|
665 |
|
666 iDownloadManager.DeleteAll(); |
|
667 CleanupStack::PopAndDestroy(); // scheduler |
|
668 |
|
669 // Case was executed |
|
670 return KErrNone; |
|
671 } |
|
672 |
|
673 /* |
|
674 ------------------------------------------------------------------------------- |
|
675 |
|
676 Class: CDownloadMgrClientApiTest |
|
677 |
|
678 Method: ManagerResetAllTest |
|
679 |
|
680 Description: Test the RHttpDownloadMgr ResetAll method. |
|
681 |
|
682 Parameters: TTestResult& aErrorDescription: out: |
|
683 Test result and on error case a short description of error |
|
684 |
|
685 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
686 |
|
687 Errors/Exceptions: None |
|
688 |
|
689 Status: Approved |
|
690 |
|
691 ------------------------------------------------------------------------------- |
|
692 */ |
|
693 TInt CDownloadMgrClientApiTest::ManagerResetAllTest( TTestResult& aResult ) |
|
694 { |
|
695 /* Simple server connect */ |
|
696 _LIT( KDefinition ,"State"); |
|
697 _LIT( KData ,"Test the RHttpDownloadMgr ResetAll method"); |
|
698 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
699 |
|
700 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
701 CleanupStack::PushL( scheduler ); |
|
702 CActiveScheduler::Install( scheduler ); |
|
703 |
|
704 // Added To avoid user Input while Automation in is Progress |
|
705 // 7 - SONERA GPRS Access Point |
|
706 TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 ); |
|
707 |
|
708 TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
709 |
|
710 RHttpDownload& download = iDownloadManager.CreateDownloadL( url ); |
|
711 |
|
712 iDownloadManager.StartAll(); |
|
713 |
|
714 TInt result = iDownloadManager.ResetAll(); |
|
715 |
|
716 _LIT( KData2 ,"Finished"); |
|
717 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
718 |
|
719 if ( result == KErrNone ) |
|
720 { |
|
721 _LIT( KDescription , "Test case passed" ); |
|
722 aResult.SetResult( KErrNone, KDescription ); |
|
723 } |
|
724 else |
|
725 { |
|
726 _LIT( KDescription , "Test case failed" ); |
|
727 aResult.SetResult( KErrGeneral, KDescription ); |
|
728 } |
|
729 |
|
730 iDownloadManager.DeleteAll(); |
|
731 CleanupStack::PopAndDestroy(); // scheduler |
|
732 |
|
733 // Case was executed |
|
734 return KErrNone; |
|
735 } |
|
736 |
|
737 /* |
|
738 ------------------------------------------------------------------------------- |
|
739 |
|
740 Class: CDownloadMgrClientApiTest |
|
741 |
|
742 Method: ManagerDeleteAllTest |
|
743 |
|
744 Description: Test the RHttpDownloadMgr DeleteAll method. |
|
745 |
|
746 Parameters: TTestResult& aErrorDescription: out: |
|
747 Test result and on error case a short description of error |
|
748 |
|
749 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
750 |
|
751 Errors/Exceptions: None |
|
752 |
|
753 Status: Approved |
|
754 |
|
755 ------------------------------------------------------------------------------- |
|
756 */ |
|
757 TInt CDownloadMgrClientApiTest::ManagerDeleteAllTest( TTestResult& aResult ) |
|
758 { |
|
759 /* Simple server connect */ |
|
760 _LIT( KDefinition ,"State"); |
|
761 _LIT( KData ,"Test the RHttpDownloadMgr DeleteAll method"); |
|
762 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
763 |
|
764 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
765 CleanupStack::PushL( scheduler ); |
|
766 CActiveScheduler::Install( scheduler ); |
|
767 |
|
768 // Added To avoid user Input while Automation in is Progress |
|
769 // 7 - SONERA GPRS Access Point |
|
770 TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 ); |
|
771 TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
772 |
|
773 RHttpDownload& download = iDownloadManager.CreateDownloadL( url ); |
|
774 |
|
775 TInt result = iDownloadManager.DeleteAll(); |
|
776 |
|
777 _LIT( KData2 ,"Finished"); |
|
778 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
779 |
|
780 if ( result == KErrNone ) |
|
781 { |
|
782 _LIT( KDescription , "Test case passed" ); |
|
783 aResult.SetResult( KErrNone, KDescription ); |
|
784 } |
|
785 else |
|
786 { |
|
787 _LIT( KDescription , "Test case failed" ); |
|
788 aResult.SetResult( KErrGeneral, KDescription ); |
|
789 } |
|
790 |
|
791 CleanupStack::PopAndDestroy(); // scheduler |
|
792 |
|
793 // Case was executed |
|
794 return KErrNone; |
|
795 } |
|
796 |
|
797 /* |
|
798 ------------------------------------------------------------------------------- |
|
799 |
|
800 Class: CDownloadMgrClientApiTest |
|
801 |
|
802 Method: ManagerDisconnectTest |
|
803 |
|
804 Description: Test the RHttpDownloadMgr Disconnect method. |
|
805 |
|
806 Parameters: TTestResult& aErrorDescription: out: |
|
807 Test result and on error case a short description of error |
|
808 |
|
809 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
810 |
|
811 Errors/Exceptions: None |
|
812 |
|
813 Status: Approved |
|
814 |
|
815 ------------------------------------------------------------------------------- |
|
816 */ |
|
817 TInt CDownloadMgrClientApiTest::ManagerDisconnectTest( TTestResult& aResult ) |
|
818 { |
|
819 /* Simple server connect */ |
|
820 _LIT( KDefinition ,"State"); |
|
821 _LIT( KData ,"Test the RHttpDownloadMgr Disconnect method"); |
|
822 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
823 |
|
824 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
825 CleanupStack::PushL( scheduler ); |
|
826 CActiveScheduler::Install( scheduler ); |
|
827 |
|
828 // Added To avoid user Input while Automation in is Progress |
|
829 // 7 - SONERA GPRS Access Point |
|
830 TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 ); |
|
831 |
|
832 TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml"); |
|
833 |
|
834 RHttpDownload& download = iDownloadManager.CreateDownloadL( url ); |
|
835 |
|
836 TInt result = iDownloadManager.Disconnect(); |
|
837 |
|
838 _LIT( KData2 ,"Finished"); |
|
839 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
840 |
|
841 if ( result == KErrNone ) |
|
842 { |
|
843 _LIT( KDescription , "Test case passed" ); |
|
844 aResult.SetResult( KErrNone, KDescription ); |
|
845 } |
|
846 else |
|
847 { |
|
848 _LIT( KDescription , "Test case failed" ); |
|
849 aResult.SetResult( KErrGeneral, KDescription ); |
|
850 } |
|
851 |
|
852 iDownloadManager.DeleteAll(); |
|
853 CleanupStack::PopAndDestroy(); // scheduler |
|
854 |
|
855 // Case was executed |
|
856 return KErrNone; |
|
857 } |
|
858 |
|
859 /* |
|
860 ------------------------------------------------------------------------------- |
|
861 |
|
862 Class: CDownloadMgrClientApiTest |
|
863 |
|
864 Method: ManagerGetIntAttributeTest |
|
865 |
|
866 Description: Test the RHttpDownloadMgr GetIntAttribute method. |
|
867 |
|
868 Parameters: TTestResult& aErrorDescription: out: |
|
869 Test result and on error case a short description of error |
|
870 |
|
871 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
872 |
|
873 Errors/Exceptions: None |
|
874 |
|
875 Status: Approved |
|
876 |
|
877 ------------------------------------------------------------------------------- |
|
878 */ |
|
879 TInt CDownloadMgrClientApiTest::ManagerGetIntAttributeTest( TTestResult& aResult ) |
|
880 { |
|
881 /* Simple server connect */ |
|
882 _LIT( KDefinition ,"State"); |
|
883 _LIT( KData ,"Test the RHttpDownloadMgr GetIntAttribute method"); |
|
884 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
885 |
|
886 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
887 CleanupStack::PushL( scheduler ); |
|
888 CActiveScheduler::Install( scheduler ); |
|
889 |
|
890 TInt32 value; |
|
891 TInt result = iDownloadManager.GetIntAttribute( EDlMgrAppUid, value ); |
|
892 |
|
893 _LIT( KData2 ,"Finished"); |
|
894 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
895 |
|
896 if( result == KErrNone ) |
|
897 { |
|
898 _LIT( KDescription , "Test case passed" ); |
|
899 aResult.SetResult( KErrNone, KDescription ); |
|
900 } |
|
901 else |
|
902 { |
|
903 _LIT( KDescription , "Test case failed" ); |
|
904 aResult.SetResult( KErrGeneral, KDescription ); |
|
905 } |
|
906 |
|
907 CleanupStack::PopAndDestroy(); // scheduler |
|
908 |
|
909 // Case was executed |
|
910 return KErrNone; |
|
911 } |
|
912 |
|
913 /* |
|
914 ------------------------------------------------------------------------------- |
|
915 |
|
916 Class: CDownloadMgrClientApiTest |
|
917 |
|
918 Method: ManagerGetBoolAttributeTest |
|
919 |
|
920 Description: Test the RHttpDownloadMgr GetBoolAttribute method. |
|
921 |
|
922 Parameters: TTestResult& aErrorDescription: out: |
|
923 Test result and on error case a short description of error |
|
924 |
|
925 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
926 |
|
927 Errors/Exceptions: None |
|
928 |
|
929 Status: Approved |
|
930 |
|
931 ------------------------------------------------------------------------------- |
|
932 */ |
|
933 TInt CDownloadMgrClientApiTest::ManagerGetBoolAttributeTest( TTestResult& aResult ) |
|
934 { |
|
935 /* Simple server connect */ |
|
936 _LIT( KDefinition ,"State"); |
|
937 _LIT( KData ,"Test the RHttpDownloadMgr GetBoolAttribute method"); |
|
938 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
939 |
|
940 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
941 CleanupStack::PushL( scheduler ); |
|
942 CActiveScheduler::Install( scheduler ); |
|
943 |
|
944 TBool value; |
|
945 TInt result = iDownloadManager.GetBoolAttribute( EDlMgrConnected, value ); |
|
946 |
|
947 _LIT( KData2 ,"Finished"); |
|
948 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
949 |
|
950 if( result == KErrNone ) |
|
951 { |
|
952 _LIT( KDescription , "Test case passed" ); |
|
953 aResult.SetResult( KErrNone, KDescription ); |
|
954 } |
|
955 else |
|
956 { |
|
957 _LIT( KDescription , "Test case failed" ); |
|
958 aResult.SetResult( KErrGeneral, KDescription ); |
|
959 } |
|
960 |
|
961 CleanupStack::PopAndDestroy(); // scheduler |
|
962 |
|
963 // Case was executed |
|
964 return KErrNone; |
|
965 } |
|
966 |
|
967 /* |
|
968 ------------------------------------------------------------------------------- |
|
969 |
|
970 Class: CDownloadMgrClientApiTest |
|
971 |
|
972 Method: ManagerGetStringAttribute16Test |
|
973 |
|
974 Description: Test the RHttpDownloadMgr GetStringAttribute method with TDesC16 argument. |
|
975 |
|
976 Parameters: TTestResult& aErrorDescription: out: |
|
977 Test result and on error case a short description of error |
|
978 |
|
979 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
980 |
|
981 Errors/Exceptions: None |
|
982 |
|
983 Status: Approved |
|
984 |
|
985 ------------------------------------------------------------------------------- |
|
986 */ |
|
987 TInt CDownloadMgrClientApiTest::ManagerGetStringAttribute16Test( TTestResult& aResult ) |
|
988 { |
|
989 /* Simple server connect */ |
|
990 _LIT( KDefinition ,"State"); |
|
991 _LIT( KData ,"Test the RHttpDownloadMgr GetStringAttribute method with TDesC16 argument"); |
|
992 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
993 |
|
994 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
995 CleanupStack::PushL( scheduler ); |
|
996 CActiveScheduler::Install( scheduler ); |
|
997 |
|
998 HBufC16* stringAttr = HBufC16::NewLC( KMaxUrlLength ); |
|
999 TPtr16 stringAttrPtr = stringAttr->Des(); |
|
1000 TInt result = iDownloadManager.GetStringAttribute( EDlMgrCodFolder, stringAttrPtr ); |
|
1001 |
|
1002 _LIT( KData2 ,"Finished"); |
|
1003 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1004 |
|
1005 if( result == KErrNone ) |
|
1006 { |
|
1007 _LIT( KDescription , "Test case passed" ); |
|
1008 aResult.SetResult( KErrNone, KDescription ); |
|
1009 } |
|
1010 else |
|
1011 { |
|
1012 _LIT( KDescription , "Test case failed" ); |
|
1013 aResult.SetResult( KErrGeneral, KDescription ); |
|
1014 } |
|
1015 |
|
1016 CleanupStack::PopAndDestroy( 2 ); // scheduler, stringAttr |
|
1017 |
|
1018 // Case was executed |
|
1019 return KErrNone; |
|
1020 } |
|
1021 |
|
1022 /* |
|
1023 ------------------------------------------------------------------------------- |
|
1024 |
|
1025 Class: CDownloadMgrClientApiTest |
|
1026 |
|
1027 Method: ManagerGetStringAttribute8Test |
|
1028 |
|
1029 Description: Test the RHttpDownloadMgr GetStringAttribute method with TDesC8 argument. |
|
1030 |
|
1031 Parameters: TTestResult& aErrorDescription: out: |
|
1032 Test result and on error case a short description of error |
|
1033 |
|
1034 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1035 |
|
1036 Errors/Exceptions: None |
|
1037 |
|
1038 Status: Approved |
|
1039 |
|
1040 ------------------------------------------------------------------------------- |
|
1041 */ |
|
1042 TInt CDownloadMgrClientApiTest::ManagerGetStringAttribute8Test( TTestResult& aResult ) |
|
1043 { |
|
1044 /* Simple server connect */ |
|
1045 _LIT( KDefinition ,"State"); |
|
1046 _LIT( KData ,"Test the RHttpDownloadMgr GetStringAttribute method with TDesC8 argument"); |
|
1047 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1048 |
|
1049 _LIT( KFailReason1 ,"RHttpDownloadMgr GetStringAttribute method with TDesC8 argument results in a panic/leave every time it is called"); |
|
1050 TestModuleIf().Printf( 0, KDefinition, KFailReason1 ); |
|
1051 |
|
1052 _LIT( KFailReason2 ,"Unable to test GetStringAttribute method with TDesC8 argument"); |
|
1053 TestModuleIf().Printf( 0, KDefinition, KFailReason2 ); |
|
1054 |
|
1055 _LIT( KData2 ,"Finished"); |
|
1056 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1057 |
|
1058 _LIT( KDescription , "Test case failed" ); |
|
1059 aResult.SetResult( KErrGeneral, KDescription ); |
|
1060 |
|
1061 // Case was executed |
|
1062 return KErrNone; |
|
1063 } |
|
1064 |
|
1065 /* |
|
1066 ------------------------------------------------------------------------------- |
|
1067 |
|
1068 Class: CDownloadMgrClientApiTest |
|
1069 |
|
1070 Method: ManagerSetIntAttributeTest |
|
1071 |
|
1072 Description: Test the RHttpDownloadMgr SetIntAttribute method. |
|
1073 |
|
1074 Parameters: TTestResult& aErrorDescription: out: |
|
1075 Test result and on error case a short description of error |
|
1076 |
|
1077 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1078 |
|
1079 Errors/Exceptions: None |
|
1080 |
|
1081 Status: Approved |
|
1082 |
|
1083 ------------------------------------------------------------------------------- |
|
1084 */ |
|
1085 TInt CDownloadMgrClientApiTest::ManagerSetIntAttributeTest( TTestResult& aResult ) |
|
1086 { |
|
1087 /* Simple server connect */ |
|
1088 _LIT( KDefinition ,"State"); |
|
1089 _LIT( KData ,"Test the RHttpDownloadMgr SetIntAttribute method"); |
|
1090 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1091 |
|
1092 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
1093 CleanupStack::PushL( scheduler ); |
|
1094 CActiveScheduler::Install( scheduler ); |
|
1095 |
|
1096 TInt result = iDownloadManager.SetIntAttribute( EDlMgrExitAction, EExitNothing ); |
|
1097 |
|
1098 _LIT( KData2 ,"Finished"); |
|
1099 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1100 |
|
1101 if( result == KErrNone ) |
|
1102 { |
|
1103 _LIT( KDescription , "Test case passed" ); |
|
1104 aResult.SetResult( KErrNone, KDescription ); |
|
1105 } |
|
1106 else |
|
1107 { |
|
1108 _LIT( KDescription , "Test case failed" ); |
|
1109 aResult.SetResult( KErrGeneral, KDescription ); |
|
1110 } |
|
1111 |
|
1112 CleanupStack::PopAndDestroy(); // scheduler |
|
1113 |
|
1114 // Case was executed |
|
1115 return KErrNone; |
|
1116 } |
|
1117 |
|
1118 /* |
|
1119 ------------------------------------------------------------------------------- |
|
1120 |
|
1121 Class: CDownloadMgrClientApiTest |
|
1122 |
|
1123 Method: ManagerSetBoolAttributeTest |
|
1124 |
|
1125 Description: Test the RHttpDownloadMgr SetBoolAttribute method. |
|
1126 |
|
1127 Parameters: TTestResult& aErrorDescription: out: |
|
1128 Test result and on error case a short description of error |
|
1129 |
|
1130 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1131 |
|
1132 Errors/Exceptions: None |
|
1133 |
|
1134 Status: Approved |
|
1135 |
|
1136 ------------------------------------------------------------------------------- |
|
1137 */ |
|
1138 TInt CDownloadMgrClientApiTest::ManagerSetBoolAttributeTest( TTestResult& aResult ) |
|
1139 { |
|
1140 /* Simple server connect */ |
|
1141 _LIT( KDefinition ,"State"); |
|
1142 _LIT( KData ,"Test the RHttpDownloadMgr SetBoolAttribute method"); |
|
1143 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1144 |
|
1145 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
1146 CleanupStack::PushL( scheduler ); |
|
1147 CActiveScheduler::Install( scheduler ); |
|
1148 |
|
1149 TInt result = iDownloadManager.SetBoolAttribute( EDlMgrEnableCookies, ETrue ); |
|
1150 |
|
1151 _LIT( KData2 ,"Finished"); |
|
1152 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1153 |
|
1154 if( result == KErrNone ) |
|
1155 { |
|
1156 _LIT( KDescription , "Test case passed" ); |
|
1157 aResult.SetResult( KErrNone, KDescription ); |
|
1158 } |
|
1159 else |
|
1160 { |
|
1161 _LIT( KDescription , "Test case failed" ); |
|
1162 aResult.SetResult( KErrGeneral, KDescription ); |
|
1163 } |
|
1164 |
|
1165 CleanupStack::PopAndDestroy(); // scheduler |
|
1166 |
|
1167 // Case was executed |
|
1168 return KErrNone; |
|
1169 } |
|
1170 |
|
1171 /* |
|
1172 ------------------------------------------------------------------------------- |
|
1173 |
|
1174 Class: CDownloadMgrClientApiTest |
|
1175 |
|
1176 Method: ManagerSetStringAttribute16Test |
|
1177 |
|
1178 Description: Test the RHttpDownloadMgr SetStringAttribute method with TDesC16 argument. |
|
1179 |
|
1180 Parameters: TTestResult& aErrorDescription: out: |
|
1181 Test result and on error case a short description of error |
|
1182 |
|
1183 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1184 |
|
1185 Errors/Exceptions: None |
|
1186 |
|
1187 Status: Approved |
|
1188 |
|
1189 ------------------------------------------------------------------------------- |
|
1190 */ |
|
1191 TInt CDownloadMgrClientApiTest::ManagerSetStringAttribute16Test( TTestResult& aResult ) |
|
1192 { |
|
1193 /* Simple server connect */ |
|
1194 _LIT( KDefinition ,"State"); |
|
1195 _LIT( KData ,"Test the RHttpDownloadMgr SetStringAttribute method with TDesC16 argument"); |
|
1196 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1197 |
|
1198 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
1199 CleanupStack::PushL( scheduler ); |
|
1200 CActiveScheduler::Install( scheduler ); |
|
1201 |
|
1202 RSocketServ iSocketServ; |
|
1203 RConnection iConnection; |
|
1204 |
|
1205 iSocketServ.Connect(); |
|
1206 iConnection.Open( iSocketServ ); |
|
1207 |
|
1208 TName name; |
|
1209 |
|
1210 iConnection.Name( name ); |
|
1211 |
|
1212 TInt result = iDownloadManager.SetStringAttribute( EDlMgrConnectionName, name ); |
|
1213 |
|
1214 _LIT( KData2 ,"Finished"); |
|
1215 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1216 |
|
1217 if( result == KErrPermissionDenied ) |
|
1218 { |
|
1219 _LIT( KDescription , "Test case passed" ); |
|
1220 aResult.SetResult( KErrNone, KDescription ); |
|
1221 } |
|
1222 else |
|
1223 { |
|
1224 _LIT( KDescription , "Test case failed" ); |
|
1225 aResult.SetResult( KErrGeneral, KDescription ); |
|
1226 } |
|
1227 |
|
1228 iConnection.Close(); |
|
1229 iSocketServ.Close(); |
|
1230 |
|
1231 CleanupStack::PopAndDestroy(); // scheduler |
|
1232 |
|
1233 // Case was executed |
|
1234 return KErrNone; |
|
1235 } |
|
1236 |
|
1237 /* |
|
1238 ------------------------------------------------------------------------------- |
|
1239 |
|
1240 Class: CDownloadMgrClientApiTest |
|
1241 |
|
1242 Method: ManagerSetStringAttribute8Test |
|
1243 |
|
1244 Description: Test the RHttpDownloadMgr SetStringAttribute method with TDesC8 argument. |
|
1245 |
|
1246 Parameters: TTestResult& aErrorDescription: out: |
|
1247 Test result and on error case a short description of error |
|
1248 |
|
1249 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1250 |
|
1251 Errors/Exceptions: None |
|
1252 |
|
1253 Status: Approved |
|
1254 |
|
1255 ------------------------------------------------------------------------------- |
|
1256 */ |
|
1257 TInt CDownloadMgrClientApiTest::ManagerSetStringAttribute8Test( TTestResult& aResult ) |
|
1258 { |
|
1259 /* Simple server connect */ |
|
1260 _LIT( KDefinition ,"State"); |
|
1261 _LIT( KData ,"Test the RHttpDownloadMgr SetStringAttribute method with TDesC8 argument"); |
|
1262 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1263 |
|
1264 _LIT( KFailReason1 ,"RHttpDownloadMgr SetStringAttribute method with TDesC8 argument results in a panic/leave every time it is called"); |
|
1265 TestModuleIf().Printf( 0, KDefinition, KFailReason1 ); |
|
1266 |
|
1267 _LIT( KFailReason2 ,"Unable to test SetStringAttribute method with TDesC8 argument"); |
|
1268 TestModuleIf().Printf( 0, KDefinition, KFailReason2 ); |
|
1269 |
|
1270 _LIT( KData2 ,"Finished"); |
|
1271 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1272 |
|
1273 _LIT( KDescription , "Test case failed" ); |
|
1274 aResult.SetResult( KErrGeneral, KDescription ); |
|
1275 |
|
1276 // Case was executed |
|
1277 return KErrNone; |
|
1278 } |
|
1279 |
|
1280 /* |
|
1281 ------------------------------------------------------------------------------- |
|
1282 |
|
1283 Class: CDownloadMgrClientApiTest |
|
1284 |
|
1285 Method: ManagerSetDefaultIntAttributeTest |
|
1286 |
|
1287 Description: Test the RHttpDownloadMgr SetDefaultIntAttribute method. |
|
1288 |
|
1289 Parameters: TTestResult& aErrorDescription: out: |
|
1290 Test result and on error case a short description of error |
|
1291 |
|
1292 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1293 |
|
1294 Errors/Exceptions: None |
|
1295 |
|
1296 Status: Approved |
|
1297 |
|
1298 ------------------------------------------------------------------------------- |
|
1299 */ |
|
1300 TInt CDownloadMgrClientApiTest::ManagerSetDefaultIntAttributeTest( TTestResult& aResult ) |
|
1301 { |
|
1302 /* Simple server connect */ |
|
1303 _LIT( KDefinition ,"State"); |
|
1304 _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultIntAttribute method"); |
|
1305 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1306 |
|
1307 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
1308 CleanupStack::PushL( scheduler ); |
|
1309 CActiveScheduler::Install( scheduler ); |
|
1310 |
|
1311 TInt result = iDownloadManager.SetDefaultIntAttribute( EDlAttrAction, ELaunch ); |
|
1312 |
|
1313 _LIT( KData2 ,"Finished"); |
|
1314 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1315 |
|
1316 if( result == KErrNone ) |
|
1317 { |
|
1318 _LIT( KDescription , "Test case passed" ); |
|
1319 aResult.SetResult( KErrNone, KDescription ); |
|
1320 } |
|
1321 else |
|
1322 { |
|
1323 _LIT( KDescription , "Test case failed" ); |
|
1324 aResult.SetResult( KErrGeneral, KDescription ); |
|
1325 } |
|
1326 |
|
1327 CleanupStack::PopAndDestroy(); // scheduler |
|
1328 |
|
1329 // Case was executed |
|
1330 return KErrNone; |
|
1331 } |
|
1332 |
|
1333 /* |
|
1334 ------------------------------------------------------------------------------- |
|
1335 |
|
1336 Class: CDownloadMgrClientApiTest |
|
1337 |
|
1338 Method: ManagerSetDefaultBoolAttributeTest |
|
1339 |
|
1340 Description: Test the RHttpDownloadMgr SetDefaultBoolAttribute method. |
|
1341 |
|
1342 Parameters: TTestResult& aErrorDescription: out: |
|
1343 Test result and on error case a short description of error |
|
1344 |
|
1345 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1346 |
|
1347 Errors/Exceptions: None |
|
1348 |
|
1349 Status: Approved |
|
1350 |
|
1351 ------------------------------------------------------------------------------- |
|
1352 */ |
|
1353 TInt CDownloadMgrClientApiTest::ManagerSetDefaultBoolAttributeTest( TTestResult& aResult ) |
|
1354 { |
|
1355 /* Simple server connect */ |
|
1356 _LIT( KDefinition ,"State"); |
|
1357 _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultBoolAttribute method"); |
|
1358 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1359 |
|
1360 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
1361 CleanupStack::PushL( scheduler ); |
|
1362 CActiveScheduler::Install( scheduler ); |
|
1363 |
|
1364 TInt result = iDownloadManager.SetDefaultBoolAttribute( EDlAttrDisconnectOnReset, ETrue ); |
|
1365 |
|
1366 _LIT( KData2 ,"Finished"); |
|
1367 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1368 |
|
1369 if( result == KErrNone ) |
|
1370 { |
|
1371 _LIT( KDescription , "Test case passed" ); |
|
1372 aResult.SetResult( KErrNone, KDescription ); |
|
1373 } |
|
1374 else |
|
1375 { |
|
1376 _LIT( KDescription , "Test case failed" ); |
|
1377 aResult.SetResult( KErrGeneral, KDescription ); |
|
1378 } |
|
1379 |
|
1380 CleanupStack::PopAndDestroy(); // scheduler |
|
1381 |
|
1382 // Case was executed |
|
1383 return KErrNone; |
|
1384 } |
|
1385 |
|
1386 /* |
|
1387 ------------------------------------------------------------------------------- |
|
1388 |
|
1389 Class: CDownloadMgrClientApiTest |
|
1390 |
|
1391 Method: ManagerSetDefaultStringAttribute16Test |
|
1392 |
|
1393 Description: Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC16 argument. |
|
1394 |
|
1395 Parameters: TTestResult& aErrorDescription: out: |
|
1396 Test result and on error case a short description of error |
|
1397 |
|
1398 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1399 |
|
1400 Errors/Exceptions: None |
|
1401 |
|
1402 Status: Approved |
|
1403 |
|
1404 ------------------------------------------------------------------------------- |
|
1405 */ |
|
1406 TInt CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute16Test( TTestResult& aResult ) |
|
1407 { |
|
1408 /* Simple server connect */ |
|
1409 _LIT( KDefinition ,"State"); |
|
1410 _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC16 argument"); |
|
1411 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1412 |
|
1413 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
1414 CleanupStack::PushL( scheduler ); |
|
1415 CActiveScheduler::Install( scheduler ); |
|
1416 |
|
1417 _LIT( KDestFilename, "c:\\logs\\DownloadMgr\\" ); |
|
1418 TInt result = iDownloadManager.SetDefaultStringAttribute( EDlAttrDestFilename, KDestFilename() ); |
|
1419 |
|
1420 _LIT( KData2 ,"Finished"); |
|
1421 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1422 |
|
1423 if( result == KErrNone ) |
|
1424 { |
|
1425 _LIT( KDescription , "Test case passed" ); |
|
1426 aResult.SetResult( KErrNone, KDescription ); |
|
1427 } |
|
1428 else |
|
1429 { |
|
1430 _LIT( KDescription , "Test case failed" ); |
|
1431 aResult.SetResult( KErrGeneral, KDescription ); |
|
1432 } |
|
1433 |
|
1434 CleanupStack::PopAndDestroy(); // scheduler |
|
1435 |
|
1436 // Case was executed |
|
1437 return KErrNone; |
|
1438 } |
|
1439 |
|
1440 /* |
|
1441 ------------------------------------------------------------------------------- |
|
1442 |
|
1443 Class: CDownloadMgrClientApiTest |
|
1444 |
|
1445 Method: ManagerSetDefaultStringAttribute8Test |
|
1446 |
|
1447 Description: Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC8 argument. |
|
1448 |
|
1449 Parameters: TTestResult& aErrorDescription: out: |
|
1450 Test result and on error case a short description of error |
|
1451 |
|
1452 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1453 |
|
1454 Errors/Exceptions: None |
|
1455 |
|
1456 Status: Approved |
|
1457 |
|
1458 ------------------------------------------------------------------------------- |
|
1459 */ |
|
1460 TInt CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute8Test( TTestResult& aResult ) |
|
1461 { |
|
1462 /* Simple server connect */ |
|
1463 _LIT( KDefinition ,"State"); |
|
1464 _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC8 argument"); |
|
1465 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1466 |
|
1467 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
1468 CleanupStack::PushL( scheduler ); |
|
1469 CActiveScheduler::Install( scheduler ); |
|
1470 |
|
1471 _LIT8( KUserName, "username"); |
|
1472 TInt result = iDownloadManager.SetDefaultStringAttribute( EDlAttrUsername, KUserName() ); |
|
1473 |
|
1474 _LIT( KData2 ,"Finished"); |
|
1475 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1476 |
|
1477 if( result == KErrNone ) |
|
1478 { |
|
1479 _LIT( KDescription , "Test case passed" ); |
|
1480 aResult.SetResult( KErrNone, KDescription ); |
|
1481 } |
|
1482 else |
|
1483 { |
|
1484 _LIT( KDescription , "Test case failed" ); |
|
1485 aResult.SetResult( KErrGeneral, KDescription ); |
|
1486 } |
|
1487 |
|
1488 CleanupStack::PopAndDestroy(); // scheduler |
|
1489 |
|
1490 // Case was executed |
|
1491 return KErrNone; |
|
1492 } |
|
1493 |
|
1494 /* |
|
1495 ------------------------------------------------------------------------------- |
|
1496 |
|
1497 Class: CDownloadMgrClientApiTest |
|
1498 |
|
1499 Method: ManagerAddObserverLTest |
|
1500 |
|
1501 Description: Test the RHttpDownloadMgr AddObserverL method. |
|
1502 |
|
1503 Parameters: TTestResult& aErrorDescription: out: |
|
1504 Test result and on error case a short description of error |
|
1505 |
|
1506 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1507 |
|
1508 Errors/Exceptions: None |
|
1509 |
|
1510 Status: Approved |
|
1511 |
|
1512 ------------------------------------------------------------------------------- |
|
1513 */ |
|
1514 TInt CDownloadMgrClientApiTest::ManagerAddObserverLTest( TTestResult& aResult ) |
|
1515 { |
|
1516 /* Simple server connect */ |
|
1517 _LIT( KDefinition ,"State"); |
|
1518 _LIT( KData ,"Test the RHttpDownloadMgr AddObserverL method"); |
|
1519 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1520 |
|
1521 iDownloadManager.AddObserverL( *this ); |
|
1522 |
|
1523 _LIT( KData2 ,"Finished"); |
|
1524 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1525 |
|
1526 // RHttpDownloadMgr::AddObserverL provides no results, so if we've gotten this far assume success |
|
1527 _LIT( KDescription , "Test case passed" ); |
|
1528 aResult.SetResult( KErrNone, KDescription ); |
|
1529 |
|
1530 iDownloadManager.RemoveObserver( *this ); |
|
1531 |
|
1532 // Case was executed |
|
1533 return KErrNone; |
|
1534 } |
|
1535 |
|
1536 /* |
|
1537 ------------------------------------------------------------------------------- |
|
1538 |
|
1539 Class: CDownloadMgrClientApiTest |
|
1540 |
|
1541 Method: ManagerRemoveObserverTest |
|
1542 |
|
1543 Description: Test the RHttpDownloadMgr RemoveObserver method. |
|
1544 |
|
1545 Parameters: TTestResult& aErrorDescription: out: |
|
1546 Test result and on error case a short description of error |
|
1547 |
|
1548 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1549 |
|
1550 Errors/Exceptions: None |
|
1551 |
|
1552 Status: Approved |
|
1553 |
|
1554 ------------------------------------------------------------------------------- |
|
1555 */ |
|
1556 TInt CDownloadMgrClientApiTest::ManagerRemoveObserverTest( TTestResult& aResult ) |
|
1557 { |
|
1558 /* Simple server connect */ |
|
1559 _LIT( KDefinition ,"State"); |
|
1560 _LIT( KData ,"Test the RHttpDownloadMgr RemoveObserver method"); |
|
1561 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1562 |
|
1563 iDownloadManager.AddObserverL( *this ); |
|
1564 |
|
1565 iDownloadManager.RemoveObserver( *this ); |
|
1566 |
|
1567 _LIT( KData2 ,"Finished"); |
|
1568 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1569 |
|
1570 // RHttpDownloadMgr::RemoveObserver provides no results, so if we've gotten this far assume success |
|
1571 _LIT( KDescription , "Test case passed" ); |
|
1572 aResult.SetResult( KErrNone, KDescription ); |
|
1573 |
|
1574 // Case was executed |
|
1575 return KErrNone; |
|
1576 } |
|
1577 |
|
1578 /* |
|
1579 ------------------------------------------------------------------------------- |
|
1580 |
|
1581 Class: CDownloadMgrClientApiTest |
|
1582 |
|
1583 Method: ManagerSetNextUriObserverTest |
|
1584 |
|
1585 Description: Test the RHttpDownloadMgr SetNextUriObserver method. |
|
1586 |
|
1587 Parameters: TTestResult& aErrorDescription: out: |
|
1588 Test result and on error case a short description of error |
|
1589 |
|
1590 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
1591 |
|
1592 Errors/Exceptions: None |
|
1593 |
|
1594 Status: Approved |
|
1595 |
|
1596 ------------------------------------------------------------------------------- |
|
1597 */ |
|
1598 TInt CDownloadMgrClientApiTest::ManagerSetNextUriObserverTest( TTestResult& aResult ) |
|
1599 { |
|
1600 /* Simple server connect */ |
|
1601 _LIT( KDefinition ,"State"); |
|
1602 _LIT( KData ,"Test the RHttpDownloadMgr SetNextUriObserver method"); |
|
1603 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
1604 |
|
1605 iDownloadManager.SetNextUriObserver( this ); |
|
1606 |
|
1607 _LIT( KData2 ,"Finished"); |
|
1608 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
1609 |
|
1610 // RHttpDownloadMgr::SetNextUriObserver provides no results, so if we've gotten this far assume success |
|
1611 _LIT( KDescription , "Test case passed" ); |
|
1612 aResult.SetResult( KErrNone, KDescription ); |
|
1613 |
|
1614 // Case was executed |
|
1615 return KErrNone; |
|
1616 } |
|
1617 |
|
1618 // ================= OTHER EXPORTED FUNCTIONS ================================= |
|
1619 |
|
1620 // End of File |