author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-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 |
// |
|
15 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
16 |
#define __E32TEST_EXTENSION__ |
0 | 17 |
#include <f32file.h> |
18 |
#include <e32test.h> |
|
19 |
#include <e32std.h> |
|
20 |
#include <e32std_private.h> |
|
21 |
#include <e32def.h> |
|
22 |
#include <e32def_private.h> |
|
23 |
#include <e32svr.h> |
|
24 |
#include "t_server.h" |
|
25 |
||
26 |
GLDEF_D RTest test(_L("t_dcallcaps")); |
|
27 |
GLDEF_D TTime gTimeNow; |
|
28 |
LOCAL_D TInt gTheDriveNum; |
|
29 |
||
30 |
||
31 |
const TInt KPathPosition = 2; |
|
32 |
_LIT(KExpectedPrivatePath, "\\Private\\00000001\\"); |
|
33 |
_LIT(KResourcePath, "?:\\Resource\\"); |
|
34 |
_LIT(KSystemPath, "?:\\Sys\\"); |
|
35 |
_LIT(KPrivatePath, "?:\\Private\\"); |
|
36 |
_LIT(KPrivateFalseID, "?:\\Private\\FFFFFFFF\\"); |
|
37 |
_LIT(KDriveName, "Billy"); |
|
38 |
_LIT(KVolLable, "Benny"); |
|
39 |
_LIT(KFileSys, "systemfile.txt"); |
|
40 |
_LIT(KFileSys3, "sysfile.rna"); |
|
41 |
_LIT(KFilePri, "privatefile.txt"); |
|
42 |
_LIT(KFilePri2, "privatefile.tmp"); |
|
43 |
_LIT(KFilePri3, "prifile.rna"); |
|
44 |
_LIT(KFileRes, "resourcefile.txt"); |
|
45 |
_LIT(KFileRes3, "resfile.rna"); |
|
46 |
_LIT(KMkDirSub,"Subdir\\"); |
|
47 |
_LIT(KOldFile,"?:\\Anyold.txt"); |
|
48 |
_LIT(KWildPath, "Z:\\SYS\\"); |
|
49 |
_LIT(KWildFile, "*"); |
|
50 |
||
51 |
TCapability TheCaps; |
|
52 |
TBuf<4> driveBuf=_L("?:\\"); |
|
53 |
RFormat format; |
|
54 |
TInt count; |
|
55 |
RRawDisk rawdisk; |
|
56 |
RFile file1; |
|
57 |
RFile file2; |
|
58 |
RDir dir; |
|
59 |
||
60 |
TInt r; |
|
61 |
TBuf<40> fsname; |
|
62 |
TBuf<40> systestname; |
|
63 |
TBuf<40> pritestname; |
|
64 |
TBuf<40> restestname; |
|
65 |
TBuf<40> theprivatepath; |
|
66 |
TBuf<40> pritestfalseidname; |
|
67 |
TBuf<40> mkdirname; |
|
68 |
TFileName fromTemp; |
|
69 |
||
70 |
TBuf<25> sysfilename; |
|
71 |
TBuf<30> realName; |
|
72 |
TBuf<40> shortfilename; |
|
73 |
TBuf<40> longfilename; |
|
74 |
||
75 |
TRequestStatus aStat1; |
|
76 |
TRequestStatus aStat2; |
|
77 |
TRequestStatus aStat3; |
|
78 |
TRequestStatus aStat4; |
|
79 |
||
80 |
TBuf<40> systestfile; |
|
81 |
TBuf<40> pritestfile; |
|
82 |
TBuf<40> restestfile; |
|
83 |
TBuf<40> systestfile1; |
|
84 |
TBuf<40> pritestfile1; |
|
85 |
TBuf<40> restestfile1; |
|
86 |
||
87 |
TTime testtime; |
|
88 |
TBuf<20> oldName; |
|
89 |
||
90 |
TBuf<25> temp; |
|
91 |
||
92 |
TEntry entry; |
|
93 |
||
94 |
LOCAL_C void systemRFsTest() |
|
95 |
// |
|
96 |
// RFs test on system Directory |
|
97 |
// |
|
98 |
{ |
|
99 |
systestname=KSystemPath; |
|
100 |
systestname[0]=(TText)('A' + gTheDriveNum); |
|
101 |
||
102 |
mkdirname.Zero(); |
|
103 |
mkdirname.Append(systestname); |
|
104 |
mkdirname.Append(KMkDirSub); |
|
105 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
test_KErrNone(r); |
0 | 107 |
|
108 |
TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
test_KErrNone(r); |
0 | 110 |
|
111 |
r=TheFs.SetSubst(systestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
112 |
test_KErrNone(r); |
0 | 113 |
|
114 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
115 |
test_KErrNone(r); |
0 | 116 |
|
117 |
r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
118 |
test_KErrNone(r); |
0 | 119 |
|
120 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
121 |
test_KErrNone(r); |
0 | 122 |
|
123 |
TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
|
124 |
test(aStat1==KRequestPending); |
|
125 |
||
126 |
systestfile=KSystemPath; |
|
127 |
systestfile[0]=(TText)('A' + gTheDriveNum); |
|
128 |
systestfile1=systestfile; |
|
129 |
systestfile.Append(KFileSys); |
|
130 |
systestfile1.Append(KFileSys3); |
|
131 |
||
132 |
oldName=KOldFile; |
|
133 |
oldName[0]=(TText)gDriveToTest; |
|
134 |
||
135 |
r=TheFs.GetShortName(systestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
136 |
test_Value(r, r == KErrNotFound || r==KErrNotSupported); |
0 | 137 |
|
138 |
r=TheFs.GetLongName(systestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
test_Value(r, r == KErrNotFound || r==KErrNotSupported); |
0 | 140 |
|
141 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
142 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 143 |
file1.Close(); |
144 |
||
145 |
r=TheFs.Replace(oldName,systestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
146 |
test_KErrNone(r); |
0 | 147 |
|
148 |
r=TheFs.Rename(systestfile,systestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
149 |
test_KErrNone(r); |
0 | 150 |
|
151 |
r=TheFs.Entry(systestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
152 |
test_KErrNone(r); |
0 | 153 |
|
154 |
r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
test_KErrNone(r); |
0 | 156 |
|
157 |
r=TheFs.Delete(systestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
158 |
test_KErrNone(r); |
0 | 159 |
} |
160 |
||
161 |
LOCAL_C void ResourceRFsTest() |
|
162 |
// |
|
163 |
// |
|
164 |
// |
|
165 |
{ |
|
166 |
restestname=KResourcePath; |
|
167 |
restestname[0]=(TText)('A' + gTheDriveNum); |
|
168 |
||
169 |
mkdirname.Zero(); |
|
170 |
mkdirname.Append(restestname); |
|
171 |
mkdirname.Append(KMkDirSub); |
|
172 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
test_KErrNone(r); |
0 | 174 |
|
175 |
TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
test_KErrNone(r); |
0 | 177 |
|
178 |
r=TheFs.SetSubst(restestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
test_KErrNone(r); |
0 | 180 |
|
181 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
test_KErrNone(r); |
0 | 183 |
|
184 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
test_KErrNone(r); |
0 | 186 |
|
187 |
r=TheFs.SetSessionPath(restestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
test_KErrNone(r); |
0 | 189 |
|
190 |
TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
|
191 |
test(aStat4==KRequestPending); |
|
192 |
||
193 |
restestfile=KResourcePath; |
|
194 |
restestfile[0]=(TText)('A' + gTheDriveNum); |
|
195 |
restestfile1=restestfile; |
|
196 |
restestfile.Append(KFileRes); |
|
197 |
restestfile1.Append(KFileRes3); |
|
198 |
||
199 |
oldName=KOldFile; |
|
200 |
oldName[0]=(TText)gDriveToTest; |
|
201 |
||
202 |
r=TheFs.GetShortName(restestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
203 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 204 |
|
205 |
r=TheFs.GetLongName(restestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
206 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 207 |
|
208 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 210 |
file1.Close(); |
211 |
||
212 |
r=TheFs.Replace(oldName,restestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
213 |
test_KErrNone(r); |
0 | 214 |
|
215 |
r=TheFs.Rename(restestfile,restestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
216 |
test_KErrNone(r); |
0 | 217 |
|
218 |
r=TheFs.Entry(restestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
219 |
test_KErrNone(r); |
0 | 220 |
|
221 |
r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
test_KErrNone(r); |
0 | 223 |
|
224 |
r=TheFs.Delete(restestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
test_KErrNone(r); |
0 | 226 |
|
227 |
} |
|
228 |
||
229 |
||
230 |
LOCAL_C void privatefalseIDRFsTest() |
|
231 |
// |
|
232 |
// |
|
233 |
// |
|
234 |
{ |
|
235 |
//private//FalseID |
|
236 |
pritestfalseidname=KPrivateFalseID; |
|
237 |
pritestfalseidname[0]=(TText)('A' + gTheDriveNum); |
|
238 |
||
239 |
mkdirname.Zero(); |
|
240 |
mkdirname.Append(pritestfalseidname); |
|
241 |
mkdirname.Append(KMkDirSub); |
|
242 |
||
243 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
244 |
test_KErrNone(r); |
0 | 245 |
|
246 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
test_KErrNone(r); |
0 | 248 |
|
249 |
r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
250 |
test_KErrNone(r); |
0 | 251 |
|
252 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
253 |
test_KErrNone(r); |
0 | 254 |
|
255 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
256 |
test_KErrNone(r); |
0 | 257 |
|
258 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
259 |
test_KErrNone(r); |
0 | 260 |
|
261 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
|
262 |
test(aStat2==KRequestPending); |
|
263 |
||
264 |
||
265 |
pritestfile=KPrivateFalseID; |
|
266 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
267 |
pritestfile1=pritestfile; |
|
268 |
pritestfile.Append(KFilePri2); |
|
269 |
pritestfile1.Append(KFilePri3); |
|
270 |
||
271 |
oldName=KOldFile; |
|
272 |
oldName[0]=(TText)gDriveToTest; |
|
273 |
||
274 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
275 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 276 |
|
277 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
278 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 279 |
|
280 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
281 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 282 |
file1.Close(); |
283 |
||
284 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
285 |
test_KErrNone(r); |
0 | 286 |
|
287 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
288 |
test_KErrNone(r); |
0 | 289 |
|
290 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
291 |
test_KErrNone(r); |
0 | 292 |
|
293 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
294 |
test_KErrNone(r); |
0 | 295 |
|
296 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
297 |
test_KErrNone(r); |
0 | 298 |
|
299 |
} |
|
300 |
||
301 |
||
302 |
||
303 |
LOCAL_C void privateRFsTest() |
|
304 |
// |
|
305 |
// |
|
306 |
// |
|
307 |
{ |
|
308 |
//private |
|
309 |
pritestname=KPrivatePath; |
|
310 |
pritestname[0]=(TText)('A' + gTheDriveNum); |
|
311 |
||
312 |
mkdirname.Zero(); |
|
313 |
mkdirname.Append(pritestname); |
|
314 |
mkdirname.Append(KMkDirSub); |
|
315 |
||
316 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
317 |
test_KErrNone(r); |
0 | 318 |
|
319 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
320 |
test_KErrNone(r); |
0 | 321 |
|
322 |
r=TheFs.SetSubst(pritestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
323 |
test_KErrNone(r); |
0 | 324 |
|
325 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
326 |
test_KErrNone(r); |
0 | 327 |
|
328 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
329 |
test_KErrNone(r); |
0 | 330 |
|
331 |
r=TheFs.SetSessionPath(pritestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
332 |
test_KErrNone(r); |
0 | 333 |
|
334 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
|
335 |
test(aStat2==KRequestPending); |
|
336 |
||
337 |
||
338 |
pritestfile=KPrivatePath; |
|
339 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
340 |
pritestfile1=pritestfile; |
|
341 |
pritestfile.Append(KFilePri2); |
|
342 |
pritestfile1.Append(KFilePri3); |
|
343 |
||
344 |
oldName=KOldFile; |
|
345 |
oldName[0]=(TText)gDriveToTest; |
|
346 |
||
347 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
348 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 349 |
|
350 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
351 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 352 |
|
353 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
354 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 355 |
file1.Close(); |
356 |
||
357 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
test_KErrNone(r); |
0 | 359 |
|
360 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
361 |
test_KErrNone(r); |
0 | 362 |
|
363 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
364 |
test_KErrNone(r); |
0 | 365 |
|
366 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
367 |
test_KErrNone(r); |
0 | 368 |
|
369 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
370 |
test_KErrNone(r); |
0 | 371 |
|
372 |
} |
|
373 |
||
374 |
||
375 |
LOCAL_C void privateSIDRFstest() |
|
376 |
{ |
|
377 |
theprivatepath[0]=(TText)gDriveToTest; |
|
378 |
test.Printf(_L("the Private Path = %S"),&theprivatepath); |
|
379 |
||
380 |
mkdirname.Zero(); |
|
381 |
mkdirname.Append(theprivatepath); |
|
382 |
mkdirname.Append(KMkDirSub); |
|
383 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
384 |
test_KErrNone(r); |
0 | 385 |
|
386 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
387 |
test_KErrNone(r); |
0 | 388 |
|
389 |
r=TheFs.SetSubst(theprivatepath,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
390 |
test_KErrNone(r); |
0 | 391 |
|
392 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
393 |
test_KErrNone(r); |
0 | 394 |
|
395 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
396 |
test_KErrNone(r); |
0 | 397 |
|
398 |
r=TheFs.SetSessionPath(theprivatepath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
399 |
test_KErrNone(r); |
0 | 400 |
|
401 |
TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
|
402 |
test(aStat3==KRequestPending); |
|
403 |
||
404 |
pritestfile=theprivatepath; |
|
405 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
406 |
pritestfile1=pritestfile; |
|
407 |
pritestfile.Append(KFilePri2); |
|
408 |
pritestfile1.Append(KFilePri3); |
|
409 |
||
410 |
oldName=KOldFile; |
|
411 |
oldName[0]=(TText)gDriveToTest; |
|
412 |
||
413 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
414 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 415 |
|
416 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
417 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 418 |
|
419 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
420 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 421 |
file1.Close(); |
422 |
||
423 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
424 |
test_KErrNone(r); |
0 | 425 |
|
426 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
427 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 428 |
|
429 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
430 |
test_KErrNone(r); |
0 | 431 |
|
432 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
433 |
test_KErrNone(r); |
0 | 434 |
|
435 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
436 |
test_KErrNone(r); |
0 | 437 |
} |
438 |
||
439 |
||
440 |
LOCAL_C void systemRFiletest() |
|
441 |
// |
|
442 |
//RFile testing with session path set to //system// |
|
443 |
// |
|
444 |
{ |
|
445 |
||
446 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
447 |
test_KErrNone(r); |
0 | 448 |
|
449 |
r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
450 |
test_KErrNone(r); |
0 | 451 |
file1.Close(); |
452 |
||
453 |
r=file1.Create(TheFs,KFileSys,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
454 |
test_KErrNone(r); |
0 | 455 |
file1.Close(); |
456 |
||
457 |
r=file1.Open(TheFs,KFileSys,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
458 |
test_KErrNone(r); |
0 | 459 |
file1.Close(); |
460 |
||
461 |
r=file1.Open(TheFs,KFileSys,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
462 |
test_KErrNone(r); |
0 | 463 |
file1.Close(); |
464 |
||
465 |
r=file1.Replace(TheFs,KFileSys,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
466 |
test_KErrNone(r); |
0 | 467 |
|
468 |
r=file1.Rename(KFileSys3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
469 |
test_KErrNone(r); |
0 | 470 |
file1.Close(); |
471 |
||
472 |
TFindFile finder(TheFs); |
|
473 |
CDir* dir = NULL; |
|
474 |
r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
|
475 |
if (!(r==KErrNone)) |
|
476 |
test.Printf(_L("T_DCALLCAPS: test find wildcards r = %d (expected KErrNone)\n"), r); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
477 |
test_KErrNone(r); |
0 | 478 |
delete dir; |
479 |
} |
|
480 |
||
481 |
LOCAL_C void resourceRFiletest() |
|
482 |
// |
|
483 |
//RFile testing with session path set to //resource// |
|
484 |
// |
|
485 |
{ |
|
486 |
r=TheFs.SetSessionPath(restestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
487 |
test_KErrNone(r); |
0 | 488 |
|
489 |
r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
490 |
test_KErrNone(r); |
0 | 491 |
file1.Close(); |
492 |
||
493 |
r=file1.Create(TheFs,KFileRes,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
test_KErrNone(r); |
0 | 495 |
file1.Close(); |
496 |
||
497 |
r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
498 |
test_KErrNone(r); |
0 | 499 |
|
500 |
r=file1.Rename(KFileRes3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
test_KErrNone(r); |
0 | 502 |
file1.Close(); |
503 |
||
504 |
r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
505 |
test_KErrNone(r); |
0 | 506 |
file1.Close(); |
507 |
||
508 |
r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
509 |
test_KErrNone(r); |
0 | 510 |
file1.Close(); |
511 |
||
512 |
r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
513 |
test_KErrNone(r); |
0 | 514 |
|
515 |
r=file1.ChangeMode(EFileShareExclusive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
516 |
test_KErrNone(r); |
0 | 517 |
file1.Close(); |
518 |
||
519 |
r=file1.Replace(TheFs,KFileRes,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
520 |
test_KErrNone(r); |
0 | 521 |
file1.Close(); |
522 |
} |
|
523 |
||
524 |
||
525 |
LOCAL_C void privatefalseIDRFiletest() |
|
526 |
// |
|
527 |
//RFile testing with session path set to //Private//falseID |
|
528 |
// |
|
529 |
{ |
|
530 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
531 |
test_KErrNone(r); |
0 | 532 |
|
533 |
r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
534 |
test_KErrNone(r); |
0 | 535 |
file1.Close(); |
536 |
||
537 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
538 |
test_KErrNone(r); |
0 | 539 |
file1.Close(); |
540 |
||
541 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
test_KErrNone(r); |
0 | 543 |
file1.Close(); |
544 |
||
545 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
546 |
test_KErrNone(r); |
0 | 547 |
file1.Close(); |
548 |
||
549 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
550 |
test_KErrNone(r); |
0 | 551 |
|
552 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
553 |
test_KErrNone(r); |
0 | 554 |
file1.Close(); |
555 |
} |
|
556 |
||
557 |
LOCAL_C void privateRFiletest() |
|
558 |
// |
|
559 |
//RFile testing with session path set to //Private//falseID |
|
560 |
// |
|
561 |
{ |
|
562 |
r=TheFs.SetSessionPath(pritestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
563 |
test_KErrNone(r); |
0 | 564 |
|
565 |
r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
566 |
test_KErrNone(r); |
0 | 567 |
file1.Close(); |
568 |
||
569 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
570 |
test_KErrNone(r); |
0 | 571 |
file1.Close(); |
572 |
||
573 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
574 |
test_KErrNone(r); |
0 | 575 |
file1.Close(); |
576 |
||
577 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
578 |
test_KErrNone(r); |
0 | 579 |
file1.Close(); |
580 |
||
581 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
582 |
test_KErrNone(r); |
0 | 583 |
|
584 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
585 |
test_KErrNone(r); |
0 | 586 |
file1.Close(); |
587 |
} |
|
588 |
||
589 |
||
590 |
||
591 |
LOCAL_C void privateSIDRFiletest() |
|
592 |
// |
|
593 |
//Rfile Testing with session path set to //Private//UID// |
|
594 |
// |
|
595 |
{ |
|
596 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
597 |
test_KErrNone(r); |
0 | 598 |
|
599 |
r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
600 |
test_KErrNone(r); |
0 | 601 |
file1.Close(); |
602 |
||
603 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
604 |
test_KErrNone(r); |
0 | 605 |
file1.Close(); |
606 |
||
607 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
608 |
test_KErrNone(r); |
0 | 609 |
file1.Close(); |
610 |
||
611 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
612 |
test_KErrNone(r); |
0 | 613 |
file1.Close(); |
614 |
||
615 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
616 |
test_KErrNone(r); |
0 | 617 |
|
618 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
619 |
test_KErrNone(r); |
0 | 620 |
file1.Close(); |
621 |
} |
|
622 |
||
623 |
LOCAL_C void RDirtest() |
|
624 |
// |
|
625 |
// |
|
626 |
// |
|
627 |
{ |
|
628 |
||
629 |
//system |
|
630 |
CDir* dirEntries; |
|
631 |
TBuf<30> dirNameBuf(KSystemPath); |
|
632 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
633 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
634 |
test_KErrNone(r); |
0 | 635 |
dir.Close(); |
636 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
637 |
test_KErrNone(r); |
0 | 638 |
dirNameBuf.Zero(); |
639 |
delete dirEntries; |
|
640 |
//Private//falseID |
|
641 |
dirNameBuf=KPrivateFalseID; |
|
642 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
643 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
644 |
test_KErrNone(r); |
0 | 645 |
dir.Close(); |
646 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
647 |
test_KErrNone(r); |
0 | 648 |
dirNameBuf.Zero(); |
649 |
delete dirEntries; |
|
650 |
//Private |
|
651 |
dirNameBuf=KPrivatePath; |
|
652 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
653 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
654 |
test_KErrNone(r); |
0 | 655 |
dir.Close(); |
656 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
657 |
test_KErrNone(r); |
0 | 658 |
dirNameBuf.Zero(); |
659 |
delete dirEntries; |
|
660 |
//Private/uid |
|
661 |
TheFs.PrivatePath(dirNameBuf); |
|
662 |
dirNameBuf.Insert(0,_L("?:")); |
|
663 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
664 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
665 |
test_KErrNone(r); |
0 | 666 |
dir.Close(); |
667 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
668 |
test_KErrNone(r); |
0 | 669 |
dirNameBuf.Zero(); |
670 |
delete dirEntries; |
|
671 |
//Resource |
|
672 |
dirNameBuf=KResourcePath; |
|
673 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
674 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
675 |
test_KErrNone(r); |
0 | 676 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
677 |
test_KErrNone(r); |
0 | 678 |
dir.Close(); |
679 |
delete dirEntries; |
|
680 |
} |
|
681 |
||
682 |
||
683 |
LOCAL_C void TestAllCaps() |
|
684 |
// |
|
685 |
// Test with root capabilities |
|
686 |
// |
|
687 |
{ |
|
688 |
r=TheFs.FileSystemName(fsname,gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
689 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 690 |
r=DismountFileSystem(TheFs, fsname,gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
691 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 692 |
// r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
693 |
// test_KErrNone(r); |
0 | 694 |
// r=TheFs.AddFileSystem(fsname); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
695 |
// test_KErrNone(r); |
0 | 696 |
r=MountFileSystem(TheFs,fsname,gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
697 |
test_KErrNone(r); |
0 | 698 |
r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
699 |
test_KErrNone(r); |
0 | 700 |
#ifndef __WINS__ |
701 |
r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
702 |
test_KErrNone(r); |
0 | 703 |
#endif |
704 |
||
705 |
systemRFsTest(); |
|
706 |
ResourceRFsTest(); |
|
707 |
privateRFsTest(); |
|
708 |
privateSIDRFstest(); |
|
709 |
privatefalseIDRFsTest(); |
|
710 |
||
711 |
systemRFiletest(); |
|
712 |
resourceRFiletest(); |
|
713 |
privateRFiletest(); |
|
714 |
privateSIDRFiletest(); |
|
715 |
privatefalseIDRFiletest(); |
|
716 |
||
717 |
//check notifier return values set in rfs testing |
|
718 |
User::WaitForRequest(aStat1); |
|
719 |
User::WaitForRequest(aStat2); |
|
720 |
User::WaitForRequest(aStat3); |
|
721 |
User::WaitForRequest(aStat4); |
|
722 |
test(aStat1==KErrNone); |
|
723 |
test(aStat2==KErrNone); |
|
724 |
test(aStat3==KErrNone); |
|
725 |
test(aStat4==KErrNone); |
|
726 |
||
727 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
728 |
test_KErrNone(r); |
0 | 729 |
|
730 |
//Test RRawDisk class |
|
731 |
r=rawdisk.Open(TheFs,gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
732 |
test_KErrNone(r); |
0 | 733 |
rawdisk.Close(); |
734 |
||
735 |
RDirtest(); |
|
736 |
||
737 |
#ifdef __WINS__ |
|
738 |
if (User::UpperCase(driveBuf[0]) != 'C') |
|
739 |
#endif |
|
740 |
{ |
|
741 |
//Test RFormat class |
|
742 |
r=format.Open(TheFs,driveBuf,EHighDensity,count); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
743 |
test_KErrNone(r); |
0 | 744 |
|
745 |
while(count) |
|
746 |
{ |
|
747 |
TInt r=format.Next(count); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
748 |
test_KErrNone(r); |
0 | 749 |
} |
750 |
format.Close(); |
|
751 |
} |
|
752 |
||
753 |
driveBuf[0]=(TText)gDriveToTest; |
|
754 |
r=TheFs.ScanDrive(driveBuf); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
755 |
test_Value(r, r == KErrNone || r==KErrNotSupported); |
0 | 756 |
r=TheFs.CheckDisk(driveBuf); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
757 |
test_Value(r, r == KErrNone || r==KErrNotSupported); |
0 | 758 |
} |
759 |
||
760 |
LOCAL_C void TestCaps() |
|
761 |
// |
|
762 |
// test format etc that require certain capabilities |
|
763 |
// |
|
764 |
{ |
|
765 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
766 |
const char myDiagMsg[] = __PLATSEC_DIAGNOSTIC_STRING("Capability Check Failure"); |
|
767 |
#endif //!__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
768 |
||
769 |
r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
770 |
test(r); |
|
771 |
r=RProcess().HasCapability(ECapabilityTCB, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
772 |
test(r); |
|
773 |
r=RProcess().HasCapability(ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
774 |
test(r); |
|
775 |
||
776 |
driveBuf[0]=(TText)gDriveToTest; |
|
777 |
r=TheFs.SessionPath(temp); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
778 |
test_KErrNone(r); |
0 | 779 |
|
780 |
test.Printf(_L("Session path: %S"),&temp); |
|
781 |
||
782 |
r=TheFs.CreatePrivatePath(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
783 |
test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
0 | 784 |
|
785 |
TBuf<18> tempPri; |
|
786 |
r=TheFs.PrivatePath(tempPri); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
787 |
test_KErrNone(r); |
0 | 788 |
theprivatepath = _L("?:"); |
789 |
theprivatepath.Append(tempPri); |
|
790 |
||
791 |
TestAllCaps(); |
|
792 |
||
793 |
TFileName thesessionpath; |
|
794 |
||
795 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
796 |
test_KErrNone(r); |
0 | 797 |
r=TheFs.SessionPath(thesessionpath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
798 |
test_KErrNone(r); |
0 | 799 |
|
800 |
test(thesessionpath == theprivatepath); |
|
801 |
} |
|
802 |
||
803 |
LOCAL_C void CleanupL() |
|
804 |
// |
|
805 |
// Clean up tests |
|
806 |
// |
|
807 |
{ |
|
808 |
test.Next(_L("Delete test directory")); |
|
809 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
810 |
TInt r=fMan->RmDir(gSessionPath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
811 |
test_Value(r, r == KErrNone || r == KErrPathNotFound); |
0 | 812 |
delete fMan; |
813 |
} |
|
814 |
||
815 |
GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
|
816 |
// |
|
817 |
// Do all tests |
|
818 |
// |
|
819 |
{ |
|
820 |
TurnAllocFailureOff(); |
|
821 |
TheFs.CharToDrive(gDriveToTest,gTheDriveNum); |
|
822 |
||
823 |
TBuf<30> sesspath; |
|
824 |
sesspath=_L("?:\\"); |
|
825 |
sesspath[0] = (TText)gDriveToTest; |
|
826 |
||
827 |
TInt r= TheFs.SetSessionPath(sesspath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
828 |
test_KErrNone(r); |
0 | 829 |
|
830 |
//cleanup from previous run of this test |
|
831 |
TBuf<20> delDir; |
|
832 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
833 |
delDir=KResourcePath; |
|
834 |
delDir[0]=(TText)gDriveToTest; |
|
835 |
r=fMan->RmDir(delDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
836 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 837 |
delDir=KSystemPath; |
838 |
delDir[0]=(TText)gDriveToTest; |
|
839 |
r=fMan->RmDir(delDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
840 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 841 |
delDir=KPrivatePath; |
842 |
delDir[0]=(TText)gDriveToTest; |
|
843 |
r=fMan->RmDir(delDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
844 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 845 |
delete fMan; |
846 |
||
847 |
//check double mode ie that Defpath still works |
|
848 |
RFs fs1; |
|
849 |
RFs fs2; |
|
850 |
||
851 |
r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
852 |
test_KErrNone(r); |
0 | 853 |
r=fs1.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
854 |
test_KErrNone(r); |
0 | 855 |
test.Printf(_L("session1 Path=%S"),&sesspath); |
856 |
||
857 |
TBuf<30> privatepath; |
|
858 |
r=fs1.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
859 |
test_KErrNone(r); |
0 | 860 |
r=fs1.PrivatePath(privatepath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
861 |
test_KErrNone(r); |
0 | 862 |
r=privatepath.Compare(KExpectedPrivatePath()); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
863 |
test_Value(r, r == 0); |
0 | 864 |
r=fs1.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
865 |
test_KErrNone(r); |
0 | 866 |
r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
867 |
test_Value(r, r == 0); |
0 | 868 |
r=fs1.CreatePrivatePath(gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
869 |
test_KErrNone(r); |
0 | 870 |
fs1.Close(); |
871 |
||
872 |
r=fs2.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
873 |
test_KErrNone(r); |
0 | 874 |
r=fs2.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
875 |
test_KErrNone(r); |
0 | 876 |
test.Printf(_L("session2 Path=%S"),&sesspath); |
877 |
fs2.Close(); |
|
878 |
||
879 |
TestCaps(); |
|
880 |
||
881 |
test.Printf(_L("No of files open=%d"), TheFs.ResourceCount()); |
|
882 |
||
883 |
CleanupL(); |
|
884 |
} |