author | Mike Kinghan <mikek@symbian.org> |
Mon, 19 Jul 2010 08:40:05 +0100 | |
branch | GCC_SURGE |
changeset 209 | 6035754ebf88 |
parent 109 | b3a1d9898418 |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
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. |
|
22 |
// |
|
23 |
// |
|
24 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#define __E32TEST_EXTENSION__ |
0 | 26 |
#include <e32test.h> |
27 |
#include <f32file.h> |
|
28 |
||
29 |
_LIT(KTestString,"t_findcapnone"); |
|
30 |
||
31 |
LOCAL_C RTest test(KTestString); |
|
32 |
||
33 |
LOCAL_C RFs FileServer; |
|
34 |
||
35 |
LOCAL_C TInt TestFind(const TPtrC16 aTestDesc, const TPtrC16 aFPath, const TPtrC16 aFName) |
|
36 |
{ |
|
37 |
TInt Err; |
|
38 |
test.Next(aTestDesc); |
|
39 |
TFindFile FindFile(FileServer); |
|
40 |
Err=FindFile.FindByDir(aFName,aFPath); |
|
41 |
return Err; |
|
42 |
} |
|
43 |
||
44 |
||
45 |
GLDEF_C TInt E32Main() |
|
46 |
{ |
|
47 |
TInt Err; |
|
48 |
||
49 |
test.Title(); |
|
50 |
||
51 |
Err=FileServer.Connect(); |
|
52 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
53 |
test_KErrNone(Err); |
0 | 54 |
|
55 |
// RTest.Next is called from function "TestFind()". |
|
56 |
// RTest.Start is called here to start the test. |
|
57 |
test.Start(_L("Test Starts : Dummy Test")); |
|
58 |
||
59 |
// Test: Find non existing file in existing /sys folder |
|
60 |
// |
|
61 |
// Drive Name : Z: |
|
62 |
// Path : sys\bin |
|
63 |
// File Name : nonexistingfile.txt |
|
64 |
// |
|
65 |
// Expected return value: KErrPermissionDenied |
|
66 |
Err=TestFind(_L("Drive specified & available Path exists File does not exist"), |
|
67 |
_L("z:\\sys\\bin\\"), |
|
68 |
_L("nonexistingfile.txt")); |
|
69 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
70 |
test_Value(Err, Err == KErrPermissionDenied); |
0 | 71 |
|
72 |
// Test: Find existing file in existing /sys folder |
|
73 |
// |
|
74 |
// Drive Name : Z: |
|
75 |
// Path : sys\bin |
|
76 |
// File Name : t_findcaptestfile.txt |
|
77 |
// |
|
78 |
// Expected return value: KErrPermissionDenied |
|
79 |
Err=TestFind(_L("Drive specified & available Path exists File exists"), |
|
80 |
_L("z:\\sys\\bin\\"), |
|
81 |
_L("t_findcaptestfile.txt")); |
|
82 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
test_Value(Err, Err == KErrPermissionDenied); |
0 | 84 |
|
85 |
// Test: Find non existing file in existing / non existing /sys folder |
|
86 |
// |
|
87 |
// Drive Name : C: |
|
88 |
// Path : sys |
|
89 |
// File Name : nonexisting.txt |
|
90 |
// |
|
91 |
// Expected return value: KErrPermissionDenied |
|
92 |
Err=TestFind(_L("Drive specified & available Path may exist File does not exist"), |
|
93 |
_L("c:\\sys\\"), |
|
94 |
_L("nonexisting.txt")); |
|
95 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
test_Value(Err, Err == KErrPermissionDenied); |
0 | 97 |
|
98 |
// Test: Find existing file in /sys folder without specifying the path |
|
99 |
// |
|
100 |
// Drive Name : Not specified. |
|
101 |
// Path : sys\bin |
|
102 |
// File Name : t_findcaptestfile.txt |
|
103 |
// |
|
104 |
// Expected return value: KErrPermissionDenied |
|
105 |
Err=TestFind(_L("Drive not specified Path exists File exists"), |
|
106 |
_L("\\sys\\bin\\"), |
|
107 |
_L("t_findcaptestfile.txt")); |
|
108 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
test_Value(Err, Err == KErrPermissionDenied); |
0 | 110 |
|
111 |
// Test: Find non existing file in /sys folder without specifying the path |
|
112 |
// |
|
113 |
// Drive Name : Not specified |
|
114 |
// Path : sys |
|
115 |
// File Name : nonexistingfile.txt |
|
116 |
// |
|
117 |
// Expected return value: KErrPermissionDenied |
|
118 |
Err=TestFind(_L("Drive not specified Path exists File does not exist"), |
|
119 |
_L("\\sys\\"), |
|
120 |
_L("nonexisting.txt")); |
|
121 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
test_Value(Err, Err == KErrPermissionDenied); |
0 | 123 |
|
124 |
FileServer.Close(); |
|
125 |
||
126 |
test.Printf(_L("Test completed\n")); |
|
127 |
||
128 |
test.End(); |
|
129 |
test.Close(); |
|
130 |
||
131 |
return KErrNone; |
|
132 |
} |