1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 |
|
17 |
|
18 /** |
16 /** |
19 @file |
17 @file |
20 @test |
18 @test |
21 @internalComponent - Internal Symbian test code |
19 @internalComponent - Internal Symbian test code |
22 */ |
20 */ |
23 |
21 |
24 #include "t_mimecontentpolicystep.h" |
22 #include "t_mimecontentpolicystep.h" |
|
23 #include <centralrepository.h> |
|
24 #include <apmstd.h> |
|
25 |
|
26 //Closed content and extension information repository UID |
|
27 const TUid KClosedContentAndExtensionInfoRepositoryUID={0x10003A3F}; |
25 |
28 |
26 _LIT(KPathjpg1, "z:\\system\\data\\type-r.jpg"); |
29 _LIT(KPathjpg1, "z:\\system\\data\\type-r.jpg"); |
27 _LIT(KPathjpg2, "z:\\system\\data\\propelli.jpg"); |
30 _LIT(KPathjpg2, "z:\\system\\data\\propelli.jpg"); |
28 _LIT(KPathdcf, "z:\\system\\data\\sd_goo.dcf"); |
31 _LIT(KPathdcf, "z:\\system\\data\\sd_goo.dcf"); |
29 _LIT(KPathdm1, "z:\\system\\data\\fl_goo.dm"); |
32 _LIT(KPathdm1, "z:\\system\\data\\fl_goo.dm"); |
76 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsDRMEnvelopeFileNameL(), NO_CLEANUP); |
79 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsDRMEnvelopeFileNameL(), NO_CLEANUP); |
77 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsClosedFileFileNameL(), iApaLsSession.FlushRecognitionCache()); |
80 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsClosedFileFileNameL(), iApaLsSession.FlushRecognitionCache()); |
78 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsDRMEnvelopeFileHandleL(), NO_CLEANUP); |
81 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsDRMEnvelopeFileHandleL(), NO_CLEANUP); |
79 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsClosedFileFileHandleL(), iApaLsSession.FlushRecognitionCache()); |
82 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsClosedFileFileHandleL(), iApaLsSession.FlushRecognitionCache()); |
80 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPOOMTestL(), iApaLsSession.FlushRecognitionCache()); |
83 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPOOMTestL(), iApaLsSession.FlushRecognitionCache()); |
|
84 HEAP_TEST_LS_SESSION(iApaLsSession, 0, 0, CCPTestIsClosedContentAndExtenstionInfoRepositoryReadOnlyL(), NO_CLEANUP); |
81 } |
85 } |
82 |
86 |
83 /** |
87 /** |
84 @SYMTestCaseID APPFWK-APPARC-0077 |
88 @SYMTestCaseID APPFWK-APPARC-0077 |
85 |
89 |
89 |
93 |
90 @SYMTestPriority High |
94 @SYMTestPriority High |
91 |
95 |
92 @SYMTestStatus Implemented |
96 @SYMTestStatus Implemented |
93 |
97 |
94 @SYMTestActions Closed types are the mime types which are listed in the ApfMimeContentPolicy.rss file. |
98 @SYMTestActions Closed types are the mime types which are listed in the 10003a3f repository file. |
95 Calls CApfMimeContentPolicy::IsClosedType(const TDesC& aMimeType); for different closed and non-closed mime types. |
99 Calls CApfMimeContentPolicy::IsClosedType(const TDesC& aMimeType); for different closed and non-closed mime types. |
|
100 And also it tests whether invalid mime types are not added to the list. |
96 |
101 |
97 @SYMTestExpectedResults The test checks whether IsClosedType returns ETrue for the Closed Mime types and EFalse for non-closed Mime types |
102 @SYMTestExpectedResults The test checks whether IsClosedType returns ETrue for the Closed Mime types and EFalse for non-closed Mime types |
98 */ |
103 */ |
99 void CT_MimeContentPolicyStep::CCPTestIsClosedType() |
104 void CT_MimeContentPolicyStep::CCPTestIsClosedType() |
100 { |
105 { |
120 _LIT(KMimeType18, "application/javascript"); |
125 _LIT(KMimeType18, "application/javascript"); |
121 _LIT(KMimeType19, "video/3gpp"); |
126 _LIT(KMimeType19, "video/3gpp"); |
122 _LIT(KMimeType20, "video/mpeg"); |
127 _LIT(KMimeType20, "video/mpeg"); |
123 _LIT(KMimeType21, "video/quicktime"); |
128 _LIT(KMimeType21, "video/quicktime"); |
124 _LIT(KMimeType22, "video/mpeg4-generic"); |
129 _LIT(KMimeType22, "video/mpeg4-generic"); |
125 |
130 |
|
131 //Invalid mime types |
|
132 _LIT(KMimeType23, "/test"); |
|
133 _LIT(KMimeType24, "test"); |
|
134 _LIT(KMimeType25, "test/"); |
|
135 _LIT(KMimeType26, "/test/"); |
|
136 _LIT(KMimeType27, "test/testmime/"); |
|
137 _LIT(KMimeType28, "/test/testmime"); |
|
138 _LIT(KMimeType29, "test\\testmime"); |
|
139 |
|
140 |
126 |
141 |
127 INFO_PRINTF1(_L("Tests the MIME types found on closed content list")); |
142 INFO_PRINTF1(_L("Tests the MIME types found on closed content list")); |
128 |
143 |
129 TEST(iCcp->IsClosedType(KMimeType0)); |
144 TEST(iCcp->IsClosedType(KMimeType0)); |
130 INFO_PRINTF2(_L("%S is Closed Type"), &KMimeType0); |
145 INFO_PRINTF2(_L("%S is Closed Type"), &KMimeType0); |
192 TEST(!iCcp->IsClosedType(KMimeType21)); |
207 TEST(!iCcp->IsClosedType(KMimeType21)); |
193 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType21); |
208 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType21); |
194 |
209 |
195 TEST(!iCcp->IsClosedType(KMimeType22)); |
210 TEST(!iCcp->IsClosedType(KMimeType22)); |
196 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType22); |
211 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType22); |
|
212 |
|
213 TEST(!iCcp->IsClosedType(KMimeType23)); |
|
214 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType23); |
|
215 |
|
216 TEST(!iCcp->IsClosedType(KMimeType24)); |
|
217 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType24); |
|
218 |
|
219 TEST(!iCcp->IsClosedType(KMimeType25)); |
|
220 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType25); |
|
221 |
|
222 TEST(!iCcp->IsClosedType(KMimeType26)); |
|
223 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType26); |
|
224 |
|
225 TEST(!iCcp->IsClosedType(KMimeType27)); |
|
226 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType27); |
|
227 |
|
228 TEST(!iCcp->IsClosedType(KMimeType28)); |
|
229 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType28); |
|
230 |
|
231 TEST(!iCcp->IsClosedType(KMimeType29)); |
|
232 INFO_PRINTF2(_L("%S is not Closed Type"), &KMimeType29); |
197 } |
233 } |
198 |
234 |
199 /** |
235 /** |
200 @SYMTestCaseID APPFWK-APPARC-0078 |
236 @SYMTestCaseID APPFWK-APPARC-0078 |
201 |
237 |
205 |
241 |
206 @SYMTestPriority High |
242 @SYMTestPriority High |
207 |
243 |
208 @SYMTestStatus Implemented |
244 @SYMTestStatus Implemented |
209 |
245 |
210 @SYMTestActions Closed file extensions are the file extensions which are listed in the ApfMimeContentPolicy.rss file. |
246 @SYMTestActions Closed file extensions are the file extensions which are listed in the 10003a3f repository. |
211 Calls CApfMimeContentPolicy::IsClosedExtension(const TDesC& aFileExtension); for different closed and non-closed File Extensions. |
247 Calls CApfMimeContentPolicy::IsClosedExtension(const TDesC& aFileExtension); for different closed and non-closed File Extensions. |
|
248 And also it tests whether invalid closed extensions are not added to the list. |
212 |
249 |
213 @SYMTestExpectedResults The test checks whether IsClosedExtension returns ETrue for the Closed File Extensions and EFalse for non-closed File Extensions. |
250 @SYMTestExpectedResults The test checks whether IsClosedExtension returns ETrue for the Closed File Extensions and EFalse for non-closed File Extensions. |
214 */ |
251 */ |
215 void CT_MimeContentPolicyStep::CCPTestIsClosedExtension() |
252 void CT_MimeContentPolicyStep::CCPTestIsClosedExtension() |
216 { |
253 { |
229 _LIT(KExtension12, "jar.mp3"); |
266 _LIT(KExtension12, "jar.mp3"); |
230 _LIT(KExtension13, ".siss"); |
267 _LIT(KExtension13, ".siss"); |
231 _LIT(KExtension14, ".sis7"); |
268 _LIT(KExtension14, ".sis7"); |
232 _LIT(KExtension15, ".0sis"); |
269 _LIT(KExtension15, ".0sis"); |
233 _LIT(KExtension16, ".gif"); |
270 _LIT(KExtension16, ".gif"); |
|
271 |
|
272 //Invalid extension |
|
273 _LIT(KExtension17, "tst"); |
234 |
274 |
235 INFO_PRINTF1(_L("Tests the extensions found on closed content list")); |
275 INFO_PRINTF1(_L("Tests the extensions found on closed content list")); |
236 |
276 |
237 TEST(iCcp->IsClosedExtension(KExtension0)); |
277 TEST(iCcp->IsClosedExtension(KExtension0)); |
238 INFO_PRINTF2(_L("%S is Closed Extension"), &KExtension0); |
278 INFO_PRINTF2(_L("%S is Closed Extension"), &KExtension0); |
282 TEST(!iCcp->IsClosedExtension(KExtension15)); |
322 TEST(!iCcp->IsClosedExtension(KExtension15)); |
283 INFO_PRINTF2(_L("%S is not Closed Extension"), &KExtension15); |
323 INFO_PRINTF2(_L("%S is not Closed Extension"), &KExtension15); |
284 |
324 |
285 TEST(!iCcp->IsClosedExtension(KExtension16)); |
325 TEST(!iCcp->IsClosedExtension(KExtension16)); |
286 INFO_PRINTF2(_L("%S is not Closed Extension"), &KExtension16); |
326 INFO_PRINTF2(_L("%S is not Closed Extension"), &KExtension16); |
|
327 |
|
328 TEST(!iCcp->IsClosedExtension(KExtension17)); |
|
329 INFO_PRINTF2(_L("%S is not Closed Extension"), &KExtension17); |
287 } |
330 } |
288 |
331 |
289 /** |
332 /** |
290 @SYMTestCaseID APPFWK-APPARC-0079 |
333 @SYMTestCaseID APPFWK-APPARC-0079 |
291 |
334 |
322 |
365 |
323 @SYMTestPriority High |
366 @SYMTestPriority High |
324 |
367 |
325 @SYMTestStatus Implemented |
368 @SYMTestStatus Implemented |
326 |
369 |
327 @SYMTestActions Closed files are files whose file extensions are listed in the ApfMimeContentPolicy.rss file. |
370 @SYMTestActions Closed files are files whose file extensions are listed in the 10003a3f repository. |
328 Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); for different Closed and non-closed files. |
371 Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); for different Closed and non-closed files. |
329 Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); with file which is already open and checks whether \n |
372 Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); with file which is already open and checks whether \n |
330 call succeeds. |
373 call succeeds. |
331 Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); with Null file handle\n |
374 Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); with Null file handle\n |
332 |
375 |
427 |
470 |
428 @SYMTestPriority High |
471 @SYMTestPriority High |
429 |
472 |
430 @SYMTestStatus Implemented |
473 @SYMTestStatus Implemented |
431 |
474 |
432 @SYMTestActions Closed files are files whose file extensions are listed in the ApfMimeContentPolicy.rss file. |
475 @SYMTestActions Closed files are files whose file extensions are listed in the 10003a3f repository. |
433 Calls CApfMimeContentPolicy::IsClosedFileL(RFile& aFileHandle); for different Closed and non-closed files. |
476 Calls CApfMimeContentPolicy::IsClosedFileL(RFile& aFileHandle); for different Closed and non-closed files. |
434 |
477 |
435 @SYMTestExpectedResults The test checks whether IsClosedFileL() returns EFalse for Files which are not closed and\n |
478 @SYMTestExpectedResults The test checks whether IsClosedFileL() returns EFalse for Files which are not closed and\n |
436 ETrue for files which are closed. |
479 ETrue for files which are closed. |
437 */ |
480 */ |
508 } |
551 } |
509 |
552 |
510 __UHEAP_RESET; |
553 __UHEAP_RESET; |
511 INFO_PRINTF1(_L("OOM test Completed")); |
554 INFO_PRINTF1(_L("OOM test Completed")); |
512 } |
555 } |
|
556 |
|
557 |
|
558 /** |
|
559 @SYMTestCaseID APPFWK-APPARC-0108 |
|
560 |
|
561 @SYMREQ REQ410-2692 |
|
562 |
|
563 @SYMTestCaseDesc Tests Closed content and extension information repository is not writable. |
|
564 |
|
565 @SYMTestPriority High |
|
566 |
|
567 @SYMTestStatus Implemented |
|
568 |
|
569 @SYMTestActions Calls create, get, set, reset, delete functions on the repository. Checks only read operations are allowed. |
|
570 |
|
571 @SYMTestExpectedResults Tests should complete without any failure. |
|
572 */ |
|
573 |
|
574 void CT_MimeContentPolicyStep::CCPTestIsClosedContentAndExtenstionInfoRepositoryReadOnlyL() |
|
575 { |
|
576 INFO_PRINTF1(_L("Testcase CCPTestIsClosedContentAndExtenstionInfoRepositoryReadOnly....")); |
|
577 CRepository *cenrep=CRepository::NewL(KClosedContentAndExtensionInfoRepositoryUID); |
|
578 CleanupStack::PushL(cenrep); |
|
579 TInt newKeyValue=0x00010000; |
|
580 //This key already exists in the default Closed content and extension information repository |
|
581 TInt existingKey=0x1; |
|
582 TBuf<KMaxDataTypeLength> keyData; |
|
583 TInt err=KErrNone; |
|
584 |
|
585 INFO_PRINTF1(_L("Testing creation of key in the repository")); |
|
586 err=cenrep->Create(newKeyValue, 0); |
|
587 TEST(err==KErrPermissionDenied); |
|
588 INFO_PRINTF2(_L("Error code while creating a key: %d"), err); |
|
589 |
|
590 INFO_PRINTF1(_L("Testing setting value of an existing key in the repository")); |
|
591 err=cenrep->Set(existingKey, 0); |
|
592 TEST(err==KErrPermissionDenied); |
|
593 INFO_PRINTF2(_L("Error code while setting a value of an existing key: %d"), err); |
|
594 |
|
595 INFO_PRINTF1(_L("Testing getting value of an existing key in the repository")); |
|
596 err=cenrep->Get(existingKey, keyData); |
|
597 TEST(err==KErrNone); |
|
598 INFO_PRINTF2(_L("Error code while getting a value of an existing key: %d"), err); |
|
599 |
|
600 INFO_PRINTF1(_L("Testing resetting value of an existing key in the repository")); |
|
601 err=cenrep->Reset(existingKey); |
|
602 TEST(err==KErrPermissionDenied); |
|
603 INFO_PRINTF2(_L("Error code while reseting a value of existing key: %d"), err); |
|
604 |
|
605 INFO_PRINTF1(_L("Testing deleting an existing key in the repository")); |
|
606 err=cenrep->Delete(existingKey); |
|
607 TEST(err==KErrPermissionDenied); |
|
608 INFO_PRINTF2(_L("Error code while deleting an existing key: %d"), err); |
|
609 CleanupStack::PopAndDestroy(cenrep); |
|
610 INFO_PRINTF1(_L("Testcase CCPTestIsClosedContentAndExtenstionInfoRepositoryReadOnly completed....")); |
|
611 } |