First public contribution.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\server\t_findcapnone.cpp
15 // PlatSec compatibility test. Application capability is NONE
16 // TFindFile should return KErrPermissionDenied for FindByDir requests
17 // in /sys and /private/anyOther folders, if path is avialable.
18 // z:\sys\bin\t_findcaptestfile.txt is used for testing.
19 // If the file is not avialable in the location, test will not panic.
20 // This is because, TFindFile returns KErrPermissionDenied,
21 // whether the file is available or not, in such folders.
28 _LIT(KTestString,"t_findcapnone");
30 LOCAL_C RTest test(KTestString);
32 LOCAL_C RFs FileServer;
34 LOCAL_C TInt TestFind(const TPtrC16 aTestDesc, const TPtrC16 aFPath, const TPtrC16 aFName)
38 TFindFile FindFile(FileServer);
39 Err=FindFile.FindByDir(aFName,aFPath);
44 GLDEF_C TInt E32Main()
50 Err=FileServer.Connect();
54 // RTest.Next is called from function "TestFind()".
55 // RTest.Start is called here to start the test.
56 test.Start(_L("Test Starts : Dummy Test"));
58 // Test: Find non existing file in existing /sys folder
62 // File Name : nonexistingfile.txt
64 // Expected return value: KErrPermissionDenied
65 Err=TestFind(_L("Drive specified & available Path exists File does not exist"),
67 _L("nonexistingfile.txt"));
69 test(Err==KErrPermissionDenied);
71 // Test: Find existing file in existing /sys folder
75 // File Name : t_findcaptestfile.txt
77 // Expected return value: KErrPermissionDenied
78 Err=TestFind(_L("Drive specified & available Path exists File exists"),
80 _L("t_findcaptestfile.txt"));
82 test(Err==KErrPermissionDenied);
84 // Test: Find non existing file in existing / non existing /sys folder
88 // File Name : nonexisting.txt
90 // Expected return value: KErrPermissionDenied
91 Err=TestFind(_L("Drive specified & available Path may exist File does not exist"),
93 _L("nonexisting.txt"));
95 test(Err==KErrPermissionDenied);
97 // Test: Find existing file in /sys folder without specifying the path
99 // Drive Name : Not specified.
101 // File Name : t_findcaptestfile.txt
103 // Expected return value: KErrPermissionDenied
104 Err=TestFind(_L("Drive not specified Path exists File exists"),
106 _L("t_findcaptestfile.txt"));
108 test(Err==KErrPermissionDenied);
110 // Test: Find non existing file in /sys folder without specifying the path
112 // Drive Name : Not specified
114 // File Name : nonexistingfile.txt
116 // Expected return value: KErrPermissionDenied
117 Err=TestFind(_L("Drive not specified Path exists File does not exist"),
119 _L("nonexisting.txt"));
121 test(Err==KErrPermissionDenied);
125 test.Printf(_L("Test completed\n"));