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