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) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// f32test\server\t_notify.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
18 |
#define __E32TEST_EXTENSION__ |
0 | 19 |
#include <f32file.h> |
20 |
#include <e32test.h> |
|
21 |
#include <e32svr.h> |
|
22 |
#include <hal.h> |
|
23 |
#include "t_server.h" |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#include "f32_test_utils.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
using namespace F32_Test_Utils; |
0 | 27 |
|
28 |
const TInt KHeapSize=0x200; |
|
29 |
||
30 |
// wait for a bit since NotifyChange handled asynchronously and SetDriveName synchronously |
|
31 |
const TInt KNotifyChangeAfter=100000; |
|
32 |
const TInt KMediaRemountForceMediaChange = 0x00000001; |
|
33 |
||
34 |
RTest test(_L("T_NOTIFY")); |
|
35 |
RSemaphore gSleepThread; |
|
36 |
TInt gSocketNumber=0; |
|
37 |
TInt SocketToDrive[KMaxPBusSockets]; |
|
38 |
||
39 |
//#define __INCLUDE_MANUAL_TESTS__ |
|
40 |
||
41 |
void do_check_no_pending_requests(TInt aLine) |
|
42 |
{ |
|
43 |
RTimer timer; |
|
44 |
TRequestStatus timerStat; |
|
45 |
timer.CreateLocal(); |
|
46 |
timer.After(timerStat, 125000); |
|
47 |
User::WaitForAnyRequest(); |
|
48 |
if(timerStat==KRequestPending) |
|
49 |
{ |
|
50 |
RDebug::Printf("do_check_no_pending_requests failed at line %d",aLine); |
|
51 |
test(0); |
|
52 |
} |
|
53 |
timer.Close(); |
|
54 |
} |
|
55 |
#define CHECK_NO_PENDING_REQUESTS do_check_no_pending_requests(__LINE__); |
|
56 |
||
57 |
||
58 |
TBool CheckDriveRead(TInt aDrive) |
|
59 |
//Determines if can connect to local drive number and read |
|
60 |
{ |
|
61 |
TBusLocalDrive TBLD; |
|
62 |
TBool TBLDChangedFlag; |
|
63 |
||
64 |
TInt r = TBLD.Connect(aDrive, TBLDChangedFlag); |
|
65 |
test.Printf(_L("Connect returned %d\n"), r); |
|
66 |
if (r == KErrNone) |
|
67 |
{ |
|
68 |
const TInt KSectSize = 512; |
|
69 |
TBuf8<KSectSize> sect; |
|
70 |
r = TBLD.Read(0, KSectSize, sect); |
|
71 |
test.Printf(_L("Read returned %d\n"), r); |
|
72 |
TBLD.Disconnect(); |
|
73 |
if(r!=KErrNone) |
|
74 |
return EFalse; |
|
75 |
else |
|
76 |
return ETrue; |
|
77 |
} |
|
78 |
else |
|
79 |
return EFalse; |
|
80 |
} |
|
81 |
||
82 |
void GenerateMediaChange() |
|
83 |
{ |
|
84 |
TPckgBuf<TInt> pckg; |
|
85 |
pckg()=0; |
|
86 |
||
87 |
RFs fs; |
|
88 |
TInt r = fs.Connect(); |
|
89 |
if (r == KErrNone) |
|
90 |
{ |
|
91 |
r = fs.RemountDrive(CurrentDrive(), &pckg, (TUint)KMediaRemountForceMediaChange); |
|
92 |
if(r == KErrNotReady) |
|
93 |
{ |
|
94 |
r = KErrNone; |
|
95 |
} |
|
96 |
fs.Close(); |
|
97 |
} |
|
98 |
||
99 |
if (r!=KErrNone) |
|
100 |
{ |
|
101 |
RProcess me; |
|
102 |
me.Panic(_L("GenMedChg"),r); |
|
103 |
} |
|
104 |
} |
|
105 |
||
106 |
enum TTestCode {ETest1,ETest2,ETest3,ETest4,ETest5,ETest6,ETest7,ETest8,ETest9,ETest10,ETest11,ETest12}; |
|
107 |
const TUint KGenericEntryChange=0x02; |
|
108 |
||
109 |
static TInt ThreadEntryPoint(TAny* aTestCode) |
|
110 |
// |
|
111 |
// Thread entry point |
|
112 |
// |
|
113 |
{ |
|
114 |
RFs fs; |
|
115 |
TInt r=fs.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
test_KErrNone(r); |
0 | 117 |
r=fs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
118 |
test_KErrNone(r); |
0 | 119 |
TTestCode testCode=*(TTestCode*)&aTestCode; |
120 |
RFile f; |
|
121 |
switch (testCode) |
|
122 |
{ |
|
123 |
||
124 |
case ETest1: |
|
125 |
r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
test_KErrNone(r); |
0 | 127 |
f.Close(); |
128 |
break; |
|
129 |
||
130 |
case ETest2: |
|
131 |
r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
test_KErrNone(r); |
0 | 133 |
f.Close(); |
134 |
break; |
|
135 |
||
136 |
case ETest3: |
|
137 |
r=fs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists)); |
0 | 139 |
break; |
140 |
||
141 |
case ETest4: |
|
142 |
{ |
|
143 |
TRequestStatus s; |
|
144 |
fs.NotifyChange(ENotifyAll,s); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
145 |
test_Value(s.Int(), s==KRequestPending); |
0 | 146 |
gSleepThread.Signal(); |
147 |
User::After(100000000); |
|
148 |
} |
|
149 |
break; |
|
150 |
||
151 |
case ETest5: |
|
152 |
{ |
|
153 |
RFile file; |
|
154 |
TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
test_KErrNone(r); |
0 | 156 |
r=file.SetSize(sizeof(TCheckedUid)); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
157 |
test_KErrNone(r); |
0 | 158 |
r=file.Write(sizeof(TCheckedUid),_L8("012345678912")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
test_KErrNone(r); |
0 | 160 |
TBuf8<64> dum; |
161 |
r=file.Read(0,dum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
test_KErrNone(r); |
0 | 163 |
file.Close(); |
164 |
||
165 |
r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
166 |
test_KErrNone(r); |
0 | 167 |
r=file.SetSize(50); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
168 |
test_KErrNone(r); |
0 | 169 |
r=file.Write(sizeof(TCheckedUid),_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
170 |
test_KErrNone(r); |
0 | 171 |
r=file.Read(0,dum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
172 |
test_KErrNone(r); |
0 | 173 |
file.Close(); |
174 |
||
175 |
r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
test_KErrNone(r); |
0 | 177 |
r=file.SetSize(50); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
test_KErrNone(r); |
0 | 179 |
r=file.Write(sizeof(TCheckedUid),_L8("01234567890123456789")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
test_KErrNone(r); |
0 | 181 |
r=file.Read(0,dum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
test_KErrNone(r); |
0 | 183 |
file.Close(); |
184 |
gSleepThread.Signal(); |
|
185 |
} |
|
186 |
break; |
|
187 |
||
188 |
case ETest6: |
|
189 |
{ |
|
190 |
GenerateMediaChange(); |
|
191 |
User::After(300000); // Wait for a bit |
|
192 |
gSleepThread.Signal(); |
|
193 |
} |
|
194 |
break; |
|
195 |
||
196 |
case ETest7: |
|
197 |
{ |
|
198 |
RFile file; |
|
199 |
TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFILE.TXT"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
200 |
test_KErrNone(r); |
0 | 201 |
r=file.Write(_L8("asdfasdfasdf")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
test_KErrNone(r); |
0 | 203 |
file.Close(); |
204 |
gSleepThread.Signal(); |
|
205 |
} |
|
206 |
break; |
|
207 |
||
208 |
case ETest8: |
|
209 |
{ |
|
210 |
r=f.Open(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
211 |
test_KErrNone(r); |
0 | 212 |
f.SetSize(500); |
213 |
f.Close(); |
|
214 |
break; |
|
215 |
} |
|
216 |
||
217 |
case ETest9: |
|
218 |
{ |
|
219 |
TRequestStatus s; |
|
220 |
TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
|
221 |
fs.NotifyChange(ENotifyAll,s,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
test_Value(s.Int(), s==KRequestPending); |
0 | 223 |
gSleepThread.Signal(); |
224 |
User::After(100000000); |
|
225 |
} |
|
226 |
break; |
|
227 |
case ETest10: |
|
228 |
{ |
|
229 |
TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
|
230 |
r=fs.MkDir(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
231 |
test_KErrNone(r); |
0 | 232 |
break; |
233 |
} |
|
234 |
case ETest11: |
|
235 |
{ |
|
236 |
TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man"); |
|
237 |
RFile file; |
|
238 |
r=file.Replace(fs,path,EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
239 |
test_KErrNone(r); |
0 | 240 |
file.Close(); |
241 |
break; |
|
242 |
} |
|
243 |
case ETest12: |
|
244 |
{ |
|
245 |
RFile writer; |
|
246 |
TInt r=writer.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
test_KErrNone(r); |
0 | 248 |
TInt i; |
249 |
for(i=0; i<10; i++) |
|
250 |
{ |
|
251 |
r=writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
252 |
test_KErrNone(r); |
0 | 253 |
User::After(1000000); |
254 |
} |
|
255 |
writer.Close(); |
|
256 |
break; |
|
257 |
} |
|
258 |
default: |
|
259 |
break; |
|
260 |
} |
|
261 |
return KErrNone; |
|
262 |
} |
|
263 |
||
264 |
#if defined (__EPOC32__)//we have no removable media on Emulator yet |
|
265 |
static void WaitForMediaChange() |
|
266 |
// |
|
267 |
// Wait for media driver to register drive is present |
|
268 |
// |
|
269 |
{ |
|
270 |
||
271 |
TEntry entry; |
|
272 |
FOREVER |
|
273 |
{ |
|
274 |
User::After(10000); |
|
275 |
TInt r=TheFs.Entry(_L("xxxxxxxx"),entry); |
|
276 |
if (r!=KErrNotReady) |
|
277 |
break; |
|
278 |
} |
|
279 |
} |
|
280 |
#endif |
|
281 |
||
282 |
static void Test1() |
|
283 |
// |
|
284 |
// Test notification of an entry change |
|
285 |
// |
|
286 |
{ |
|
287 |
||
288 |
test.Next(_L("Test notification of an entry change")); |
|
289 |
TRequestStatus reqStat(KRequestPending); |
|
290 |
TRequestStatus thrdStat(KRequestPending); |
|
291 |
TInt r; |
|
292 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
293 |
RThread thread; |
|
294 |
r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
295 |
test_KErrNone(r); |
0 | 296 |
thread.Logon(thrdStat); |
297 |
thread.Resume(); |
|
298 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
299 |
test_KErrNone(thrdStat.Int()); |
0 | 300 |
thread.Close(); |
301 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
302 |
test_KErrNone(reqStat.Int()); |
0 | 303 |
|
304 |
RFile file; |
|
305 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite|EFileShareExclusive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
306 |
test_KErrNone(r); |
0 | 307 |
file.Write(_L8("Somewhere over the rainbow..."),reqStat); |
308 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
309 |
test_KErrNone(reqStat.Int()); |
0 | 310 |
TBuf8<256> buf; |
311 |
file.Read(0, buf,reqStat); |
|
312 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
313 |
test_KErrNone(reqStat.Int()); |
0 | 314 |
file.Close(); |
315 |
||
316 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
317 |
test_Value(r, r == KErrArgument); |
0 | 318 |
|
319 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
320 |
test_Value(r, r == KErrArgument); |
0 | 321 |
|
322 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
323 |
test_KErrNone(r); |
0 | 324 |
file.Read(0, buf, 100, reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
325 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 326 |
file.Close(); |
327 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
328 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 329 |
|
330 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
331 |
test_KErrNone(r); |
0 | 332 |
file.Read(0, buf, 100, reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
333 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 334 |
file.ReadCancel(reqStat); |
335 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
336 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 337 |
file.Close(); |
338 |
||
339 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
340 |
test_KErrNone(r); |
0 | 341 |
file.Read(0, buf, 100, reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
342 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 343 |
file.SetSize(100); |
344 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
345 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
346 |
test_Equal(100, buf.Length()); |
0 | 347 |
file.Close(); |
348 |
||
349 |
test.Next(_L("Repeat Test notification of an entry change")); |
|
350 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
351 |
thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
|
352 |
thread.Logon(thrdStat); |
|
353 |
thread.Resume(); |
|
354 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
355 |
test_KErrNone(thrdStat.Int()); |
0 | 356 |
thread.Close(); |
357 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
test_KErrNone(reqStat.Int()); |
0 | 359 |
|
360 |
test.Next(_L("Test Notify cancel")); |
|
361 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
362 |
TheFs.NotifyChangeCancel(); |
|
363 |
User::WaitForRequest(reqStat); |
|
364 |
||
365 |
test.Next(_L("Test notification still works")); |
|
366 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
367 |
thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
|
368 |
thread.Logon(thrdStat); |
|
369 |
thread.Resume(); |
|
370 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
371 |
test_KErrNone(thrdStat.Int()); |
0 | 372 |
thread.Close(); |
373 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
374 |
test_KErrNone(reqStat.Int()); |
0 | 375 |
} |
376 |
||
377 |
static void Test2() |
|
378 |
// |
|
379 |
// Test notify for multiple clients |
|
380 |
// |
|
381 |
{ |
|
382 |
||
383 |
test.Next(_L("Test notification of multiple clients")); |
|
384 |
||
385 |
TRequestStatus reqStat1(KRequestPending); |
|
386 |
RFs fs1; |
|
387 |
TInt r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
388 |
test_KErrNone(r); |
0 | 389 |
fs1.NotifyChange(ENotifyEntry,reqStat1); |
390 |
||
391 |
TRequestStatus reqStat2(KRequestPending); |
|
392 |
RFs fs2; |
|
393 |
r=fs2.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
394 |
test_KErrNone(r); |
0 | 395 |
fs2.NotifyChange(ENotifyEntry,reqStat2); |
396 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
397 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
398 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
0 | 399 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
400 |
test_KErrNone(r); |
0 | 401 |
User::WaitForRequest(reqStat1); |
402 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
403 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
404 |
test_KErrNone(reqStat2.Int()); |
0 | 405 |
} |
406 |
||
407 |
static void Test3() |
|
408 |
// |
|
409 |
// Test notify cancel |
|
410 |
// |
|
411 |
{ |
|
412 |
||
413 |
test.Next(_L("Cancel notification")); |
|
414 |
RFs fs1; |
|
415 |
TInt r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
416 |
test_KErrNone(r); |
0 | 417 |
|
418 |
TRequestStatus status1; |
|
419 |
TRequestStatus status2; |
|
420 |
TRequestStatus status3; |
|
421 |
TRequestStatus status4; |
|
422 |
TRequestStatus status5; |
|
423 |
||
424 |
fs1.NotifyChange(ENotifyAll,status1); |
|
425 |
fs1.NotifyChange(ENotifyAll,status2); |
|
426 |
fs1.NotifyChange(ENotifyAll,status3); |
|
427 |
fs1.NotifyChange(ENotifyAll,status4); |
|
428 |
fs1.NotifyChange(ENotifyAll,status5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
429 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
430 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
431 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
432 |
test_Value(status4.Int(), status4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
433 |
test_Value(status5.Int(), status5==KRequestPending); |
0 | 434 |
|
435 |
test.Next(_L("RFs::NotifyCancel()")); |
|
436 |
// Test that one call to RFs::NotifyCancel() cancels all outstanding requests |
|
437 |
fs1.NotifyChangeCancel(); |
|
438 |
User::WaitForRequest(status1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
439 |
test_Value(status1.Int(), status1==KErrCancel); |
0 | 440 |
User::WaitForRequest(status2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
441 |
test_Value(status2.Int(), status2==KErrCancel); |
0 | 442 |
User::WaitForRequest(status3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
test_Value(status3.Int(), status3==KErrCancel); |
0 | 444 |
User::WaitForRequest(status4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
445 |
test_Value(status4.Int(), status4==KErrCancel); |
0 | 446 |
User::WaitForRequest(status5); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
447 |
test_Value(status5.Int(), status5==KErrCancel); |
0 | 448 |
// Call the cancel function again to check no further action |
449 |
fs1.NotifyChangeCancel(); |
|
450 |
||
451 |
// Test overloaded function to cancel a single request |
|
452 |
test.Next(_L("Cancel notification request using function overload")); |
|
453 |
fs1.NotifyChange(ENotifyAll,status1); |
|
454 |
fs1.NotifyChange(ENotifyAll,status2); |
|
455 |
fs1.NotifyChange(ENotifyAll,status3); |
|
456 |
fs1.NotifyChange(ENotifyAll,status4); |
|
457 |
fs1.NotifyChange(ENotifyAll,status5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
458 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
459 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
461 |
test_Value(status4.Int(), status4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
462 |
test_Value(status5.Int(), status5==KRequestPending); |
0 | 463 |
|
464 |
// Cancel the outstanding request with status5 |
|
465 |
test.Next(_L("RFs::NotifyCancel()")); |
|
466 |
fs1.NotifyChangeCancel(status5); |
|
467 |
User::WaitForRequest(status5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
468 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
469 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
471 |
test_Value(status4.Int(), status4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
472 |
test_Value(status5.Int(), status5==KErrCancel); |
0 | 473 |
|
474 |
fs1.NotifyChangeCancel(status2); |
|
475 |
User::WaitForRequest(status2); |
|
476 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
477 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
478 |
test_Value(status2.Int(), status2==KErrCancel); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
479 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
test_Value(status4.Int(), status4==KRequestPending); |
0 | 481 |
|
482 |
fs1.NotifyChangeCancel(status4); |
|
483 |
User::WaitForRequest(status4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
484 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
485 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
486 |
test_Value(status4.Int(), status4==KErrCancel); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
487 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
488 |
fs1.NotifyChangeCancel(status4); // Test no side effects on trying to cancel a request |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
489 |
test_Value(status4.Int(), status4==KErrCancel); // that has already been cancelled |
0 | 490 |
|
491 |
fs1.NotifyChangeCancel(status1); |
|
492 |
User::WaitForRequest(status1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
493 |
test_Value(status1.Int(), status1==KErrCancel); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
test_Value(status3.Int(), status3==KRequestPending); |
0 | 495 |
fs1.NotifyChangeCancel(status1); // Test no side effects on trying to cancel a request |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
496 |
test_Value(status1.Int(), status1==KErrCancel); // that has already been cancelled |
0 | 497 |
|
498 |
fs1.NotifyChangeCancel(status3); |
|
499 |
User::WaitForRequest(status3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
500 |
test_Value(status3.Int(), status3==KErrCancel); |
0 | 501 |
|
502 |
fs1.Close(); |
|
503 |
} |
|
504 |
||
505 |
static void Test4() |
|
506 |
// |
|
507 |
// Test notify client death |
|
508 |
// |
|
509 |
{ |
|
510 |
||
511 |
test.Next(_L("Kill client")); |
|
512 |
TInt r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
513 |
test_KErrNone(r); |
0 | 514 |
RThread clientThread; |
515 |
r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest4); |
|
516 |
if (r!=KErrNone) |
|
517 |
{ |
|
518 |
test.Printf(_L(" ERROR: Failed to create clientthread %d\n"),r); |
|
519 |
test(0); |
|
520 |
//test.Getch(); |
|
521 |
return; |
|
522 |
} |
|
523 |
clientThread.Resume(); |
|
524 |
gSleepThread.Wait(); |
|
525 |
||
526 |
TBool jit = User::JustInTime(); |
|
527 |
User::SetJustInTime(EFalse); |
|
528 |
clientThread.Panic(_L("Test client thread panic"),KErrGeneral); |
|
529 |
User::SetJustInTime(jit); |
|
530 |
||
531 |
clientThread.Close(); |
|
532 |
||
533 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
534 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 535 |
MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt")); |
536 |
User::After(1000); |
|
537 |
} |
|
538 |
||
539 |
static void Test5() |
|
540 |
// |
|
541 |
// Test reads and writes do not cause notification |
|
542 |
// |
|
543 |
{ |
|
544 |
||
545 |
test.Next(_L("Test reads and writes do not cause notification")); |
|
546 |
||
547 |
||
548 |
RFile file; |
|
549 |
TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|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 |
file.Close(); |
552 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
553 |
test_KErrNone(r); |
0 | 554 |
file.Close(); |
555 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
556 |
test_KErrNone(r); |
0 | 557 |
file.Close(); |
558 |
||
559 |
TRequestStatus reqStat=0; |
|
560 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
561 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 562 |
|
563 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
564 |
test_KErrNone(r); |
0 | 565 |
RThread clientThread; |
566 |
r=clientThread.Create(_L("Test5Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
567 |
test_KErrNone(r); |
0 | 568 |
clientThread.Resume(); |
569 |
gSleepThread.Wait(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
570 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 571 |
|
572 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
573 |
test_KErrNone(r); |
0 | 574 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
575 |
test_KErrNone(reqStat.Int()); |
0 | 576 |
|
577 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
578 |
test_KErrNone(r); |
0 | 579 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
580 |
test_KErrNone(r); |
0 | 581 |
|
582 |
||
583 |
||
584 |
gSleepThread.Close(); |
|
585 |
clientThread.Close(); |
|
586 |
} |
|
587 |
||
588 |
#if defined (__EPOC32__)//we have no removable media on Emulator yet .. ??? we do now |
|
589 |
static void Test6() |
|
590 |
// |
|
591 |
// Test media change notification |
|
592 |
// |
|
593 |
{ |
|
594 |
TDriveInfo driveInfo; |
|
595 |
TInt r=TheFs.Drive(driveInfo,CurrentDrive()); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
596 |
test_KErrNone(r); |
0 | 597 |
// only test on removable media |
598 |
if (driveInfo.iDriveAtt&KDriveAttRemovable) |
|
599 |
{ |
|
600 |
TBuf<64> b; |
|
601 |
b.Format(_L("Test Media change notification (socket:%d)"),gSocketNumber); |
|
602 |
test.Next(b); |
|
603 |
TRequestStatus reqStat=0; |
|
604 |
TInt r; |
|
605 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
606 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 607 |
r=gSleepThread.CreateLocal(0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
608 |
test_KErrNone(r); |
0 | 609 |
RThread clientThread; |
610 |
r=clientThread.Create(_L("Test6Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
611 |
test_KErrNone(r); |
0 | 612 |
clientThread.Resume(); |
613 |
gSleepThread.Wait(); |
|
614 |
TInt reqInt=reqStat.Int(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
615 |
test_KErrNone(reqInt); |
0 | 616 |
User::WaitForRequest(reqStat); |
617 |
WaitForMediaChange(); |
|
618 |
gSleepThread.Close(); |
|
619 |
clientThread.Close(); |
|
620 |
} |
|
621 |
||
622 |
//-- it seems that after generating media change the meia driver isn't ready for some time |
|
623 |
User::After(2000000); |
|
624 |
r=TheFs.Drive(driveInfo,CurrentDrive()); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
625 |
test_KErrNone(r); |
0 | 626 |
|
627 |
||
628 |
} |
|
629 |
#endif |
|
630 |
||
631 |
static void Test7() |
|
632 |
// |
|
633 |
// Test Write to uid region does not trigger notification |
|
634 |
// |
|
635 |
{ |
|
636 |
||
637 |
test.Next(_L("Test Write to uid region does not trigger notification")); |
|
638 |
TRequestStatus reqStat=0; |
|
639 |
MakeFile(_L("NewFile.TXT")); |
|
640 |
TInt r; |
|
641 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
642 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 643 |
|
644 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
645 |
test_KErrNone(r); |
0 | 646 |
RThread clientThread; |
647 |
r=clientThread.Create(_L("Test7Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest7); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
648 |
test_KErrNone(r); |
0 | 649 |
clientThread.Resume(); |
650 |
gSleepThread.Wait(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
651 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 652 |
|
653 |
r=TheFs.Delete(_L("Newfile.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
654 |
test_KErrNone(r); |
0 | 655 |
|
656 |
User::WaitForRequest(reqStat); |
|
657 |
||
658 |
gSleepThread.Close(); |
|
659 |
clientThread.Close(); |
|
660 |
} |
|
661 |
||
662 |
#if defined (__EPOC32__)//we have no removable media on Emulator yet |
|
663 |
static void MediaChangeExtendedNotification() |
|
664 |
// |
|
665 |
// Test media change notification |
|
666 |
// Always notified of media change - regardless of requested TNotifyType |
|
667 |
// |
|
668 |
{ |
|
669 |
TDriveInfo driveInfo; |
|
670 |
TInt r=TheFs.Drive(driveInfo,CurrentDrive()); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
671 |
test_KErrNone(r); |
0 | 672 |
// only test on removable media |
673 |
if (driveInfo.iDriveAtt&KDriveAttRemovable) |
|
674 |
{ |
|
675 |
test.Next(_L("Test Media change extended notification")); |
|
676 |
TRequestStatus reqStat=0; |
|
677 |
TFileName path = _L("\\F32-tst\\NOTIFY\\"); |
|
678 |
TInt r; |
|
679 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
680 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 681 |
r=gSleepThread.CreateLocal(0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
test_KErrNone(r); |
0 | 683 |
RThread clientThread; |
684 |
gSocketNumber=0; |
|
685 |
r=clientThread.Create(_L("Test6Thread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6); //only generates a media change on removable media |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
686 |
test_KErrNone(r); |
0 | 687 |
clientThread.Resume(); |
688 |
gSleepThread.Wait(); |
|
689 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
690 |
test_KErrNone(reqStat.Int()); |
0 | 691 |
WaitForMediaChange(); |
692 |
gSleepThread.Close(); |
|
693 |
clientThread.Close(); |
|
694 |
||
695 |
//-- it seems that after generating media change the meia driver isn't ready for some time |
|
696 |
User::After(2000000); |
|
697 |
r=TheFs.Drive(driveInfo,CurrentDrive()); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
698 |
test_KErrNone(r); |
0 | 699 |
|
700 |
||
701 |
TheFs.NotifyChange(ENotifyDisk,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
702 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 703 |
r=gSleepThread.CreateLocal(0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
704 |
test_KErrNone(r); |
0 | 705 |
r=clientThread.Create(_L("Test6Thread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
706 |
test_KErrNone(r); |
0 | 707 |
clientThread.Resume(); |
708 |
gSleepThread.Wait(); |
|
709 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
710 |
test_KErrNone(reqStat.Int()); |
0 | 711 |
WaitForMediaChange(); |
712 |
gSleepThread.Close(); |
|
713 |
clientThread.Close(); |
|
714 |
||
715 |
//-- it seems that after generating media change the meia driver isn't ready for some time |
|
716 |
User::After(2000000); |
|
717 |
r=TheFs.Drive(driveInfo,CurrentDrive()); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
718 |
test_KErrNone(r); |
0 | 719 |
|
720 |
TheFs.NotifyChange(ENotifyWrite,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
721 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 722 |
r=gSleepThread.CreateLocal(0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
723 |
test_KErrNone(r); |
0 | 724 |
r=clientThread.Create(_L("Test6Thread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
725 |
test_KErrNone(r); |
0 | 726 |
clientThread.Resume(); |
727 |
gSleepThread.Wait(); |
|
728 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
729 |
test_KErrNone(reqStat.Int()); |
0 | 730 |
WaitForMediaChange(); |
731 |
gSleepThread.Close(); |
|
732 |
clientThread.Close(); |
|
733 |
||
734 |
//-- it seems that after generating media change the meia driver isn't ready for some time |
|
735 |
User::After(2000000); |
|
736 |
r=TheFs.Drive(driveInfo,CurrentDrive()); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
737 |
test_KErrNone(r); |
0 | 738 |
|
739 |
} |
|
740 |
} |
|
741 |
#endif |
|
742 |
||
743 |
static void TestRequestAhead() |
|
744 |
// |
|
745 |
// Test extended notification works when path initially does not exist |
|
746 |
// |
|
747 |
{ |
|
748 |
test.Next(_L("Test Request Ahead")); |
|
749 |
// First a simple example |
|
750 |
||
751 |
TInt r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
752 |
test_Value(r, (r == KErrNotFound)||(r==KErrPathNotFound)||(r==KErrNone)); |
0 | 753 |
|
754 |
TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
|
755 |
TRequestStatus reqStat(KRequestPending); |
|
756 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
757 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 758 |
|
759 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
760 |
test_KErrNone(r); |
0 | 761 |
|
762 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
763 |
test_KErrNone(reqStat.Int()); |
0 | 764 |
|
765 |
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man"); |
|
766 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
767 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 768 |
|
769 |
RFile file; |
|
770 |
r=file.Replace(TheFs,path,EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
771 |
test_KErrNone(r); |
0 | 772 |
file.Close(); |
773 |
||
774 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
775 |
test_KErrNone(reqStat.Int()); |
0 | 776 |
|
777 |
r=TheFs.Delete(path); |
|
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 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
781 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 782 |
// Now cancel the outstanding request |
783 |
TheFs.NotifyChangeCancel(reqStat); |
|
784 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
785 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 786 |
|
787 |
// Repeat with a ENotifyFile request |
|
788 |
TheFs.NotifyChange(ENotifyFile,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
789 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 790 |
|
791 |
r=file.Replace(TheFs,path,EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
792 |
test_KErrNone(r); |
0 | 793 |
file.Close(); |
794 |
||
795 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
796 |
test_KErrNone(reqStat.Int()); |
0 | 797 |
|
798 |
r=TheFs.Delete(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
799 |
test_KErrNone(r); |
0 | 800 |
|
801 |
TheFs.NotifyChange(ENotifyFile,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
802 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 803 |
// Now cancel the outstanding request |
804 |
TheFs.NotifyChangeCancel(reqStat); |
|
805 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
806 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 807 |
|
808 |
// Repeat with an ENotifyAttributes request |
|
809 |
TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
810 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 811 |
|
812 |
r=file.Replace(TheFs,path,EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
813 |
test_KErrNone(r); |
0 | 814 |
file.Close(); |
815 |
||
816 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
817 |
test_KErrNone(reqStat.Int()); // Monitoring attributes but informed anyway |
0 | 818 |
|
819 |
r=TheFs.Delete(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
820 |
test_KErrNone(r); |
0 | 821 |
|
822 |
TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
823 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 824 |
// Now cancel the outstanding request |
825 |
TheFs.NotifyChangeCancel(reqStat); |
|
826 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
827 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 828 |
|
829 |
// Repeat with an ENotifyWrite request |
|
830 |
TheFs.NotifyChange(ENotifyWrite,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
831 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 832 |
|
833 |
r=file.Replace(TheFs,path,EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
834 |
test_KErrNone(r); |
0 | 835 |
file.Close(); |
836 |
||
837 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
838 |
test_KErrNone(reqStat.Int()); // Monitoring file writing but informed anyway |
0 | 839 |
|
840 |
r=TheFs.Delete(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
841 |
test_KErrNone(r); |
0 | 842 |
|
843 |
TheFs.NotifyChange(ENotifyWrite,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
844 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 845 |
// Now cancel the outstanding request |
846 |
TheFs.NotifyChangeCancel(reqStat); |
|
847 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
848 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 849 |
|
850 |
// Repeat with an ENotifyDisk request |
|
851 |
TheFs.NotifyChange(ENotifyDisk,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
852 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 853 |
|
854 |
r=file.Replace(TheFs,path,EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
855 |
test_KErrNone(r); |
0 | 856 |
file.Close(); |
857 |
||
858 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
859 |
test_KErrNone(reqStat.Int()); // Monitoring disk activity but informed anyway |
0 | 860 |
|
861 |
r=TheFs.Delete(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
862 |
test_KErrNone(r); |
0 | 863 |
|
864 |
TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
865 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 866 |
// Now cancel the outstanding request |
867 |
TheFs.NotifyChangeCancel(reqStat); |
|
868 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
869 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 870 |
|
871 |
// Now do much the same with directory monitoring |
|
872 |
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
|
873 |
TheFs.RmDir(path); |
|
874 |
||
875 |
TheFs.NotifyChange(ENotifyDir,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
876 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 877 |
|
878 |
TheFs.MkDir(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
879 |
test_KErrNone(r); |
0 | 880 |
|
881 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
882 |
test_KErrNone(reqStat.Int()); |
0 | 883 |
|
884 |
TheFs.RmDir(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
885 |
test_KErrNone(r); |
0 | 886 |
|
887 |
TheFs.NotifyChange(ENotifyDir,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
888 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
889 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 890 |
|
891 |
// Now cancel the outstanding request |
|
892 |
TheFs.NotifyChangeCancel(reqStat); |
|
893 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
894 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 895 |
|
896 |
TheFs.NotifyChange(ENotifyDir,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
897 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
898 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 899 |
|
900 |
// Get a separate thread to create the directory |
|
901 |
RThread thread; |
|
902 |
thread.Create(_L("RequestAheadyThready"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10); |
|
903 |
TRequestStatus thrdStat(KRequestPending); |
|
904 |
thread.Logon(thrdStat); |
|
905 |
thread.Resume(); |
|
906 |
thread.Close(); |
|
907 |
||
908 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
909 |
test_KErrNone(thrdStat.Int()); |
0 | 910 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
911 |
test_KErrNone(reqStat.Int()); |
0 | 912 |
|
913 |
TheFs.RmDir(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
914 |
test_KErrNone(r); |
0 | 915 |
|
916 |
// Check that notification is not received for a non-existent file if only the previously |
|
917 |
// non existent directory that contains it is created |
|
918 |
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man"); |
|
919 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
920 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
921 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 922 |
|
923 |
thread.Create(_L("RequestAheadThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10); |
|
924 |
thread.Logon(thrdStat); |
|
925 |
thread.Resume(); |
|
926 |
thread.Close(); |
|
927 |
||
928 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
929 |
test_KErrNone(thrdStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
930 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 931 |
|
932 |
// Now get a thread to create the file |
|
933 |
thread.Create(_L("RequestAhead"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest11); |
|
934 |
thread.Logon(thrdStat); |
|
935 |
thread.Resume(); |
|
936 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
937 |
test_KErrNone(thrdStat.Int()); |
0 | 938 |
thread.Close(); |
939 |
||
940 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
941 |
test_KErrNone(reqStat.Int()); |
0 | 942 |
|
943 |
TheFs.Delete(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
944 |
test_KErrNone(r); |
0 | 945 |
|
946 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
947 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
948 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 949 |
|
950 |
// Now cancel the outstanding request |
|
951 |
TheFs.NotifyChangeCancel(reqStat); |
|
952 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
953 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 954 |
|
955 |
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
|
956 |
TheFs.RmDir(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
957 |
test_KErrNone(r); |
0 | 958 |
} |
959 |
||
960 |
||
961 |
static void Test8() |
|
962 |
// |
|
963 |
// Test extended notification of an entry change |
|
964 |
// |
|
965 |
{ |
|
966 |
// Test notification of an entry change in directory F32-TST |
|
967 |
test.Next(_L("Test notification of an entry change")); |
|
968 |
TRequestStatus reqStat(KRequestPending); |
|
969 |
TRequestStatus thrdStat(KRequestPending); |
|
970 |
TFileName path=(_L("\\F32-TST\\")); |
|
971 |
||
972 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
973 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 974 |
RThread thread; |
975 |
TInt r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
976 |
test_KErrNone(r); |
0 | 977 |
thread.Logon(thrdStat); |
978 |
thread.Resume(); |
|
979 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
980 |
test_KErrNone(thrdStat.Int()); |
0 | 981 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
982 |
test_KErrNone(reqStat.Int()); |
0 | 983 |
thread.Close(); |
984 |
||
985 |
// Repeat the test |
|
986 |
test.Next(_L("Repeat Test notification of an entry change")); |
|
987 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
988 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 989 |
r=thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
990 |
test_KErrNone(r); |
0 | 991 |
thread.Logon(thrdStat); |
992 |
thread.Resume(); |
|
993 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
994 |
test_KErrNone(thrdStat.Int()); |
0 | 995 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
996 |
test_KErrNone(reqStat.Int()); |
0 | 997 |
thread.Close(); |
998 |
||
999 |
// Test it can be cancelled |
|
1000 |
test.Next(_L("Test Notify cancel")); |
|
1001 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1002 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1003 |
TheFs.NotifyChangeCancel(); |
1004 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1005 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 1006 |
|
1007 |
// Test it can be notified again |
|
1008 |
test.Next(_L("Test notification still works")); |
|
1009 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1010 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1011 |
r=thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1012 |
test_KErrNone(r); |
0 | 1013 |
thread.Logon(thrdStat); |
1014 |
thread.Resume(); |
|
1015 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1016 |
test_KErrNone(thrdStat.Int()); |
0 | 1017 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1018 |
test_KErrNone(reqStat.Int()); |
0 | 1019 |
thread.Close(); |
1020 |
||
1021 |
// Test notification doesn't occur when a change occurs above the directory monitored |
|
1022 |
// (Notification of rename events occurring above the directory which affect the path |
|
1023 |
// will occur - this is tested for in Test18()) |
|
1024 |
test.Next(_L("Test changing above monitored directory")); |
|
1025 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1026 |
test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists)); |
0 | 1027 |
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1028 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1029 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1030 |
r=thread.Create(_L("MyThread4"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1031 |
test_KErrNone(r); |
0 | 1032 |
thread.Logon(thrdStat); |
1033 |
thread.Resume(); |
|
1034 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1035 |
test_KErrNone(thrdStat.Int()); |
0 | 1036 |
User::After(500000); |
1037 |
thread.Close(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1038 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1039 |
TheFs.NotifyChangeCancel(); |
1040 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1041 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 1042 |
|
1043 |
// Test notification occurs when a change is made to the subdirectory monitored |
|
1044 |
test.Next(_L("Create a file in monitored subdirectory")); |
|
1045 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1046 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1047 |
r=thread.Create(_L("MyThread5"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1048 |
test_KErrNone(r); |
0 | 1049 |
thread.Logon(thrdStat); |
1050 |
thread.Resume(); |
|
1051 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1052 |
test_KErrNone(thrdStat.Int()); |
0 | 1053 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1054 |
test_KErrNone(reqStat.Int()); |
0 | 1055 |
thread.Close(); |
1056 |
||
1057 |
test.Next(_L("Create a directory in monitored subdirectory")); |
|
1058 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1059 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1060 |
r=thread.Create(_L("MyThread6"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1061 |
test_KErrNone(r); |
0 | 1062 |
thread.Logon(thrdStat); |
1063 |
thread.Resume(); |
|
1064 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1065 |
test_KErrNone(thrdStat.Int()); |
0 | 1066 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1067 |
test_KErrNone(reqStat.Int()); |
0 | 1068 |
thread.Close(); |
1069 |
||
1070 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1071 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1072 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1073 |
test_KErrNone(r); |
0 | 1074 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1075 |
test_KErrNone(reqStat.Int()); |
0 | 1076 |
|
1077 |
||
1078 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1079 |
test_KErrNone(r); |
0 | 1080 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1081 |
test_KErrNone(r); |
0 | 1082 |
|
1083 |
// Test again that notification doesn't occur above the subdirectory being monitored |
|
1084 |
test.Next(_L("Test changing above monitored directory")); |
|
1085 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1086 |
test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists)); |
0 | 1087 |
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1088 |
||
1089 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1090 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1091 |
r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1092 |
test_KErrNone(r); |
0 | 1093 |
thread.Logon(thrdStat); |
1094 |
thread.Resume(); |
|
1095 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1096 |
test_KErrNone(thrdStat.Int()); |
0 | 1097 |
User::After(500000); |
1098 |
thread.Close(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1099 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1100 |
TheFs.NotifyChangeCancel(); |
1101 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1102 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 1103 |
|
1104 |
// Test notification occurs when a change is made to the subdirectory monitored |
|
1105 |
test.Next(_L("Delete a file in monitored subdirectory")); |
|
1106 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1107 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1108 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1109 |
test_KErrNone(r); |
0 | 1110 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1111 |
test_KErrNone(reqStat.Int()); |
0 | 1112 |
|
1113 |
RFile file; |
|
1114 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1115 |
test_KErrNone(r); |
0 | 1116 |
file.Close(); |
1117 |
||
1118 |
// Test notification on a specific file |
|
1119 |
test.Next(_L("Monitor changes to a specific file")); |
|
1120 |
path+=_L("WickedWitch.msg"); |
|
1121 |
TheFs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1122 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1123 |
r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1124 |
test_KErrNone(r); |
0 | 1125 |
thread.Logon(thrdStat); |
1126 |
thread.Resume(); |
|
1127 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1128 |
test_KErrNone(thrdStat.Int()); |
0 | 1129 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1130 |
test_KErrNone(reqStat.Int()); |
0 | 1131 |
thread.Close(); |
1132 |
||
1133 |
// Test notification does not occur if a change is made above the file |
|
1134 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1135 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1136 |
thread.Create(_L("MyThread9"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2); |
1137 |
thread.Logon(thrdStat); |
|
1138 |
thread.Resume(); |
|
1139 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1140 |
test_KErrNone(thrdStat.Int()); |
0 | 1141 |
User::After(500000); |
1142 |
thread.Close(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1143 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1144 |
TheFs.NotifyChangeCancel(); |
1145 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1146 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 1147 |
|
1148 |
// Test notification occurs when a change is made to the file |
|
1149 |
test.Next(_L("Delete monitored file")); |
|
1150 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1151 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1152 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1153 |
test_KErrNone(r); |
0 | 1154 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1155 |
test_KErrNone(reqStat.Int()); |
0 | 1156 |
|
1157 |
// Test notification request is now submitted on the non existent path successfully |
|
1158 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1159 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1160 |
TheFs.NotifyChangeCancel(reqStat); |
1161 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1162 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 1163 |
|
1164 |
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"); |
|
1165 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1166 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1167 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1168 |
test_KErrNone(r); |
0 | 1169 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1170 |
test_KErrNone(reqStat.Int()); |
0 | 1171 |
|
1172 |
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
|
1173 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1174 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1175 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1176 |
test_KErrNone(r); |
0 | 1177 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1178 |
test_KErrNone(reqStat.Int()); |
0 | 1179 |
|
1180 |
// Submit a request for a path which does not yet exist |
|
1181 |
path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\"); |
|
1182 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1183 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1184 |
// Now create the directory we are waiting on |
1185 |
r=TheFs.MkDir(path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1186 |
test_KErrNone(r); |
0 | 1187 |
// Make sure the notification has now been received |
1188 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1189 |
test_KErrNone(reqStat.Int()); |
0 | 1190 |
|
1191 |
// Submit a request for a file which does not yet exist |
|
1192 |
path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\Red-Shoes.red"); |
|
1193 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1194 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1195 |
// Now create the file we are waiting on |
1196 |
r=file.Replace(TheFs,path,EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1197 |
test_KErrNone(r); |
0 | 1198 |
file.Close(); |
1199 |
// Make sure the notification has now been received |
|
1200 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1201 |
test_KErrNone(reqStat.Int()); |
0 | 1202 |
// Submit another notification request and delete the file |
1203 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1204 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1205 |
r=TheFs.Delete(path); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1206 |
test_KErrNone(r); |
0 | 1207 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1208 |
test_KErrNone(reqStat.Int()); |
0 | 1209 |
path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\"); |
1210 |
TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1211 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1212 |
r=TheFs.RmDir(path); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1213 |
test_KErrNone(r); |
0 | 1214 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1215 |
test_KErrNone(reqStat.Int()); |
0 | 1216 |
// test passing in an empty string |
1217 |
TheFs.NotifyChange(ENotifyEntry,reqStat,_L("")); |
|
1218 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1219 |
test_Value(reqStat.Int(), reqStat==KErrArgument); |
0 | 1220 |
} |
1221 |
||
1222 |
static void Test9() |
|
1223 |
// |
|
1224 |
// Test notify for multiple clients |
|
1225 |
// |
|
1226 |
{ |
|
1227 |
||
1228 |
test.Next(_L("Test notification of multiple clients")); |
|
1229 |
||
1230 |
// Create five sessions monitoring various levels of a directory tree |
|
1231 |
||
1232 |
TInt r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1233 |
test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists)); |
0 | 1234 |
RFile file; |
1235 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1236 |
test_KErrNone(r); |
0 | 1237 |
file.Close(); |
1238 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1239 |
test_KErrNone(r); |
0 | 1240 |
file.Close(); |
1241 |
||
1242 |
TFileName path1=_L("\\F32-TST\\"); |
|
1243 |
TFileName path2=_L("\\F32-TST\\NOTIFY\\"); |
|
1244 |
TFileName path3=_L("\\F32-TST\\NOTIFY\\ANIMAL\\"); |
|
1245 |
TFileName path4=_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"); |
|
1246 |
TFileName path5=_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"); |
|
1247 |
TFileName path6=_L("?:\\F32-TST\\"); |
|
1248 |
||
1249 |
TRequestStatus reqStat1(KRequestPending); |
|
1250 |
RFs fs1; |
|
1251 |
r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1252 |
test_KErrNone(r); |
0 | 1253 |
r=fs1.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1254 |
test_KErrNone(r); |
0 | 1255 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1256 |
||
1257 |
TRequestStatus reqStat2(KRequestPending); |
|
1258 |
RFs fs2; |
|
1259 |
r=fs2.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1260 |
test_KErrNone(r); |
0 | 1261 |
r=fs2.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1262 |
test_KErrNone(r); |
0 | 1263 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1264 |
||
1265 |
TRequestStatus reqStat3(KRequestPending); |
|
1266 |
RFs fs3; |
|
1267 |
r=fs3.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1268 |
test_KErrNone(r); |
0 | 1269 |
r=fs3.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1270 |
test_KErrNone(r); |
0 | 1271 |
fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1272 |
||
1273 |
TRequestStatus reqStat4(KRequestPending); |
|
1274 |
RFs fs4; |
|
1275 |
r=fs4.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1276 |
test_KErrNone(r); |
0 | 1277 |
r=fs4.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1278 |
test_KErrNone(r); |
0 | 1279 |
fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
1280 |
||
1281 |
TRequestStatus reqStat5(KRequestPending); |
|
1282 |
RFs fs5; |
|
1283 |
r=fs5.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1284 |
test_KErrNone(r); |
0 | 1285 |
r=fs5.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1286 |
test_KErrNone(r); |
0 | 1287 |
fs5.NotifyChange(ENotifyEntry,reqStat5,path5); |
1288 |
||
1289 |
TRequestStatus reqStat6(KRequestPending); |
|
1290 |
RFs fs6; |
|
1291 |
r=fs6.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1292 |
test_KErrNone(r); |
0 | 1293 |
r=fs6.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1294 |
test_KErrNone(r); |
0 | 1295 |
fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1296 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1297 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1298 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1299 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1300 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1301 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1302 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
0 | 1303 |
|
1304 |
// Make a change a the top level and check that only the session monitoring |
|
1305 |
// that level is notified |
|
1306 |
test.Next(_L("Test only client monitoring top level is notified")); |
|
1307 |
r=file.Replace(TheFs,_L("\\F32-TST\\NewFile.txt"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1308 |
test_KErrNone(r); |
0 | 1309 |
file.Close(); |
1310 |
User::WaitForRequest(reqStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1311 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1312 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1313 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1314 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1315 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
0 | 1316 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1317 |
test_KErrNone(reqStat6.Int()); |
0 | 1318 |
|
1319 |
r=TheFs.Delete(_L("\\F32-TST\\NewFile.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1320 |
test_KErrNone(r); |
0 | 1321 |
|
1322 |
// Renew the notify request at the top level and make a change one step lower |
|
1323 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
|
1324 |
fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1325 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1326 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
0 | 1327 |
|
1328 |
test.Next(_L("Test clients monitoring levels 1 and 2 are notified")); |
|
1329 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1330 |
test_KErrNone(r); |
0 | 1331 |
file.Close(); |
1332 |
||
1333 |
User::WaitForRequest(reqStat1); |
|
1334 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1335 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1336 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1337 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1338 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1339 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
0 | 1340 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1341 |
test_KErrNone(reqStat6.Int()); |
0 | 1342 |
|
1343 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NewFile.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1344 |
test_KErrNone(r); |
0 | 1345 |
|
1346 |
// Renew the notify request at the top and second levels and make a change |
|
1347 |
// one step lower still |
|
1348 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
|
1349 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
1350 |
fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1351 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1352 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1353 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
0 | 1354 |
|
1355 |
test.Next(_L("Test clients monitoring levels 1,2 and 3 are notified")); |
|
1356 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1357 |
test_KErrNone(r); |
0 | 1358 |
file.Close(); |
1359 |
||
1360 |
User::WaitForRequest(reqStat1); |
|
1361 |
User::WaitForRequest(reqStat2); |
|
1362 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1363 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1364 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1365 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1366 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1367 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
0 | 1368 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1369 |
test_KErrNone(reqStat6.Int()); |
0 | 1370 |
|
1371 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1372 |
test_KErrNone(r); |
0 | 1373 |
|
1374 |
// Renew the notify request at the top, second and third levels and make a change |
|
1375 |
// one step lower still |
|
1376 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
|
1377 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
1378 |
fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
|
1379 |
fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1380 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1381 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1382 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1383 |
test_Value(reqStat4.Int(), reqStat6==KRequestPending); |
0 | 1384 |
|
1385 |
test.Next(_L("Test clients monitoring levels 1 - 4 are notified")); |
|
1386 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1387 |
test_KErrNone(r); |
0 | 1388 |
User::WaitForRequest(reqStat1); |
1389 |
User::WaitForRequest(reqStat2); |
|
1390 |
User::WaitForRequest(reqStat3); |
|
1391 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1392 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1393 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1394 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1395 |
test_KErrNone(reqStat4.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1396 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
0 | 1397 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1398 |
test_KErrNone(reqStat6.Int()); |
0 | 1399 |
|
1400 |
// Renew the notify request at the top, second and third levels and on the file deleted above |
|
1401 |
// which will be successful, but will not complete (for obvious reasons) |
|
1402 |
||
1403 |
// Make a change one step lower still |
|
1404 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
|
1405 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
1406 |
fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
|
1407 |
fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
|
1408 |
fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1409 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1410 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1411 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1412 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1413 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
0 | 1414 |
|
1415 |
test.Next(_L("Test clients monitoring levels 1 - 3 and 5 are notified")); |
|
1416 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1417 |
test_KErrNone(r); |
0 | 1418 |
User::WaitForRequest(reqStat1); |
1419 |
User::WaitForRequest(reqStat2); |
|
1420 |
User::WaitForRequest(reqStat3); |
|
1421 |
// Don't wait for reqStat4 |
|
1422 |
User::WaitForRequest(reqStat5); |
|
1423 |
User::WaitForRequest(reqStat6); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1424 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1425 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1426 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1427 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); // File does not exist |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1428 |
test_KErrNone(reqStat5.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1429 |
test_KErrNone(reqStat6.Int()); |
0 | 1430 |
|
1431 |
fs4.NotifyChangeCancel(reqStat4); |
|
1432 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1433 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 1434 |
// Renew the notify request at the top, second and third levels and attempt to renew |
1435 |
// the request on the files deleted above (which will fail). |
|
1436 |
||
1437 |
test.Next(_L("Test clients monitoring levels 1 - 3 are notified")); |
|
1438 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
|
1439 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
1440 |
fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
|
1441 |
fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
|
1442 |
fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
|
1443 |
fs5.NotifyChange(ENotifyEntry,reqStat5,path5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1444 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1445 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1446 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1447 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1448 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1449 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
0 | 1450 |
|
1451 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1452 |
test_KErrNone(r); |
0 | 1453 |
User::WaitForRequest(reqStat1); |
1454 |
User::WaitForRequest(reqStat2); |
|
1455 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1456 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1457 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1458 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1459 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1460 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
0 | 1461 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1462 |
test_KErrNone(reqStat6.Int()); |
0 | 1463 |
|
1464 |
// Renew the notify request at the top and second levels on the third level |
|
1465 |
// which was removed - it'll succeed but won't complete. |
|
1466 |
||
1467 |
test.Next(_L("Test clients monitoring levels 1 and 2 are notified")); |
|
1468 |
test.Next(_L("Test clients' attempts to monitor levels 3-5 fail")); |
|
1469 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
|
1470 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
1471 |
fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
|
1472 |
fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
|
1473 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1474 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1475 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1476 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1477 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1478 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1479 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
0 | 1480 |
|
1481 |
fs1.NotifyChangeCancel(); |
|
1482 |
fs2.NotifyChangeCancel(); |
|
1483 |
||
1484 |
fs1.Close(); |
|
1485 |
fs2.Close(); |
|
1486 |
// Close the other sessions with requests outstanding to test that there's no evilness |
|
1487 |
fs3.Close(); |
|
1488 |
fs4.Close(); |
|
1489 |
fs5.Close(); |
|
1490 |
fs6.Close(); |
|
1491 |
||
1492 |
User::WaitForRequest(reqStat1); |
|
1493 |
User::WaitForRequest(reqStat2); |
|
1494 |
// Closing file server sessions doesn't seem to complete notifications, is this a bug? |
|
1495 |
// User::WaitForRequest(reqStat3); |
|
1496 |
// User::WaitForRequest(reqStat4); |
|
1497 |
// User::WaitForRequest(reqStat5); |
|
1498 |
// User::WaitForRequest(reqStat6); |
|
1499 |
} |
|
1500 |
||
1501 |
static void Test10() |
|
1502 |
// |
|
1503 |
// Test notify cancel |
|
1504 |
// |
|
1505 |
{ |
|
1506 |
||
1507 |
test.Next(_L("Cancel notification request using simple function")); |
|
1508 |
TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
|
1509 |
RFs fs1; |
|
1510 |
TInt r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1511 |
test_KErrNone(r); |
0 | 1512 |
r=fs1.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1513 |
test_KErrNone(r); |
0 | 1514 |
|
1515 |
TRequestStatus status1; |
|
1516 |
TRequestStatus status2; |
|
1517 |
TRequestStatus status3; |
|
1518 |
TRequestStatus status4; |
|
1519 |
TRequestStatus status5; |
|
1520 |
||
1521 |
fs1.NotifyChange(ENotifyAll,status1,path); |
|
1522 |
fs1.NotifyChange(ENotifyAll,status2,path); |
|
1523 |
fs1.NotifyChange(ENotifyAll,status3,path); |
|
1524 |
fs1.NotifyChange(ENotifyAll,status4,path); |
|
1525 |
fs1.NotifyChange(ENotifyAll,status5,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1526 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1527 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1528 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1529 |
test_Value(status4.Int(), status4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1530 |
test_Value(status5.Int(), status5==KRequestPending); |
0 | 1531 |
|
1532 |
test.Next(_L("RFs::NotifyCancel()")); |
|
1533 |
// Test that one call to RFs::NotifyCancel() cancels all outstanding requests |
|
1534 |
fs1.NotifyChangeCancel(); |
|
1535 |
User::WaitForRequest(status1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1536 |
test_Value(status1.Int(), status1==KErrCancel); |
0 | 1537 |
User::WaitForRequest(status2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1538 |
test_Value(status2.Int(), status2==KErrCancel); |
0 | 1539 |
User::WaitForRequest(status3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1540 |
test_Value(status3.Int(), status3==KErrCancel); |
0 | 1541 |
User::WaitForRequest(status4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1542 |
test_Value(status4.Int(), status4==KErrCancel); |
0 | 1543 |
User::WaitForRequest(status5); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1544 |
test_Value(status5.Int(), status5==KErrCancel); |
0 | 1545 |
// Call the cancel function again to check no further action |
1546 |
fs1.NotifyChangeCancel(); |
|
1547 |
||
1548 |
// Test overloaded function to cancel a single request |
|
1549 |
test.Next(_L("Cancel notification request using function overload")); |
|
1550 |
fs1.NotifyChange(ENotifyAll,status1,path); |
|
1551 |
fs1.NotifyChange(ENotifyAll,status2,path); |
|
1552 |
fs1.NotifyChange(ENotifyAll,status3,path); |
|
1553 |
fs1.NotifyChange(ENotifyAll,status4,path); |
|
1554 |
fs1.NotifyChange(ENotifyAll,status5,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1555 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1556 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1557 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1558 |
test_Value(status4.Int(), status4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1559 |
test_Value(status5.Int(), status5==KRequestPending); |
0 | 1560 |
|
1561 |
// Cancel the outstanding request with status5 |
|
1562 |
test.Next(_L("RFs::NotifyCancel()")); |
|
1563 |
fs1.NotifyChangeCancel(status5); |
|
1564 |
User::WaitForRequest(status5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1565 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1566 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1567 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1568 |
test_Value(status4.Int(), status4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1569 |
test_Value(status5.Int(), status5==KErrCancel); |
0 | 1570 |
|
1571 |
r=TheFs.MkDir(_L("\\F32-TST\\TROPICANA\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1572 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1573 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1574 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1575 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1576 |
test_Value(status4.Int(), status4==KRequestPending); |
0 | 1577 |
|
1578 |
fs1.NotifyChangeCancel(status2); |
|
1579 |
User::WaitForRequest(status2); |
|
1580 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1581 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1582 |
test_Value(status2.Int(), status2==KErrCancel); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1583 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1584 |
test_Value(status4.Int(), status4==KRequestPending); |
0 | 1585 |
|
1586 |
r=TheFs.RmDir(_L("\\F32-TST\\TROPICANA\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1587 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1588 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1589 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1590 |
test_Value(status4.Int(), status4==KRequestPending); |
0 | 1591 |
|
1592 |
fs1.NotifyChangeCancel(status4); |
|
1593 |
User::WaitForRequest(status4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1594 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1595 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1596 |
test_Value(status4.Int(), status4==KErrCancel); |
0 | 1597 |
|
1598 |
fs1.NotifyChangeCancel(status4); // Test no side effects on trying to cancel a request |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1599 |
test_Value(status4.Int(), status4==KErrCancel); // that has already been cancelled |
0 | 1600 |
|
1601 |
fs1.NotifyChangeCancel(status1); |
|
1602 |
User::WaitForRequest(status1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1603 |
test_Value(status1.Int(), status1==KErrCancel); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1604 |
test_Value(status3.Int(), status3==KRequestPending); |
0 | 1605 |
fs1.NotifyChangeCancel(status1); // Test no side effects on trying to cancel a request |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1606 |
test_Value(status1.Int(), status1==KErrCancel); // that has already been cancelled |
0 | 1607 |
|
1608 |
fs1.NotifyChangeCancel(status3); |
|
1609 |
User::WaitForRequest(status3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1610 |
test_Value(status3.Int(), status3==KErrCancel); |
0 | 1611 |
|
1612 |
fs1.Close(); |
|
1613 |
} |
|
1614 |
||
1615 |
static void Test11() |
|
1616 |
// |
|
1617 |
// Test notify client death |
|
1618 |
// |
|
1619 |
{ |
|
1620 |
||
1621 |
test.Next(_L("Kill client while it is monitoring changes to a directory")); |
|
1622 |
// Call CreateLocal to create RSemaphore gSleepThread which is local to this process |
|
1623 |
TInt r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1624 |
test_KErrNone(r); |
0 | 1625 |
|
1626 |
RThread clientThread; |
|
1627 |
r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest9); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1628 |
test_KErrNone(r); |
0 | 1629 |
clientThread.Resume(); |
1630 |
gSleepThread.Wait(); // Wait for gSleepThread to be signalled |
|
1631 |
// Client thread is waiting for notification of changes |
|
1632 |
// to directory \\F32-TST\\NOTIFY |
|
1633 |
||
1634 |
TBool jit = User::JustInTime(); |
|
1635 |
User::SetJustInTime(EFalse); |
|
1636 |
clientThread.Panic(_L("Test client thread panic"),KErrGeneral); // Panic client |
|
1637 |
User::SetJustInTime(jit); |
|
1638 |
||
1639 |
clientThread.Close(); |
|
1640 |
||
1641 |
// Make a change and check there's no disaster |
|
1642 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1643 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 1644 |
MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt")); |
1645 |
User::After(1000); |
|
1646 |
} |
|
1647 |
||
1648 |
||
1649 |
static void Test12() |
|
1650 |
// |
|
1651 |
// Test reads and writes do not cause notification under ENotifyEntry |
|
1652 |
// Test reads and writes do cause notification under ENotifyAll |
|
1653 |
// |
|
1654 |
{ |
|
1655 |
||
1656 |
test.Next(_L("Test reads and writes do not cause notification under ENotifyEntry")); |
|
1657 |
||
1658 |
RFile file; |
|
1659 |
TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1660 |
test_KErrNone(r); |
0 | 1661 |
file.Close(); |
1662 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1663 |
test_KErrNone(r); |
0 | 1664 |
file.Close(); |
1665 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1666 |
test_KErrNone(r); |
0 | 1667 |
file.Close(); |
1668 |
||
1669 |
TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
|
1670 |
TRequestStatus reqStat1(KRequestPending); |
|
1671 |
RFs fs1; |
|
1672 |
r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1673 |
test_KErrNone(r); |
0 | 1674 |
r=fs1.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1675 |
test_KErrNone(r); |
0 | 1676 |
fs1.NotifyChange(ENotifyEntry,reqStat1,path); |
1677 |
||
1678 |
TRequestStatus reqStat2(KRequestPending); |
|
1679 |
RFs fs2; |
|
1680 |
r=fs2.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1681 |
test_KErrNone(r); |
0 | 1682 |
r=fs2.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1683 |
test_KErrNone(r); |
0 | 1684 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path); |
1685 |
||
1686 |
TRequestStatus reqStat3(KRequestPending); |
|
1687 |
RFs fs3; |
|
1688 |
r=fs3.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1689 |
test_KErrNone(r); |
0 | 1690 |
r=fs3.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1691 |
test_KErrNone(r); |
0 | 1692 |
fs3.NotifyChange(ENotifyEntry,reqStat3,path); |
1693 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1694 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1695 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1696 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 1697 |
|
1698 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1699 |
test_KErrNone(r); |
0 | 1700 |
RThread thread1; |
1701 |
r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1702 |
test_KErrNone(r); |
0 | 1703 |
thread1.Resume(); |
1704 |
gSleepThread.Wait(); |
|
1705 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1706 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1707 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1708 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 1709 |
|
1710 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1711 |
test_KErrNone(r); |
0 | 1712 |
User::WaitForRequest(reqStat1); |
1713 |
User::WaitForRequest(reqStat2); |
|
1714 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1715 |
test_KErrNone(reqStat1.Int()); // All three notifications occur because they |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1716 |
test_KErrNone(reqStat2.Int()); // are all monitoring the top level directory |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1717 |
test_KErrNone(reqStat3.Int()); // Later, we'll test monitoring individual files... |
0 | 1718 |
|
1719 |
gSleepThread.Close(); |
|
1720 |
thread1.Close(); |
|
1721 |
||
1722 |
test.Next(_L("Test reads and writes do cause notification under ENotifyAll")); |
|
1723 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1724 |
test_KErrNone(r); |
0 | 1725 |
file.Close(); |
1726 |
||
1727 |
fs1.NotifyChange(ENotifyAll,reqStat1,path); |
|
1728 |
fs2.NotifyChange(ENotifyAll,reqStat2,path); |
|
1729 |
fs3.NotifyChange(ENotifyAll,reqStat3,path); |
|
1730 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1731 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1732 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1733 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 1734 |
|
1735 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1736 |
test_KErrNone(r); |
0 | 1737 |
RThread thread2; |
1738 |
r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1739 |
test_KErrNone(r); |
0 | 1740 |
thread2.Resume(); |
1741 |
gSleepThread.Wait(); |
|
1742 |
||
1743 |
User::WaitForRequest(reqStat1); |
|
1744 |
User::WaitForRequest(reqStat2); |
|
1745 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1746 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1747 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1748 |
test_KErrNone(reqStat3.Int()); |
0 | 1749 |
|
1750 |
gSleepThread.Close(); |
|
1751 |
thread2.Close(); |
|
1752 |
||
1753 |
test.Next(_L("Monitor reads and writes on specific files with either TNotifyType")); |
|
1754 |
TFileName path1=path; |
|
1755 |
TFileName path2=path; |
|
1756 |
TFileName path3=path; |
|
1757 |
path1+=_L("kangaroo.txt"); |
|
1758 |
path2+=_L("koala.txt"); |
|
1759 |
path3+=_L("dingo.txt"); |
|
1760 |
||
1761 |
fs1.NotifyChange(ENotifyAll,reqStat1,path1); |
|
1762 |
fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
1763 |
fs3.NotifyChange(ENotifyAll,reqStat3,path3); |
|
1764 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1765 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1766 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1767 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 1768 |
|
1769 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1770 |
test_KErrNone(r); |
0 | 1771 |
RThread thread3; |
1772 |
r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1773 |
test_KErrNone(r); |
0 | 1774 |
thread3.Resume(); |
1775 |
gSleepThread.Wait(); |
|
1776 |
||
1777 |
User::WaitForRequest(reqStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1778 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1779 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyEntry |
0 | 1780 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1781 |
test_KErrNone(reqStat3.Int()); |
0 | 1782 |
|
1783 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1784 |
test_KErrNone(r); |
0 | 1785 |
User::WaitForRequest(reqStat2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1786 |
test_KErrNone(reqStat2.Int()); |
0 | 1787 |
|
1788 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1789 |
test_KErrNone(r); |
0 | 1790 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1791 |
test_KErrNone(r); |
0 | 1792 |
|
1793 |
gSleepThread.Close(); |
|
1794 |
thread3.Close(); |
|
1795 |
fs1.Close(); |
|
1796 |
fs2.Close(); |
|
1797 |
fs3.Close(); |
|
1798 |
} |
|
1799 |
||
1800 |
||
1801 |
static void Test13() |
|
1802 |
// |
|
1803 |
// Test file notification |
|
1804 |
// |
|
1805 |
{ |
|
1806 |
RFs fs; // Session to be notified of any changes |
|
1807 |
TInt r=fs.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1808 |
test_KErrNone(r); |
0 | 1809 |
r=fs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1810 |
test_KErrNone(r); |
0 | 1811 |
|
1812 |
||
1813 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1814 |
test_Value(r, r == KErrNone||r==KErrAlreadyExists); |
0 | 1815 |
|
1816 |
RFile file; |
|
1817 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1818 |
test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
0 | 1819 |
file.Close(); |
1820 |
||
1821 |
// Test notification on a specific file |
|
1822 |
test.Next(_L("Monitor changes to a specific file")); |
|
1823 |
TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"); |
|
1824 |
TRequestStatus reqStat(KRequestPending); |
|
1825 |
TRequestStatus thrdStat(KRequestPending); |
|
1826 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1827 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1828 |
RThread thread; |
1829 |
r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1830 |
test_KErrNone(r); |
0 | 1831 |
thread.Logon(thrdStat); |
1832 |
thread.Resume(); |
|
1833 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1834 |
test_KErrNone(thrdStat.Int()); |
0 | 1835 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1836 |
test_KErrNone(reqStat.Int()); |
0 | 1837 |
thread.Close(); |
1838 |
// Test notification does not occur if a change is made above the file |
|
1839 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1840 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1841 |
r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1842 |
test_KErrNone(r); |
0 | 1843 |
thread.Logon(thrdStat); |
1844 |
thread.Resume(); |
|
1845 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1846 |
test_KErrNone(thrdStat.Int()); |
0 | 1847 |
User::After(500000); |
1848 |
thread.Close(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1849 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1850 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1851 |
test_KErrNone(r); |
0 | 1852 |
|
1853 |
// Test notification does not occur if a change is made to another file |
|
1854 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1855 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1856 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1857 |
file.Close(); |
1858 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1859 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1860 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1861 |
|
1862 |
||
1863 |
// Test notification occurs when a change is made to the file |
|
1864 |
test.Next(_L("Delete monitored file")); |
|
1865 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1866 |
test_KErrNone(r); |
0 | 1867 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1868 |
test_KErrNone(reqStat.Int()); |
0 | 1869 |
|
1870 |
fs.Close(); |
|
1871 |
} |
|
1872 |
||
1873 |
static void Test14() |
|
1874 |
||
1875 |
{ |
|
1876 |
// |
|
1877 |
// Test notification request succeeds with all RFile and RFs operations which result in |
|
1878 |
// notifications |
|
1879 |
// |
|
1880 |
RFs fs; |
|
1881 |
TInt r=fs.Connect(); // Session to be notified of any changes |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1882 |
test_KErrNone(r); |
0 | 1883 |
r=fs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1884 |
test_KErrNone(r); |
0 | 1885 |
|
1886 |
// RFile::Write() to a file within the monitored directory |
|
1887 |
test.Next(_L("RFile::Write()")); |
|
1888 |
TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"); |
|
1889 |
TRequestStatus reqStat(KRequestPending); |
|
1890 |
||
1891 |
RFile file; |
|
1892 |
||
1893 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1894 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1895 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1896 |
test_KErrNone(r); |
0 | 1897 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1898 |
test_KErrNone(reqStat.Int()); |
0 | 1899 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1900 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1901 |
r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1902 |
test_KErrNone(r); |
0 | 1903 |
file.Close(); |
1904 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1905 |
test_KErrNone(reqStat.Int()); |
0 | 1906 |
|
1907 |
// RFile::Read() a file within the monitored directory - no notification for reads |
|
1908 |
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
|
1909 |
TBuf8<100> temp; |
|
1910 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1911 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1912 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1913 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1914 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1915 |
r=file.Read(0,temp,100); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1916 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1917 |
|
1918 |
// RFile::SetAtt() of a file within the monitored directory |
|
1919 |
test.Next(_L("RFile::SetAtt()")); |
|
1920 |
r=file.SetAtt(KEntryAttSystem,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1921 |
test_KErrNone(r); |
0 | 1922 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1923 |
test_KErrNone(reqStat.Int()); |
0 | 1924 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1925 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1926 |
|
1927 |
// RFile::SetSize() of a file within the monitored directory |
|
1928 |
test.Next(_L("RFile::SetSize()")); |
|
1929 |
r=file.SetSize(256); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1930 |
test_KErrNone(r); |
0 | 1931 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1932 |
test_KErrNone(reqStat.Int()); |
0 | 1933 |
file.Close(); |
1934 |
||
1935 |
// RFile::Temp() to create a temp file within the monitored directory |
|
1936 |
test.Next(_L("RFile::Temp()")); |
|
1937 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1938 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1939 |
TFileName fileName; |
1940 |
r=file.Temp(TheFs,path,fileName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1941 |
test_KErrNone(r); |
0 | 1942 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1943 |
test_KErrNone(reqStat.Int()); |
0 | 1944 |
file.Close(); |
1945 |
||
1946 |
// RFile::SetModified() to change modification time of a file within monitored dir |
|
1947 |
test.Next(_L("RFile::SetModified()")); |
|
1948 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1949 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1950 |
TTime now; |
1951 |
now.HomeTime(); |
|
1952 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1953 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1954 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1955 |
file.SetModified(now); |
1956 |
file.Close(); |
|
1957 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1958 |
test_KErrNone(reqStat.Int()); |
0 | 1959 |
|
1960 |
// RFs::SetEntry() to change a directory entry within the monitored directory |
|
1961 |
test.Next(_L("RFs::SetEntry()")); |
|
1962 |
TEntry entry; |
|
1963 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
1964 |
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1965 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1966 |
now.HomeTime(); |
1967 |
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1968 |
test_KErrNone(r); |
0 | 1969 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1970 |
test_KErrNone(reqStat.Int()); |
0 | 1971 |
|
1972 |
// RFile::Set() to change file's modification time and attributes |
|
1973 |
test.Next(_L("RFile::Set()")); |
|
1974 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
1975 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1976 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1977 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1978 |
now.HomeTime(); |
1979 |
r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
|
1980 |
file.Close(); |
|
1981 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1982 |
test_KErrNone(reqStat.Int()); |
0 | 1983 |
|
1984 |
// RFs::SetDriveName() |
|
1985 |
test.Next(_L("RFs::SetDriveName()")); |
|
1986 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1987 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1988 |
User::After(KNotifyChangeAfter); |
1989 |
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1990 |
test_KErrNone(r); |
0 | 1991 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1992 |
test_KErrNone(reqStat.Int()); |
0 | 1993 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
1994 |
User::After(KNotifyChangeAfter); |
|
1995 |
r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1996 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1997 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 1998 |
fs.NotifyChangeCancel(reqStat); |
1999 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2000 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2001 |
fs.NotifyChange(ENotifyDisk,reqStat,path); |
2002 |
User::After(KNotifyChangeAfter); |
|
2003 |
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2004 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2005 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2006 |
fs.NotifyChangeCancel(reqStat); |
2007 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2008 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2009 |
|
2010 |
||
2011 |
// RFs::MkDir() |
|
2012 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2013 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2014 |
test.Next(_L("RFs::MkDir()")); |
2015 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2016 |
test_KErrNone(r); |
0 | 2017 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2018 |
test_KErrNone(reqStat.Int()); |
0 | 2019 |
|
2020 |
// RFs::RmDir() |
|
2021 |
test.Next(_L("RFs::RmDir()")); |
|
2022 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2023 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2024 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2025 |
test_KErrNone(r); |
0 | 2026 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2027 |
test_KErrNone(reqStat.Int()); |
0 | 2028 |
|
2029 |
// RFile::Create() |
|
2030 |
test.Next(_L("RFile::Create()")); |
|
2031 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2032 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2033 |
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2034 |
test_KErrNone(r); |
0 | 2035 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2036 |
test_KErrNone(reqStat.Int()); |
0 | 2037 |
file.Close(); |
2038 |
||
2039 |
// RFs::Delete() |
|
2040 |
test.Next(_L("RFs::Delete()")); |
|
2041 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2042 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2043 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2044 |
test_KErrNone(r); |
0 | 2045 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2046 |
test_KErrNone(reqStat.Int()); |
0 | 2047 |
|
2048 |
// RFile::Replace() |
|
2049 |
test.Next(_L("RFile::Replace()")); |
|
2050 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2051 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2052 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2053 |
test_KErrNone(r); |
0 | 2054 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2055 |
test_KErrNone(reqStat.Int()); |
0 | 2056 |
file.Close(); |
2057 |
||
2058 |
// RFs::Delete() |
|
2059 |
test.Next(_L("RFs::Delete()")); |
|
2060 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2061 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2062 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2063 |
test_KErrNone(r); |
0 | 2064 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2065 |
test_KErrNone(reqStat.Int()); |
0 | 2066 |
|
2067 |
// RFs::SetVolumeLabel() - should only be notification when monitoring relevant TNotifyTypes |
|
2068 |
test.Next(_L("RFs::SetVolumeLabel")); |
|
2069 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2070 |
||
2071 |
TInt driveNum=CurrentDrive(); |
|
2072 |
TVolumeInfo volInfo; |
|
2073 |
TFileName currentVolName; |
|
2074 |
||
2075 |
r=TheFs.Volume(volInfo,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2076 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2077 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2078 |
currentVolName=volInfo.iName; |
2079 |
||
2080 |
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
|
2081 |
if (r==KErrNone) |
|
2082 |
{ |
|
2083 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2084 |
test_KErrNone(reqStat.Int()); |
0 | 2085 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2086 |
test_KErrNone(r); |
0 | 2087 |
test(volInfo.iName==_L("VOL")); |
2088 |
// Test notification occurs under ENotifyDisk |
|
2089 |
fs.NotifyChange(ENotifyDisk,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2090 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2091 |
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2092 |
test_KErrNone(r); |
0 | 2093 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2094 |
test_KErrNone(reqStat.Int()); |
0 | 2095 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2096 |
test_KErrNone(r); |
0 | 2097 |
|
2098 |
test(volInfo.iName==_L("ABCDEFGHIJK")); |
|
2099 |
||
2100 |
// Test notification does not occur under ENotifyAttributes |
|
2101 |
fs.NotifyChange(ENotifyAttributes,reqStat,path); |
|
2102 |
r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2103 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2104 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2105 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2106 |
test_KErrNone(r); |
0 | 2107 |
|
2108 |
test(volInfo.iName==_L("TROPICANA")); |
|
2109 |
||
2110 |
fs.NotifyChangeCancel(reqStat); |
|
2111 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2112 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2113 |
// Test notification occurs under ENotifyEntry |
2114 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2115 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2116 |
r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2117 |
test_KErrNone(r); |
0 | 2118 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2119 |
test_KErrNone(reqStat.Int()); |
0 | 2120 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2121 |
test_KErrNone(r); |
0 | 2122 |
test(volInfo.iName==currentVolName); |
2123 |
} |
|
2124 |
||
2125 |
else // RFs::SetVolumeLabel() doesn't work on subst drives |
|
2126 |
{ |
|
2127 |
fs.NotifyChangeCancel(); |
|
2128 |
User::WaitForRequest(reqStat); |
|
2129 |
test.Printf(_L("Cannot set volume label on a substed drive\n")); |
|
2130 |
} |
|
2131 |
||
2132 |
||
2133 |
// RFs::Rename() |
|
2134 |
||
2135 |
test.Next(_L("RFs::Rename()")); |
|
2136 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2137 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2138 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2139 |
test_KErrNone(r); |
0 | 2140 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2141 |
test_KErrNone(reqStat.Int()); |
0 | 2142 |
|
2143 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2144 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2145 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2146 |
if(!Is_SimulatedSystemDrive(TheFs,driveNum)) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2147 |
{// Skip emulator/PlatSim drive C: |
0 | 2148 |
test.Next(_L("RFs::Rename() with max path length")); |
2149 |
TFileName longName=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
|
2150 |
while(longName.Length()<(KMaxFileName-2)) |
|
2151 |
longName+=_L("a"); |
|
2152 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),longName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2153 |
test_KErrNone(r); |
0 | 2154 |
fs.NotifyChange(ENotifyEntry,reqStat,longName); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2155 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2156 |
r=TheFs.Rename(longName,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2157 |
test_KErrNone(r); |
0 | 2158 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2159 |
test_KErrNone(reqStat.Int()); |
0 | 2160 |
} |
2161 |
||
2162 |
fs.Close(); |
|
2163 |
} |
|
2164 |
||
2165 |
||
2166 |
static void Test15() |
|
2167 |
||
2168 |
{ |
|
2169 |
// |
|
2170 |
// Repeat Test15 operations in a subtree of that monitored, and ensure notification |
|
2171 |
// occurs for a variety of RFile and RFs operations |
|
2172 |
// |
|
2173 |
RFs fs; // Session to be notified when a change occurs |
|
2174 |
TInt r=fs.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2175 |
test_KErrNone(r); |
0 | 2176 |
r=fs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2177 |
test_KErrNone(r); |
0 | 2178 |
|
2179 |
// RFile::Write() to a file in the subtree |
|
2180 |
test.Next(_L("RFile::Write()")); |
|
2181 |
TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
|
2182 |
TRequestStatus reqStat(KRequestPending); |
|
2183 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2184 |
||
2185 |
RFile file; |
|
2186 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2187 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2188 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2189 |
r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2190 |
file.Close(); |
|
2191 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2192 |
test_KErrNone(reqStat.Int()); |
0 | 2193 |
|
2194 |
// RFile::Read() a file within the monitored directory - no notification for reads |
|
2195 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2196 |
TBuf8<100> temp; |
|
2197 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2198 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2199 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2200 |
r=file.Read(0,temp,100); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2201 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2202 |
|
2203 |
// RFile::SetAtt() of a file within the monitored directory |
|
2204 |
test.Next(_L("RFile::SetAtt()")); |
|
2205 |
r=file.SetAtt(KEntryAttNormal,KEntryAttHidden); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2206 |
test_KErrNone(r); |
0 | 2207 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2208 |
test_KErrNone(reqStat.Int()); |
0 | 2209 |
|
2210 |
// RFile::SetSize() of a file within the monitored directory |
|
2211 |
test.Next(_L("RFile::SetSize()")); |
|
2212 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2213 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2214 |
r=file.SetSize(256); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2215 |
test_KErrNone(r); |
0 | 2216 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2217 |
test_KErrNone(reqStat.Int()); |
0 | 2218 |
file.Close(); |
2219 |
||
2220 |
// RFile::Temp() to create a temp file in the subtree |
|
2221 |
test.Next(_L("RFile::Temp()")); |
|
2222 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2223 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2224 |
TFileName fileName; |
2225 |
r=file.Temp(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"),fileName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2226 |
test_KErrNone(r); |
0 | 2227 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2228 |
test_KErrNone(reqStat.Int()); |
0 | 2229 |
file.Close(); |
2230 |
||
2231 |
// RFile::SetModified() to change modification time of a file within monitored dir |
|
2232 |
test.Next(_L("RFile::SetModified()")); |
|
2233 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2234 |
TTime now; |
|
2235 |
now.HomeTime(); |
|
2236 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2237 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2238 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2239 |
file.SetModified(now); |
2240 |
file.Close(); |
|
2241 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2242 |
test_KErrNone(reqStat.Int()); |
0 | 2243 |
|
2244 |
// RFs::Entry() to change a directory entry within the monitored directory |
|
2245 |
test.Next(_L("RFs::Entry()")); |
|
2246 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2247 |
TEntry entry; |
|
2248 |
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2249 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2250 |
now.HomeTime(); |
2251 |
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2252 |
test_KErrNone(r); |
0 | 2253 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2254 |
test_KErrNone(reqStat.Int()); |
0 | 2255 |
|
2256 |
// RFile::Set() to change file's modification time and attributes |
|
2257 |
test.Next(_L("RFile::Set()")); |
|
2258 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2259 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2260 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2261 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2262 |
now.HomeTime(); |
2263 |
r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
|
2264 |
file.Close(); |
|
2265 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2266 |
test_KErrNone(reqStat.Int()); |
0 | 2267 |
|
2268 |
// RFs::SetDriveName() |
|
2269 |
test.Next(_L("RFs::SetDriveName()")); |
|
2270 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2271 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2272 |
User::After(KNotifyChangeAfter); |
2273 |
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2274 |
test_KErrNone(r); |
0 | 2275 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2276 |
test_KErrNone(reqStat.Int()); |
0 | 2277 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
2278 |
r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2279 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2280 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2281 |
User::After(KNotifyChangeAfter); |
2282 |
fs.NotifyChangeCancel(reqStat); |
|
2283 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2284 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2285 |
fs.NotifyChange(ENotifyDisk,reqStat,path); |
2286 |
User::After(KNotifyChangeAfter); |
|
2287 |
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2288 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2289 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2290 |
fs.NotifyChangeCancel(reqStat); |
2291 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2292 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2293 |
|
2294 |
// RFs::MkDir() |
|
2295 |
test.Next(_L("RFs::MkDir()")); |
|
2296 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2297 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2298 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2299 |
test_KErrNone(r); |
0 | 2300 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2301 |
test_KErrNone(reqStat.Int()); |
0 | 2302 |
|
2303 |
// RFs::RmDir() |
|
2304 |
test.Next(_L("RFs::RmDir()")); |
|
2305 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2306 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2307 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2308 |
test_KErrNone(r); |
0 | 2309 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2310 |
test_KErrNone(reqStat.Int()); |
0 | 2311 |
|
2312 |
// RFile::Create() |
|
2313 |
test.Next(_L("RFile::Create()")); |
|
2314 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2315 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2316 |
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2317 |
test_KErrNone(r); |
0 | 2318 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2319 |
test_KErrNone(reqStat.Int()); |
0 | 2320 |
file.Close(); |
2321 |
||
2322 |
// RFs::Delete() |
|
2323 |
test.Next(_L("RFs::Delete()")); |
|
2324 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2325 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2326 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2327 |
test_KErrNone(r); |
0 | 2328 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2329 |
test_KErrNone(reqStat.Int()); |
0 | 2330 |
|
2331 |
// RFile::Replace() |
|
2332 |
test.Next(_L("RFile::Replace()")); |
|
2333 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2334 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2335 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2336 |
test_KErrNone(r); |
0 | 2337 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2338 |
test_KErrNone(reqStat.Int()); |
0 | 2339 |
file.Close(); |
2340 |
||
2341 |
// RFs::Delete() |
|
2342 |
test.Next(_L("RFs::Delete()")); |
|
2343 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2344 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2345 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2346 |
test_KErrNone(r); |
0 | 2347 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2348 |
test_KErrNone(reqStat.Int()); |
0 | 2349 |
|
2350 |
// RFs::SetVolumeLabel() - should be notification under relevant TNotifyType monitoring |
|
2351 |
// The operation is non-path specific so all outstanding interested requests are notified |
|
2352 |
test.Next(_L("RFs::SetVolumeLabel()")); |
|
2353 |
||
2354 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2355 |
||
2356 |
TInt driveNum=CurrentDrive(); |
|
2357 |
TVolumeInfo volInfo; |
|
2358 |
TFileName currentVolName; |
|
2359 |
r=TheFs.Volume(volInfo,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2360 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2361 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2362 |
currentVolName=volInfo.iName; |
2363 |
||
2364 |
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
|
2365 |
if (r==KErrNone) |
|
2366 |
{ |
|
2367 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2368 |
test_KErrNone(reqStat.Int()); |
0 | 2369 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2370 |
test_KErrNone(r); |
0 | 2371 |
test(volInfo.iName==_L("VOL")); |
2372 |
// Test notification occurs under ENotifyDisk |
|
2373 |
fs.NotifyChange(ENotifyDisk,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2374 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2375 |
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2376 |
test_KErrNone(r); |
0 | 2377 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2378 |
test_KErrNone(reqStat.Int()); |
0 | 2379 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2380 |
test_KErrNone(r); |
0 | 2381 |
|
2382 |
test(volInfo.iName==_L("ABCDEFGHIJK")); |
|
2383 |
||
2384 |
// Test notification does not occur under ENotifyAttributes |
|
2385 |
fs.NotifyChange(ENotifyAttributes,reqStat,path); |
|
2386 |
r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2387 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2388 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2389 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2390 |
test_KErrNone(r); |
0 | 2391 |
|
2392 |
test(volInfo.iName==_L("TROPICANA")); |
|
2393 |
||
2394 |
fs.NotifyChangeCancel(reqStat); |
|
2395 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2396 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2397 |
// Test notification occurs under ENotifyEntry |
2398 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2399 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2400 |
r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2401 |
test_KErrNone(r); |
0 | 2402 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2403 |
test_KErrNone(reqStat.Int()); |
0 | 2404 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2405 |
test_KErrNone(r); |
0 | 2406 |
test(volInfo.iName==currentVolName); |
2407 |
} |
|
2408 |
||
2409 |
else // RFs::SetVolumeLabel() doesn't work on subst drives |
|
2410 |
{ |
|
2411 |
fs.NotifyChangeCancel(); |
|
2412 |
User::WaitForRequest(reqStat); |
|
2413 |
test.Printf(_L("Cannot set volume label on a substed drive\n")); |
|
2414 |
} |
|
2415 |
||
2416 |
||
2417 |
||
2418 |
// Test that notification is made when change is made to monitored directory |
|
2419 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2420 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2421 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2422 |
test_KErrNone(r); |
0 | 2423 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2424 |
test_KErrNone(reqStat.Int()); |
0 | 2425 |
|
2426 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2427 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2428 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2429 |
test_KErrNone(r); |
0 | 2430 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2431 |
test_KErrNone(reqStat.Int()); |
0 | 2432 |
fs.Close(); |
2433 |
} |
|
2434 |
||
2435 |
||
2436 |
static void Test16() |
|
2437 |
||
2438 |
{ |
|
2439 |
// |
|
2440 |
// Repeat Test15 operations in a subtree of that monitored, and ensure notification |
|
2441 |
// does occur for a variety of file operations when subtree watching is on |
|
2442 |
// |
|
2443 |
RFs fs; |
|
2444 |
TInt r=fs.Connect(); // Session to be notified when a change occurs |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2445 |
test_KErrNone(r); |
0 | 2446 |
r=fs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2447 |
test_KErrNone(r); |
0 | 2448 |
|
2449 |
// RFile::Write() to a file in the subtree |
|
2450 |
TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
|
2451 |
TRequestStatus reqStat(KRequestPending); |
|
2452 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2453 |
||
2454 |
RFile file; |
|
2455 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2456 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2457 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2458 |
r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2459 |
file.Close(); |
|
2460 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2461 |
test_KErrNone(reqStat.Int()); |
0 | 2462 |
|
2463 |
// RFile::Read() a file within the monitored directory - no notification for reads |
|
2464 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2465 |
TBuf8<100> temp; |
|
2466 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2467 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2468 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2469 |
r=file.Read(0,temp,100); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2470 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2471 |
|
2472 |
// RFile::SetAtt() of a file within the monitored directory |
|
2473 |
r=file.SetAtt(KEntryAttNormal,KEntryAttHidden); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2474 |
test_KErrNone(r); |
0 | 2475 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2476 |
test_KErrNone(reqStat.Int()); |
0 | 2477 |
|
2478 |
// RFile::SetSize() of a file within the monitored directory |
|
2479 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2480 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2481 |
r=file.SetSize(256); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2482 |
test_KErrNone(r); |
0 | 2483 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2484 |
test_KErrNone(reqStat.Int()); |
0 | 2485 |
file.Close(); |
2486 |
||
2487 |
||
2488 |
// RFile::SetModified() to change modification time of a file within monitored dir |
|
2489 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2490 |
TTime now; |
|
2491 |
now.HomeTime(); |
|
2492 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2493 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2494 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2495 |
file.SetModified(now); |
2496 |
file.Close(); |
|
2497 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2498 |
test_KErrNone(reqStat.Int()); |
0 | 2499 |
|
2500 |
// RFs::Entry() to change a directory entry within the monitored directory |
|
2501 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2502 |
TEntry entry; |
|
2503 |
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2504 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2505 |
now.HomeTime(); |
2506 |
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2507 |
test_KErrNone(r); |
0 | 2508 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2509 |
test_KErrNone(reqStat.Int()); |
0 | 2510 |
|
2511 |
// RFile::Set() to change file's modification time and attributes |
|
2512 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2513 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2514 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2515 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2516 |
now.HomeTime(); |
2517 |
r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
|
2518 |
file.Close(); |
|
2519 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2520 |
test_KErrNone(reqStat.Int()); |
0 | 2521 |
|
2522 |
// RFs::SetDriveName() - should be no notification ever with extended notification |
|
2523 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2524 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2525 |
User::After(KNotifyChangeAfter); |
2526 |
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2527 |
test_KErrNone(r); |
0 | 2528 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2529 |
test_KErrNone(reqStat.Int()); |
0 | 2530 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
2531 |
User::After(KNotifyChangeAfter); |
|
2532 |
r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2533 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2534 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2535 |
fs.NotifyChangeCancel(reqStat); |
2536 |
User::WaitForRequest(reqStat); |
|
2537 |
fs.NotifyChange(ENotifyDisk,reqStat,path); |
|
2538 |
User::After(KNotifyChangeAfter); |
|
2539 |
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2540 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2541 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2542 |
fs.NotifyChangeCancel(reqStat); |
2543 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2544 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2545 |
|
2546 |
||
2547 |
// RFs::MkDir() |
|
2548 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2549 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2550 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2551 |
test_KErrNone(r); |
0 | 2552 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2553 |
test_KErrNone(reqStat.Int()); |
0 | 2554 |
|
2555 |
// RFs::RmDir() |
|
2556 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2557 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2558 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2559 |
test_KErrNone(r); |
0 | 2560 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2561 |
test_KErrNone(reqStat.Int()); |
0 | 2562 |
|
2563 |
// RFile::Create() |
|
2564 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2565 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2566 |
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2567 |
test_KErrNone(r); |
0 | 2568 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2569 |
test_KErrNone(reqStat.Int()); |
0 | 2570 |
file.Close(); |
2571 |
||
2572 |
// RFs::Delete() |
|
2573 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2574 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2575 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2576 |
test_KErrNone(r); |
0 | 2577 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2578 |
test_KErrNone(reqStat.Int()); |
0 | 2579 |
|
2580 |
// RFile::Replace() |
|
2581 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2582 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2583 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2584 |
test_KErrNone(r); |
0 | 2585 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2586 |
test_KErrNone(reqStat.Int()); |
0 | 2587 |
file.Close(); |
2588 |
||
2589 |
// RFs::Delete() |
|
2590 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2591 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2592 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2593 |
test_KErrNone(r); |
0 | 2594 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2595 |
test_KErrNone(reqStat.Int()); |
0 | 2596 |
|
2597 |
// RFs::SetVolumeLabel() |
|
2598 |
// Not path specific, so all outstanding requests of correct TNotifyType are notified |
|
2599 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2600 |
TInt driveNum=CurrentDrive(); |
|
2601 |
TVolumeInfo volInfo; |
|
2602 |
TFileName currentVolName; |
|
2603 |
r=TheFs.Volume(volInfo,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2604 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2605 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2606 |
currentVolName=volInfo.iName; |
2607 |
||
2608 |
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
|
2609 |
if (r==KErrNone) |
|
2610 |
{ |
|
2611 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2612 |
test_KErrNone(reqStat.Int()); |
0 | 2613 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2614 |
test_KErrNone(r); |
0 | 2615 |
test(volInfo.iName==_L("VOL")); |
2616 |
// Test notification occurs under ENotifyDisk |
|
2617 |
fs.NotifyChange(ENotifyDisk,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2618 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2619 |
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2620 |
test_KErrNone(r); |
0 | 2621 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2622 |
test_KErrNone(reqStat.Int()); |
0 | 2623 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2624 |
test_KErrNone(r); |
0 | 2625 |
|
2626 |
test(volInfo.iName==_L("ABCDEFGHIJK")); |
|
2627 |
||
2628 |
// Test notification does not occur under ENotifyAttributes |
|
2629 |
fs.NotifyChange(ENotifyAttributes,reqStat,path); |
|
2630 |
r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2631 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2632 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2633 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2634 |
test_KErrNone(r); |
0 | 2635 |
|
2636 |
test(volInfo.iName==_L("TROPICANA")); |
|
2637 |
||
2638 |
fs.NotifyChangeCancel(reqStat); |
|
2639 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2640 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 2641 |
// Test notification occurs under ENotifyEntry |
2642 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2643 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2644 |
r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2645 |
test_KErrNone(r); |
0 | 2646 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2647 |
test_KErrNone(reqStat.Int()); |
0 | 2648 |
r=TheFs.Volume(volInfo,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2649 |
test_KErrNone(r); |
0 | 2650 |
test(volInfo.iName==currentVolName); |
2651 |
} |
|
2652 |
||
2653 |
else // RFs::SetVolumeLabel() doesn't work on subst drives |
|
2654 |
{ |
|
2655 |
fs.NotifyChangeCancel(); |
|
2656 |
User::WaitForRequest(reqStat); |
|
2657 |
test.Printf(_L("Cannot set volume label on a substed drive\n")); |
|
2658 |
} |
|
2659 |
||
2660 |
// RFs::Rename() |
|
2661 |
fs.NotifyChange(ENotifyEntry,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2662 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2663 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2664 |
test_KErrNone(r); |
0 | 2665 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2666 |
test_KErrNone(reqStat.Int()); |
0 | 2667 |
|
2668 |
// Test that notification is made when change is made to monitored directory |
|
2669 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2670 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2671 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2672 |
test_KErrNone(r); |
0 | 2673 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2674 |
test_KErrNone(reqStat.Int()); |
0 | 2675 |
|
2676 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2677 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2678 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2679 |
test_KErrNone(r); |
0 | 2680 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2681 |
test_KErrNone(reqStat.Int()); |
0 | 2682 |
fs.Close(); |
2683 |
} |
|
2684 |
||
2685 |
||
2686 |
static void Test17() |
|
2687 |
// |
|
2688 |
// Test multiple requests from a single session |
|
2689 |
// |
|
2690 |
{ |
|
2691 |
||
2692 |
test.Next(_L("Test reads and writes do not cause notification under ENotifyEntry")); |
|
2693 |
||
2694 |
RFile file; |
|
2695 |
TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2696 |
test_KErrNone(r); |
0 | 2697 |
file.Close(); |
2698 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2699 |
test_KErrNone(r); |
0 | 2700 |
file.Close(); |
2701 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2702 |
test_KErrNone(r); |
0 | 2703 |
file.Close(); |
2704 |
||
2705 |
RFs fs; |
|
2706 |
r=fs.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2707 |
test_KErrNone(r); |
0 | 2708 |
r=fs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2709 |
test_KErrNone(r); |
0 | 2710 |
|
2711 |
TRequestStatus reqStat1(KRequestPending); |
|
2712 |
TFileName path1=_L("\\F32-TST\\NOTIFY\\"); |
|
2713 |
fs.NotifyChange(ENotifyEntry,reqStat1,path1); |
|
2714 |
||
2715 |
TRequestStatus status1(KRequestPending); |
|
2716 |
TRequestStatus status2(KRequestPending); |
|
2717 |
TRequestStatus status3(KRequestPending); |
|
2718 |
TRequestStatus status4(KRequestPending); |
|
2719 |
TRequestStatus status5(KRequestPending); |
|
2720 |
TRequestStatus status6(KRequestPending); |
|
2721 |
||
2722 |
TRequestStatus statusExtended1(KRequestPending); |
|
2723 |
TRequestStatus statusExtended2(KRequestPending); |
|
2724 |
TRequestStatus statusExtended3(KRequestPending); |
|
2725 |
TRequestStatus statusExtended4(KRequestPending); |
|
2726 |
TRequestStatus statusExtended5(KRequestPending); |
|
2727 |
TRequestStatus statusExtended6(KRequestPending); |
|
2728 |
||
2729 |
// Request multiple notifications using standard change notification request |
|
2730 |
fs.NotifyChange(ENotifyEntry,status1); |
|
2731 |
fs.NotifyChange(ENotifyEntry,status2); |
|
2732 |
fs.NotifyChange(ENotifyEntry,status3); |
|
2733 |
fs.NotifyChange(ENotifyEntry,status4); |
|
2734 |
fs.NotifyChange(ENotifyEntry,status5); |
|
2735 |
fs.NotifyChange(ENotifyEntry,status6); |
|
2736 |
||
2737 |
// Request multiple notifications using extended change notification request |
|
2738 |
fs.NotifyChange(ENotifyEntry,statusExtended1,path1); |
|
2739 |
fs.NotifyChange(ENotifyEntry,statusExtended2,path1); |
|
2740 |
fs.NotifyChange(ENotifyEntry,statusExtended3,path1); |
|
2741 |
fs.NotifyChange(ENotifyEntry,statusExtended4,path1); |
|
2742 |
fs.NotifyChange(ENotifyEntry,statusExtended5,path1); |
|
2743 |
fs.NotifyChange(ENotifyEntry,statusExtended6,path1); |
|
2744 |
||
2745 |
TRequestStatus reqStat2(KRequestPending); |
|
2746 |
TFileName path2=_L("\\F32-TST\\NOTIFY\\kangaroo.txt"); |
|
2747 |
fs.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
2748 |
||
2749 |
TRequestStatus reqStat3(KRequestPending); |
|
2750 |
TFileName path3=_L("\\F32-TST\\NOTIFY\\koala.txt"); |
|
2751 |
fs.NotifyChange(ENotifyEntry,reqStat3,path3); |
|
2752 |
||
2753 |
TRequestStatus reqStat4(KRequestPending); |
|
2754 |
TFileName path4=_L("\\F32-TST\\NOTIFY\\dingo.txt"); |
|
2755 |
fs.NotifyChange(ENotifyEntry,reqStat4,path4); |
|
2756 |
||
2757 |
||
2758 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2759 |
test_KErrNone(r); |
0 | 2760 |
RThread thread1; |
2761 |
r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2762 |
test_KErrNone(r); |
0 | 2763 |
thread1.Resume(); |
2764 |
gSleepThread.Wait(); |
|
2765 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2766 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2767 |
test_Value(status2.Int(), status2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2768 |
test_Value(status3.Int(), status3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2769 |
test_Value(status4.Int(), status4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2770 |
test_Value(status5.Int(), status5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2771 |
test_Value(status6.Int(), status6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2772 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2773 |
test_Value(statusExtended1.Int(), statusExtended1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2774 |
test_Value(statusExtended2.Int(), statusExtended2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2775 |
test_Value(statusExtended3.Int(), statusExtended3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2776 |
test_Value(statusExtended4.Int(), statusExtended4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2777 |
test_Value(statusExtended5.Int(), statusExtended5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2778 |
test_Value(statusExtended6.Int(), statusExtended6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2779 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2780 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2781 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2782 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2783 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2784 |
|
2785 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2786 |
test_KErrNone(r); |
0 | 2787 |
User::WaitForRequest(reqStat1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2788 |
test_KErrNone(reqStat1.Int()); |
0 | 2789 |
User::WaitForRequest(status1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2790 |
test_KErrNone(status1.Int()); |
0 | 2791 |
User::WaitForRequest(status2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2792 |
test_KErrNone(status2.Int()); |
0 | 2793 |
User::WaitForRequest(status3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2794 |
test_KErrNone(status3.Int()); |
0 | 2795 |
User::WaitForRequest(status4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2796 |
test_KErrNone(status4.Int()); |
0 | 2797 |
User::WaitForRequest(status5); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2798 |
test_KErrNone(status5.Int()); |
0 | 2799 |
User::WaitForRequest(status6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2800 |
test_KErrNone(status6.Int()); |
0 | 2801 |
|
2802 |
User::WaitForRequest(statusExtended1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2803 |
test_KErrNone(statusExtended1.Int()); |
0 | 2804 |
User::WaitForRequest(statusExtended2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2805 |
test_KErrNone(statusExtended2.Int()); |
0 | 2806 |
User::WaitForRequest(statusExtended3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2807 |
test_KErrNone(statusExtended3.Int()); |
0 | 2808 |
User::WaitForRequest(statusExtended4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2809 |
test_KErrNone(statusExtended4.Int()); |
0 | 2810 |
User::WaitForRequest(statusExtended5); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2811 |
test_KErrNone(statusExtended5.Int()); |
0 | 2812 |
User::WaitForRequest(statusExtended6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2813 |
test_KErrNone(statusExtended6.Int()); |
0 | 2814 |
|
2815 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2816 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2817 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2818 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2819 |
fs.NotifyChangeCancel(); // Cancels both remaining notification requests |
2820 |
||
2821 |
User::WaitForRequest(reqStat3); |
|
2822 |
User::WaitForRequest(reqStat4); |
|
2823 |
||
2824 |
gSleepThread.Close(); |
|
2825 |
thread1.Close(); |
|
2826 |
||
2827 |
test.Next(_L("Test reads and writes do cause notification under ENotifyAll")); |
|
2828 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2829 |
test_KErrNone(r); |
0 | 2830 |
file.Close(); |
2831 |
||
2832 |
fs.NotifyChange(ENotifyAll,reqStat1,path1); |
|
2833 |
fs.NotifyChange(ENotifyEntry,reqStat2,path2); |
|
2834 |
fs.NotifyChange(ENotifyAll,reqStat3,path3); |
|
2835 |
fs.NotifyChange(ENotifyEntry,reqStat4,path4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2836 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2837 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2838 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2839 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2840 |
|
2841 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2842 |
test_KErrNone(r); |
0 | 2843 |
RThread thread2; |
2844 |
r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2845 |
test_KErrNone(r); |
0 | 2846 |
thread2.Resume(); |
2847 |
gSleepThread.Wait(); |
|
2848 |
||
2849 |
User::WaitForRequest(reqStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2850 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2851 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
0 | 2852 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2853 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2854 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2855 |
|
2856 |
gSleepThread.Close(); |
|
2857 |
thread2.Close(); |
|
2858 |
||
2859 |
fs.NotifyChange(ENotifyAll,reqStat1,path1); |
|
2860 |
fs.NotifyChange(ENotifyAll,reqStat3,path3); |
|
2861 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2862 |
test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2863 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2864 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2865 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2866 |
|
2867 |
r=gSleepThread.CreateLocal(0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2868 |
test_KErrNone(r); |
0 | 2869 |
RThread thread3; |
2870 |
r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2871 |
test_KErrNone(r); |
0 | 2872 |
thread3.Resume(); |
2873 |
gSleepThread.Wait(); |
|
2874 |
||
2875 |
User::WaitForRequest(reqStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2876 |
test_KErrNone(reqStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2877 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyEntry |
0 | 2878 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2879 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2880 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring with ENotifyEntry |
0 | 2881 |
|
2882 |
RFs fs2; |
|
2883 |
r=fs2.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2884 |
test_KErrNone(r); |
0 | 2885 |
r=fs2.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2886 |
test_KErrNone(r); |
0 | 2887 |
|
2888 |
TRequestStatus reqStat(KRequestPending); |
|
2889 |
fs2.NotifyChange(ENotifyEntry,reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2890 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2891 |
|
2892 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2893 |
test_KErrNone(r); |
0 | 2894 |
User::WaitForRequest(reqStat2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2895 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2896 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2897 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2898 |
test_KErrNone(reqStat.Int()); |
0 | 2899 |
|
2900 |
fs2.NotifyChange(ENotifyAll,reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2901 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 2902 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2903 |
test_KErrNone(r); |
0 | 2904 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2905 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2906 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2907 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2908 |
test_KErrNone(r); |
0 | 2909 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2910 |
test_KErrNone(reqStat4.Int()); |
0 | 2911 |
|
2912 |
gSleepThread.Close(); |
|
2913 |
thread3.Close(); |
|
2914 |
fs.Close(); |
|
2915 |
} |
|
2916 |
||
2917 |
static void Test18() |
|
2918 |
||
2919 |
{ |
|
2920 |
// |
|
2921 |
// Test notification request succeeds or fails as appropriate to the notification type |
|
2922 |
// with all file operations which result in notifications |
|
2923 |
// enum TNotifyType {ENotifyEntry=0x00,ENotifyAll=0x01,ENotifyFile=0x04,ENotifyDir=0x08, |
|
2924 |
// ENotifyAttributes=0x10,ENotifyWrite=0x20,ENotifyDisk=0x40}; |
|
2925 |
// |
|
2926 |
RFs fs; |
|
2927 |
TInt r=fs.Connect(); // Session to be notified of any changes |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2928 |
test_KErrNone(r); |
0 | 2929 |
r=fs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2930 |
test_KErrNone(r); |
0 | 2931 |
|
2932 |
// RFile::Write() to a file within the monitored directory |
|
2933 |
test.Next(_L("RFile::Write()")); |
|
2934 |
TFileName path=_L("\\F32-TST\\NOTIFY\\NewFile.txt"); |
|
2935 |
TRequestStatus reqStat(KRequestPending); |
|
2936 |
TRequestStatus reqStat2(KRequestPending); |
|
2937 |
TRequestStatus reqStat3(KRequestPending); |
|
2938 |
TRequestStatus reqStat4(KRequestPending); |
|
2939 |
TRequestStatus reqStat5(KRequestPending); |
|
2940 |
TRequestStatus reqStat6(KRequestPending); |
|
2941 |
TRequestStatus reqStat7(KRequestPending); |
|
2942 |
||
2943 |
||
2944 |
RFile file; |
|
2945 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2946 |
test_KErrNone(r); |
0 | 2947 |
|
2948 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2949 |
fs.NotifyChange(ENotifyFile,reqStat2,path); |
|
2950 |
fs.NotifyChange(ENotifyWrite,reqStat3,path); |
|
2951 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
2952 |
fs.NotifyChange(ENotifyEntry,reqStat5,path); |
|
2953 |
fs.NotifyChange(ENotifyAttributes,reqStat6,path); |
|
2954 |
fs.NotifyChange(ENotifyDisk,reqStat7,path); |
|
2955 |
||
2956 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2957 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2958 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2959 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 2960 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2961 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); // Cannot monitor a file with ENotifyDir |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2962 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2963 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
0 | 2964 |
fs.NotifyChange(ENotifyEntry,reqStat4,path); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2965 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 2966 |
|
2967 |
r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
|
2968 |
file.Close(); |
|
2969 |
||
2970 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2971 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2972 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile |
0 | 2973 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2974 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2975 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring with ENotifyEntry |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2976 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2977 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2978 |
test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
0 | 2979 |
fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
2980 |
||
2981 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2982 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 2983 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2984 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 2985 |
User::WaitForRequest(reqStat5); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2986 |
test_Value(reqStat5.Int(), reqStat5==KErrCancel); |
0 | 2987 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2988 |
test_Value(reqStat6.Int(), reqStat6==KErrCancel); |
0 | 2989 |
User::WaitForRequest(reqStat7); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2990 |
test_Value(reqStat7.Int(), reqStat7==KErrCancel); |
0 | 2991 |
|
2992 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2993 |
test_KErrNone(r); |
0 | 2994 |
|
2995 |
// RFile::SetAtt() of a file within the monitored directory |
|
2996 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
2997 |
fs.NotifyChange(ENotifyFile,reqStat2,path); |
|
2998 |
fs.NotifyChange(ENotifyEntry,reqStat3,path); |
|
2999 |
fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
|
3000 |
fs.NotifyChange(ENotifyDir,reqStat5,path); |
|
3001 |
fs.NotifyChange(ENotifyWrite,reqStat6,path); |
|
3002 |
fs.NotifyChange(ENotifyDisk,reqStat7,path); |
|
3003 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3004 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3005 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3006 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3007 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3008 |
User::WaitForRequest(reqStat5); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3009 |
test_Value(reqStat5.Int(), reqStat5==KErrArgument); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3010 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3011 |
test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
0 | 3012 |
|
3013 |
test.Next(_L("RFile::SetAtt()")); |
|
3014 |
r=file.SetAtt(KEntryAttSystem,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3015 |
test_KErrNone(r); |
0 | 3016 |
User::WaitForRequest(reqStat); |
3017 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3018 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3019 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3020 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring with ENotifyEntry |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3021 |
test_KErrNone(reqStat4.Int()); // Monitoring a file - can't use ENotifyDir |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3022 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3023 |
test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
0 | 3024 |
|
3025 |
fs.NotifyChange(ENotifyWrite,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3026 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3027 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
3028 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3029 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3030 |
r=file.SetAtt(KEntryAttNormal,KEntryAttSystem); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3031 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3032 |
test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring with ENotifyWrite |
0 | 3033 |
fs.NotifyChangeCancel(); // Cancel outstanding notification request |
3034 |
||
3035 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3036 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 3037 |
User::WaitForRequest(reqStat2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3038 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3039 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3040 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3041 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3042 |
test_Value(reqStat6.Int(), reqStat6==KErrCancel); |
0 | 3043 |
User::WaitForRequest(reqStat7); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3044 |
test_Value(reqStat7.Int(), reqStat7==KErrCancel); |
0 | 3045 |
|
3046 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3047 |
fs.NotifyChange(ENotifyFile,reqStat2,path); |
|
3048 |
fs.NotifyChange(ENotifyEntry,reqStat3,path); |
|
3049 |
fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
|
3050 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3051 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3052 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3053 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3054 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3055 |
|
3056 |
// RFile::SetSize() of a file within the monitored directory |
|
3057 |
test.Next(_L("RFile::SetSize()")); |
|
3058 |
r=file.SetSize(256); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3059 |
test_KErrNone(r); |
0 | 3060 |
User::WaitForRequest(reqStat); |
3061 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3062 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3063 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3064 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring with ENotifyEntry |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3065 |
test_KErrNone(reqStat4.Int()); |
0 | 3066 |
|
3067 |
fs.NotifyChange(ENotifyWrite,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3068 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3069 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
3070 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3071 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3072 |
r=file.SetSize(200); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3073 |
test_KErrNone(r); |
0 | 3074 |
User::After(1000000); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3075 |
test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring with ENotifyWrite |
0 | 3076 |
|
3077 |
file.Close(); |
|
3078 |
fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
|
3079 |
||
3080 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3081 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 3082 |
User::WaitForRequest(reqStat2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3083 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3084 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3085 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3086 |
|
3087 |
// RFile::Temp() to create a temp file within the monitored directory |
|
3088 |
test.Next(_L("RFile::Temp()")); |
|
3089 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3090 |
||
3091 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3092 |
fs.NotifyChange(ENotifyDir,reqStat2,path); |
|
3093 |
fs.NotifyChange(ENotifyEntry,reqStat3,path); |
|
3094 |
fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
|
3095 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3096 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3097 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3098 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3099 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3100 |
|
3101 |
TFileName fileName; |
|
3102 |
r=file.Temp(TheFs,path,fileName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3103 |
test_KErrNone(r); |
0 | 3104 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3105 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3106 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3107 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyEntry |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3108 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyAttributes |
0 | 3109 |
file.Close(); |
3110 |
fs.NotifyChangeCancel(); |
|
3111 |
||
3112 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3113 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3114 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3115 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3116 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3117 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3118 |
|
3119 |
fs.NotifyChange(ENotifyFile,reqStat,path); |
|
3120 |
fs.NotifyChange(ENotifyDisk,reqStat2,path); |
|
3121 |
fs.NotifyChange(ENotifyWrite,reqStat3,path); |
|
3122 |
r=file.Temp(TheFs,path,fileName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3123 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3124 |
test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring ENotifyFile |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3125 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring ENotifyDisk |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3126 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyWrite |
0 | 3127 |
file.Close(); |
3128 |
||
3129 |
fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
|
3130 |
||
3131 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3132 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 3133 |
User::WaitForRequest(reqStat2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3134 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3135 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3136 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3137 |
|
3138 |
// RFile::SetModified() to change modification time of a file within monitored dir |
|
3139 |
test.Next(_L("RFile::SetModified()")); |
|
3140 |
path=_L("\\F32-TST\\NOTIFY\\NewFile.txt"); |
|
3141 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3142 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3143 |
fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
|
3144 |
fs.NotifyChange(ENotifyFile,reqStat4,path); |
|
3145 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3146 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3147 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3148 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3149 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3150 |
|
3151 |
TTime now; |
|
3152 |
now.HomeTime(); |
|
3153 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3154 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3155 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3156 |
file.SetModified(now); |
3157 |
file.Close(); |
|
3158 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3159 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3160 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
0 | 3161 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3162 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3163 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3164 |
fs.NotifyChangeCancel(); |
3165 |
||
3166 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3167 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3168 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3169 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3170 |
|
3171 |
// RFs::SetEntry() to change a directory entry within the monitored directory |
|
3172 |
test.Next(_L("RFs::SetEntry()")); |
|
3173 |
TEntry entry; |
|
3174 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3175 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3176 |
fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
|
3177 |
fs.NotifyChange(ENotifyDisk,reqStat4,path); |
|
3178 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3179 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3180 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3181 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3182 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3183 |
|
3184 |
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3185 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3186 |
now.HomeTime(); |
3187 |
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),now,KEntryAttHidden,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3188 |
test_KErrNone(r); |
0 | 3189 |
User::WaitForRequest(reqStat); |
3190 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3191 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3192 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3193 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3194 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3195 |
fs.NotifyChangeCancel(); |
3196 |
||
3197 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3198 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3199 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3200 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3201 |
|
3202 |
// RFile::Set() to change file's modification time and attributes |
|
3203 |
test.Next(_L("RFile::Set()")); |
|
3204 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3205 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3206 |
fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
|
3207 |
fs.NotifyChange(ENotifyWrite,reqStat4,path); |
|
3208 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3209 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3210 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3211 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3212 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3213 |
|
3214 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3215 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3216 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3217 |
now.HomeTime(); |
3218 |
r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
|
3219 |
file.Close(); |
|
3220 |
User::WaitForRequest(reqStat); |
|
3221 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3222 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3223 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3224 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3225 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3226 |
fs.NotifyChangeCancel(); |
3227 |
||
3228 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3229 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3230 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3231 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3232 |
|
3233 |
// RFs::SetDriveName() |
|
3234 |
||
3235 |
test.Next(_L("RFs::SetDriveName()")); |
|
3236 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3237 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3238 |
fs.NotifyChange(ENotifyDisk,reqStat3,path); |
|
3239 |
fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
|
3240 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3241 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3242 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3243 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3244 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3245 |
User::After(KNotifyChangeAfter); |
3246 |
||
3247 |
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3248 |
test_KErrNone(r); |
0 | 3249 |
User::WaitForRequest(reqStat); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3250 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3251 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3252 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3253 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3254 |
fs.NotifyChangeCancel(); |
3255 |
||
3256 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3257 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3258 |
User::WaitForRequest(reqStat3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3259 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3260 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3261 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3262 |
|
3263 |
// RFs::MkDir() |
|
3264 |
test.Next(_L("RFs::MkDir()")); |
|
3265 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3266 |
||
3267 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3268 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3269 |
fs.NotifyChange(ENotifyDir,reqStat3,path); |
|
3270 |
fs.NotifyChange(ENotifyFile,reqStat4,path); |
|
3271 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3272 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3273 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3274 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3275 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3276 |
|
3277 |
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3278 |
test_KErrNone(r); |
0 | 3279 |
User::WaitForRequest(reqStat); |
3280 |
User::WaitForRequest(reqStat2); |
|
3281 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3282 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3283 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3284 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3285 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3286 |
|
3287 |
// RFs::RmDir() |
|
3288 |
test.Next(_L("RFs::RmDir()")); |
|
3289 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3290 |
fs.NotifyChange(ENotifyDir,reqStat2,path); |
|
3291 |
fs.NotifyChange(ENotifyWrite,reqStat3,path); |
|
3292 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3293 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3294 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3295 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3296 |
|
3297 |
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3298 |
test_KErrNone(r); |
0 | 3299 |
User::WaitForRequest(reqStat); |
3300 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3301 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3302 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3303 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3304 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3305 |
fs.NotifyChangeCancel(); |
3306 |
||
3307 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3308 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3309 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3310 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3311 |
|
3312 |
// RFile::Create() |
|
3313 |
test.Next(_L("RFile::Create()")); |
|
3314 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3315 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3316 |
fs.NotifyChange(ENotifyDir,reqStat3,path); |
|
3317 |
fs.NotifyChange(ENotifyFile,reqStat4,path); |
|
3318 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3319 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3320 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3321 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3322 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3323 |
|
3324 |
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3325 |
test_KErrNone(r); |
0 | 3326 |
User::WaitForRequest(reqStat); |
3327 |
User::WaitForRequest(reqStat2); |
|
3328 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3329 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3330 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3331 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyDir |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3332 |
test_KErrNone(reqStat4.Int()); |
0 | 3333 |
file.Close(); |
3334 |
fs.NotifyChangeCancel(reqStat3); |
|
3335 |
User::WaitForRequest(reqStat3); |
|
3336 |
||
3337 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3338 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3339 |
fs.NotifyChange(ENotifyDisk,reqStat3,path); |
|
3340 |
fs.NotifyChange(ENotifyWrite,reqStat4,path); |
|
3341 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3342 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3343 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3344 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3345 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3346 |
|
3347 |
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3348 |
test_KErrNone(r); |
0 | 3349 |
User::WaitForRequest(reqStat); |
3350 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3351 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3352 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3353 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3354 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3355 |
file.Close(); |
3356 |
fs.NotifyChangeCancel(); |
|
3357 |
||
3358 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3359 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3360 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3361 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3362 |
|
3363 |
// RFs::Delete() |
|
3364 |
test.Next(_L("RFs::Delete()")); |
|
3365 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3366 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3367 |
fs.NotifyChange(ENotifyDir,reqStat3,path); |
|
3368 |
fs.NotifyChange(ENotifyFile,reqStat4,path); |
|
3369 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3370 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3371 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3372 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3373 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3374 |
|
3375 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3376 |
test_KErrNone(r); |
0 | 3377 |
User::WaitForRequest(reqStat); |
3378 |
User::WaitForRequest(reqStat2); |
|
3379 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3380 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3381 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3382 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyDir |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3383 |
test_KErrNone(reqStat4.Int()); |
0 | 3384 |
fs.NotifyChangeCancel(reqStat3); |
3385 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3386 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3387 |
|
3388 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3389 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3390 |
fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
|
3391 |
fs.NotifyChange(ENotifyAll,reqStat4,path); |
|
3392 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3393 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3394 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3395 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3396 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3397 |
|
3398 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3399 |
test_KErrNone(r); |
0 | 3400 |
User::WaitForRequest(reqStat); |
3401 |
User::WaitForRequest(reqStat2); |
|
3402 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3403 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3404 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3405 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3406 |
test_KErrNone(reqStat4.Int()); |
0 | 3407 |
fs.NotifyChangeCancel(reqStat3); |
3408 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3409 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3410 |
|
3411 |
// RFile::Replace() |
|
3412 |
test.Next(_L("RFile::Replace()")); |
|
3413 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3414 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3415 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3416 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3417 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3418 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3419 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3420 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3421 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3422 |
|
3423 |
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3424 |
test_KErrNone(r); |
0 | 3425 |
User::WaitForRequest(reqStat); |
3426 |
User::WaitForRequest(reqStat2); |
|
3427 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3428 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3429 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3430 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3431 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3432 |
file.Close(); |
3433 |
fs.NotifyChangeCancel(); |
|
3434 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3435 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3436 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3437 |
test_KErrNone(reqStat3.Int()); |
0 | 3438 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3439 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3440 |
|
3441 |
// RFs::Delete() |
|
3442 |
test.Next(_L("RFs::Delete()")); |
|
3443 |
path=_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"); |
|
3444 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3445 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3446 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3447 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3448 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3449 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3450 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3451 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3452 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3453 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3454 |
|
3455 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3456 |
test_KErrNone(r); |
0 | 3457 |
User::WaitForRequest(reqStat); |
3458 |
User::WaitForRequest(reqStat2); |
|
3459 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3460 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3461 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3462 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3463 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3464 |
|
3465 |
// RFs::SetVolumeLabel() |
|
3466 |
test.Next(_L("RFs::SetVolumeLabel()")); |
|
3467 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3468 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3469 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3470 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3471 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3472 |
fs.NotifyChange(ENotifyWrite,reqStat5,path); |
|
3473 |
fs.NotifyChange(ENotifyAttributes,reqStat6,path); |
|
3474 |
fs.NotifyChange(ENotifyDisk,reqStat7,path); |
|
3475 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3476 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3477 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3478 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3479 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3480 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3481 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3482 |
test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
0 | 3483 |
|
3484 |
TInt driveNum=CurrentDrive(); |
|
3485 |
TVolumeInfo volInfo; |
|
3486 |
TFileName currentVolName; |
|
3487 |
r=TheFs.Volume(volInfo,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3488 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3489 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3490 |
currentVolName=volInfo.iName; |
3491 |
||
3492 |
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
|
3493 |
if (r==KErrNone) |
|
3494 |
{ |
|
3495 |
User::WaitForRequest(reqStat); |
|
3496 |
User::WaitForRequest(reqStat2); |
|
3497 |
User::WaitForRequest(reqStat7); |
|
3498 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3499 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3500 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3501 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3502 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3503 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3504 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3505 |
test_KErrNone(reqStat7.Int()); |
0 | 3506 |
|
3507 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3508 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3509 |
fs.NotifyChange(ENotifyDisk,reqStat7,path); |
|
3510 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3511 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3512 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3513 |
test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
0 | 3514 |
|
3515 |
r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3516 |
test_KErrNone(r); |
0 | 3517 |
|
3518 |
User::WaitForRequest(reqStat); |
|
3519 |
User::WaitForRequest(reqStat2); |
|
3520 |
User::WaitForRequest(reqStat7); |
|
3521 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3522 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3523 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3524 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3525 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3526 |
test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3527 |
test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3528 |
test_KErrNone(reqStat7.Int()); |
0 | 3529 |
|
3530 |
r=TheFs.Volume(volInfo,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3531 |
test_KErrNone(r); |
0 | 3532 |
test(volInfo.iName==currentVolName); |
3533 |
||
3534 |
fs.NotifyChangeCancel(); |
|
3535 |
||
3536 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3537 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3538 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3539 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3540 |
User::WaitForRequest(reqStat5); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3541 |
test_Value(reqStat5.Int(), reqStat5==KErrCancel); |
0 | 3542 |
User::WaitForRequest(reqStat6); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3543 |
test_Value(reqStat6.Int(), reqStat6==KErrCancel); |
0 | 3544 |
} |
3545 |
||
3546 |
else // RFs::SetVolumeLabel() doesn't work on subst drives |
|
3547 |
{ |
|
3548 |
fs.NotifyChangeCancel(); |
|
3549 |
User::WaitForRequest(reqStat); |
|
3550 |
User::WaitForRequest(reqStat2); |
|
3551 |
User::WaitForRequest(reqStat3); |
|
3552 |
User::WaitForRequest(reqStat4); |
|
3553 |
User::WaitForRequest(reqStat5); |
|
3554 |
User::WaitForRequest(reqStat6); |
|
3555 |
User::WaitForRequest(reqStat7); |
|
3556 |
test.Printf(_L("Cannot set volume label on a substed drive!\n")); |
|
3557 |
} |
|
3558 |
||
3559 |
||
3560 |
// RFile::Rename() |
|
3561 |
test.Next(_L("RFile::Rename()")); |
|
3562 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3563 |
||
3564 |
file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileShareExclusive|EFileWrite); |
|
3565 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3566 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3567 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3568 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3569 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3570 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3571 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3572 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3573 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3574 |
|
3575 |
r=file.Rename(_L("\\F32-TST\\NOTIFY\\OldFile.abc")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3576 |
test_Value(r, r == KErrNone||r==KErrAlreadyExists); |
0 | 3577 |
User::WaitForRequest(reqStat); |
3578 |
User::WaitForRequest(reqStat2); |
|
3579 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3580 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3581 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3582 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3583 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyDir |
0 | 3584 |
file.Close(); |
3585 |
fs.NotifyChangeCancel(); |
|
3586 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3587 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3588 |
|
3589 |
path=_L("\\F32-TST\\NOTIFY\\OldFile.abc"); |
|
3590 |
||
3591 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\OldFile.abc"),EFileShareExclusive|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3592 |
test_KErrNone(r); |
0 | 3593 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
3594 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3595 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3596 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3597 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3598 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3599 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3600 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3601 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3602 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3603 |
|
3604 |
r=file.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3605 |
test_KErrNone(r); |
0 | 3606 |
User::WaitForRequest(reqStat); |
3607 |
User::WaitForRequest(reqStat2); |
|
3608 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3609 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3610 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3611 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3612 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3613 |
file.Close(); |
3614 |
||
3615 |
// RFs::Rename() |
|
3616 |
test.Next(_L("RFs::Rename()")); |
|
3617 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3618 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3619 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3620 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3621 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3622 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3623 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3624 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3625 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3626 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3627 |
|
3628 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"),_L("\\F32-TST\\NOTIFY\\NewerFile.cat")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3629 |
test_KErrNone(r); |
0 | 3630 |
User::WaitForRequest(reqStat); |
3631 |
User::WaitForRequest(reqStat2); |
|
3632 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3633 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3634 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3635 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3636 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Changed a file not a directory entry |
0 | 3637 |
fs.NotifyChangeCancel(); |
3638 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3639 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3640 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3641 |
test_KErrNone(reqStat3.Int()); |
0 | 3642 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3643 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3644 |
|
3645 |
path=_L("\\F32-TST\\NOTIFY\\NewerFile.cat"); |
|
3646 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3647 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3648 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3649 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3650 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3651 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3652 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3653 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3654 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3655 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3656 |
|
3657 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewerFile.cat"),_L("\\F32-TST\\NOTIFY\\Original.dog")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3658 |
test_KErrNone(r); |
0 | 3659 |
User::WaitForRequest(reqStat); |
3660 |
User::WaitForRequest(reqStat2); |
|
3661 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3662 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3663 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3664 |
test_KErrNone(reqStat3.Int()); |
0 | 3665 |
|
3666 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3667 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3668 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3669 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3670 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3671 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3672 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3673 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3674 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3675 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3676 |
|
3677 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\"),_L("\\F32-TST\\NOTIFY_TEMP\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3678 |
test_KErrNone(r); |
0 | 3679 |
User::WaitForRequest(reqStat); |
3680 |
User::WaitForRequest(reqStat2); |
|
3681 |
User::WaitForRequest(reqStat3); |
|
3682 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3683 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3684 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3685 |
test_KErrNone(reqStat3.Int()); // Changed a directory entry but notified anyway despite |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3686 |
test_KErrNone(reqStat4.Int()); // requesting file notification only because the path we |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3687 |
// were monitoring has changed |
0 | 3688 |
|
3689 |
path=_L("\\F32-TST\\NOTIFY_TEMP\\Original.dog"); |
|
3690 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3691 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3692 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3693 |
fs.NotifyChange(ENotifyDir,reqStat4,path); |
|
3694 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3695 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3696 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3697 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3698 |
User::WaitForRequest(reqStat4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3699 |
test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
0 | 3700 |
|
3701 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_TEMP\\"),_L("\\F32-TST\\NOTIFY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3702 |
test_KErrNone(r); |
0 | 3703 |
User::WaitForRequest(reqStat); |
3704 |
User::WaitForRequest(reqStat2); |
|
3705 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3706 |
test_KErrNone(reqStat.Int()); // Modified a directory above the level at which we |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3707 |
test_KErrNone(reqStat2.Int()); // are monitoring for changes - we must be notified |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3708 |
test_KErrNone(reqStat3.Int()); // anyway because the path has changed |
0 | 3709 |
|
3710 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3711 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3712 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3713 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
0 | 3714 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3715 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3716 |
|
3717 |
fs.NotifyChangeCancel(reqStat); |
|
3718 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3719 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 3720 |
fs.NotifyChangeCancel(reqStat2); |
3721 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3722 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3723 |
fs.NotifyChangeCancel(reqStat3); |
3724 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3725 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3726 |
|
3727 |
path=_L("\\F32-TST\\NOTIFY\\Original.dog"); |
|
3728 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3729 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3730 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
|
3731 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3732 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3733 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3734 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3735 |
|
3736 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Original.dog")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3737 |
test_KErrNone(r); |
0 | 3738 |
User::WaitForRequest(reqStat); |
3739 |
User::WaitForRequest(reqStat2); |
|
3740 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3741 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3742 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3743 |
test_KErrNone(reqStat3.Int()); |
0 | 3744 |
|
3745 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3746 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3747 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3748 |
fs.NotifyChange(ENotifyDir,reqStat3,path); |
|
3749 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3750 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3751 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3752 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3753 |
|
3754 |
r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TEST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3755 |
test_KErrNone(r); |
0 | 3756 |
User::WaitForRequest(reqStat); |
3757 |
User::WaitForRequest(reqStat2); |
|
3758 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3759 |
test_KErrNone(reqStat.Int()); // Modified a directory above the level at which we |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3760 |
test_KErrNone(reqStat2.Int()); // are monitoring for changes but we receive notification |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3761 |
test_KErrNone(reqStat3.Int()); // because the notification path has been changed |
0 | 3762 |
|
3763 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3764 |
// Notification request is submitted, despite the subject's disappearance |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3765 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3766 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3767 |
// Notification request is submitted, despite the subject's disappearance |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3768 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
0 | 3769 |
fs.NotifyChange(ENotifyFile,reqStat3,path); |
3770 |
// Notification request is submitted, despite the subject's disappearance |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3771 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3772 |
|
3773 |
fs.NotifyChangeCancel(reqStat); |
|
3774 |
User::WaitForRequest(reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3775 |
test_Value(reqStat.Int(), reqStat==KErrCancel); |
0 | 3776 |
fs.NotifyChangeCancel(reqStat2); |
3777 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3778 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3779 |
fs.NotifyChangeCancel(reqStat3); |
3780 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3781 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3782 |
|
3783 |
path=_L("\\F32-TEST\\NOTIFY\\"); |
|
3784 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3785 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3786 |
fs.NotifyChange(ENotifyDir,reqStat3,path); |
|
3787 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3788 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3789 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3790 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
0 | 3791 |
|
3792 |
r=TheFs.Rename(_L("\\F32-TEST\\NOTIFY\\"),_L("\\F32-TEST\\NOTIFY_CHANGED\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3793 |
test_KErrNone(r); |
0 | 3794 |
|
3795 |
User::WaitForRequest(reqStat); |
|
3796 |
User::WaitForRequest(reqStat2); |
|
3797 |
User::WaitForRequest(reqStat3); |
|
3798 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3799 |
test_KErrNone(reqStat.Int()); // Rename the directory we were monitoring |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3800 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3801 |
test_KErrNone(reqStat3.Int()); |
0 | 3802 |
|
3803 |
// Tidy up the test directory before continuing (while testing notifications of renaming to the monitored directory) |
|
3804 |
||
3805 |
path=_L("\\F32-TST\\NOTIFY_CHANGED\\"); |
|
3806 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3807 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3808 |
fs.NotifyChange(ENotifyDir,reqStat3,path); |
|
3809 |
fs.NotifyChange(ENotifyFile,reqStat4,path); |
|
3810 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3811 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3812 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3813 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3814 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3815 |
|
3816 |
r=TheFs.Rename(_L("\\F32-TEST\\"),_L("\\F32-TST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3817 |
test_KErrNone(r); |
0 | 3818 |
|
3819 |
User::WaitForRequest(reqStat); |
|
3820 |
User::WaitForRequest(reqStat2); |
|
3821 |
User::WaitForRequest(reqStat3); |
|
3822 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3823 |
test_KErrNone(reqStat.Int()); // Renaming to (under) the directory we were monitoring |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3824 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3825 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3826 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3827 |
|
3828 |
fs.NotifyChangeCancel(reqStat4); |
|
3829 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3830 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3831 |
|
3832 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3833 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3834 |
fs.NotifyChange(ENotifyEntry,reqStat2,path); |
|
3835 |
fs.NotifyChange(ENotifyDir,reqStat3,path); |
|
3836 |
fs.NotifyChange(ENotifyFile,reqStat4,path); |
|
3837 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3838 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3839 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3840 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3841 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3842 |
|
3843 |
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_CHANGED\\"),_L("\\F32-TST\\NOTIFY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3844 |
test_KErrNone(r); |
0 | 3845 |
|
3846 |
User::WaitForRequest(reqStat); |
|
3847 |
User::WaitForRequest(reqStat2); |
|
3848 |
User::WaitForRequest(reqStat3); |
|
3849 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3850 |
test_KErrNone(reqStat.Int()); // Renaming to the directory we were monitoring |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3851 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3852 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3853 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3854 |
|
3855 |
fs.NotifyChangeCancel(reqStat4); |
|
3856 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3857 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3858 |
|
3859 |
// Test combinations of notify types |
|
3860 |
test.Next(_L("Test combinations of notify types")); |
|
3861 |
||
3862 |
path=_L("\\F32-TST\\NOTIFY\\"); |
|
3863 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3864 |
fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
|
3865 |
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path); |
|
3866 |
fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path); |
|
3867 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3868 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3869 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3870 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3871 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3872 |
|
3873 |
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3874 |
test_KErrNone(r); |
0 | 3875 |
User::WaitForRequest(reqStat); |
3876 |
User::WaitForRequest(reqStat2); |
|
3877 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3878 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3879 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3880 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3881 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyAttributes|ENotifyDisk |
0 | 3882 |
file.Close(); |
3883 |
fs.NotifyChangeCancel(reqStat4); |
|
3884 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3885 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3886 |
|
3887 |
// RFile::SetModified() |
|
3888 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3889 |
fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
|
3890 |
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path); |
|
3891 |
fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path); |
|
3892 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3893 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3894 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3895 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3896 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3897 |
|
3898 |
TTime nowTime; |
|
3899 |
nowTime.HomeTime(); |
|
3900 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3901 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3902 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3903 |
file.SetModified(now); |
3904 |
file.Close(); |
|
3905 |
User::WaitForRequest(reqStat); |
|
3906 |
User::WaitForRequest(reqStat2); |
|
3907 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3908 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3909 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3910 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3911 |
test_KErrNone(reqStat4.Int()); |
0 | 3912 |
fs.NotifyChangeCancel(); |
3913 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3914 |
test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
0 | 3915 |
|
3916 |
// RFile::Write() |
|
3917 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3918 |
fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
|
3919 |
fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path); |
|
3920 |
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path); |
|
3921 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3922 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3923 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3924 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3925 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3926 |
|
3927 |
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3928 |
test_KErrNone(r); |
0 | 3929 |
r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
3930 |
file.Close(); |
|
3931 |
User::WaitForRequest(reqStat); |
|
3932 |
User::WaitForRequest(reqStat3); |
|
3933 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3934 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3935 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3936 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3937 |
test_KErrNone(reqStat4.Int()); |
0 | 3938 |
fs.NotifyChangeCancel(reqStat2); // Cancels all outstanding notification requests |
3939 |
User::WaitForRequest(reqStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3940 |
test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
0 | 3941 |
|
3942 |
// RFs::Delete() |
|
3943 |
test.Next(_L("RFs::Delete()")); |
|
3944 |
fs.NotifyChange(ENotifyAll,reqStat,path); |
|
3945 |
fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
|
3946 |
fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path); |
|
3947 |
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path); |
|
3948 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3949 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3950 |
test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3951 |
test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3952 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3953 |
|
3954 |
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Munchkin.msg")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3955 |
test_KErrNone(r); |
0 | 3956 |
User::WaitForRequest(reqStat); |
3957 |
User::WaitForRequest(reqStat2); |
|
3958 |
User::WaitForRequest(reqStat3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3959 |
test_KErrNone(reqStat.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3960 |
test_KErrNone(reqStat2.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3961 |
test_KErrNone(reqStat3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3962 |
test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
0 | 3963 |
fs.NotifyChangeCancel(reqStat4); |
3964 |
User::WaitForRequest(reqStat4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3965 |
test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
0 | 3966 |
|
3967 |
fs.Close(); |
|
3968 |
} |
|
3969 |
||
3970 |
#if defined __EPOC32__ && defined __INCLUDE_MANUAL_TESTS__ |
|
3971 |
// Manual media change test |
|
3972 |
// assumes the media is intially present and then prompts |
|
3973 |
// the user to remove the media |
|
3974 |
static void Test99() |
|
3975 |
{ |
|
3976 |
TBuf<64> b; |
|
3977 |
b.Format(_L("Test Manual Media change notification (socket:%d)"),gSocketNumber); |
|
3978 |
test.Next(b); |
|
3979 |
TRequestStatus reqStat=0; |
|
3980 |
||
3981 |
RFs fs; |
|
3982 |
TInt r=fs.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3983 |
test_KErrNone(r); |
0 | 3984 |
|
3985 |
TDriveInfo driveInfo; |
|
3986 |
TInt driveNum = EDriveC + SocketToDrive[gSocketNumber]; |
|
3987 |
||
3988 |
// verify TDriveInfo.iType == EMediaHardDisk |
|
3989 |
r = fs.Drive(driveInfo, driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3990 |
test_KErrNone(r); |
0 | 3991 |
test.Printf(_L("iType = %d\n"), driveInfo.iType); |
3992 |
test(driveInfo.iType == EMediaHardDisk); |
|
3993 |
||
3994 |
||
3995 |
// ask the user to eject the media |
|
3996 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3997 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 3998 |
test.Printf(_L("Please eject media on drive %C...\n"), 'A' + driveNum); |
3999 |
User::WaitForRequest(reqStat); |
|
4000 |
test.Printf(_L("Done.\n")); |
|
4001 |
TInt reqInt=reqStat.Int(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4002 |
test_KErrNone(reqInt); |
0 | 4003 |
User::WaitForRequest(reqStat); |
4004 |
||
4005 |
// verify TDriveInfo.iType == EMediaNotPresent |
|
4006 |
r = fs.Drive(driveInfo, driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4007 |
test_KErrNone(r); |
0 | 4008 |
test.Printf(_L("iType = %d\n"), driveInfo.iType); |
4009 |
test(driveInfo.iType == EMediaNotPresent); |
|
4010 |
||
4011 |
||
4012 |
// ask the user to re-insert the media |
|
4013 |
TheFs.NotifyChange(ENotifyEntry,reqStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4014 |
test_Value(reqStat.Int(), reqStat==KRequestPending); |
0 | 4015 |
test.Printf(_L("Please re-insert media...\n")); |
4016 |
User::WaitForRequest(reqStat); |
|
4017 |
test.Printf(_L("Done.\n")); |
|
4018 |
reqInt = reqStat.Int(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4019 |
test_KErrNone(reqInt); |
0 | 4020 |
User::WaitForRequest(reqStat); |
4021 |
||
4022 |
// verify TDriveInfo.iType == EMediaHardDisk |
|
4023 |
r = fs.Drive(driveInfo, driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4024 |
test_KErrNone(r); |
0 | 4025 |
test.Printf(_L("iType = %d\n"), driveInfo.iType); |
4026 |
test(driveInfo.iType == EMediaHardDisk); |
|
4027 |
||
4028 |
fs.Close(); |
|
4029 |
} |
|
4030 |
#endif // __INCLUDE_MANUAL_TESTS__ |
|
4031 |
||
4032 |
||
4033 |
//--------------------------------------------- |
|
4034 |
//! @SYMTestCaseID PBASE-T_NOTIFY-0042 |
|
4035 |
//! @SYMTestType UT |
|
4036 |
//! @SYMREQ REQ5664 |
|
4037 |
//! @SYMTestCaseDesc Test asynchronous RFile API's |
|
4038 |
//! @SYMTestActions Test normal asynchronous read, share modes, read cancellation, race conditions |
|
4039 |
//! (with RFile::SetSize() and RFile::Write()), multiple asynchronous readers. |
|
4040 |
//! @SYMTestExpectedResults Expected behaviour reached. |
|
4041 |
//! @SYMTestPriority High |
|
4042 |
//! @SYMTestStatus Implemented |
|
4043 |
//--------------------------------------------- |
|
4044 |
static void TestAsyncReader() |
|
4045 |
// |
|
4046 |
// Test asynchronous read notifications |
|
4047 |
// |
|
4048 |
{ |
|
4049 |
TRequestStatus readStat1(KRequestPending); |
|
4050 |
TRequestStatus readStat2(KRequestPending); |
|
4051 |
TRequestStatus thrdStat(KRequestPending); |
|
4052 |
||
4053 |
MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt")); |
|
4054 |
||
4055 |
test.Next(_L("Test original behaviour of asynchronous read API")); |
|
4056 |
RFile reader; |
|
4057 |
TInt r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4058 |
test_KErrNone(r); |
0 | 4059 |
TBuf8<596> readBuf; |
4060 |
reader.Read(0, readBuf, 100, readStat1); |
|
4061 |
User::WaitForRequest(readStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4062 |
test_KErrNone(readStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4063 |
test_Equal(0, readBuf.Length()); |
0 | 4064 |
reader.Close(); |
4065 |
||
4066 |
test.Next(_L("Test asynchronous read fails in EFileShareExclusive mode")); |
|
4067 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4068 |
test_Value(r, r == KErrArgument); |
0 | 4069 |
|
4070 |
test.Next(_L("Test asynchronous read fails in EFileShareReadersOnly mode")); |
|
4071 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4072 |
test_Value(r, r == KErrArgument); |
0 | 4073 |
|
4074 |
test.Next(_L("Test asynchronous read is cancelled when file is closed")); |
|
4075 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4076 |
test_KErrNone(r); |
0 | 4077 |
reader.Read(0, readBuf, 100, readStat1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4078 |
test_Value(readStat1.Int(), readStat1==KRequestPending); |
0 | 4079 |
reader.Close(); |
4080 |
User::WaitForRequest(readStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4081 |
test_Value(readStat1.Int(), readStat1==KErrCancel); |
0 | 4082 |
|
4083 |
test.Next(_L("Test asynchronous read can be cancelled")); |
|
4084 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4085 |
test_KErrNone(r); |
0 | 4086 |
reader.Read(0, readBuf, 100, readStat1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4087 |
test_Value(readStat1.Int(), readStat1==KRequestPending); |
0 | 4088 |
reader.ReadCancel(readStat1); |
4089 |
User::WaitForRequest(readStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4090 |
test_Value(readStat1.Int(), readStat1==KErrCancel); |
0 | 4091 |
reader.Close(); |
4092 |
||
4093 |
// DEF105438: File server thread safety issues |
|
4094 |
// Up the priority of this thread so that we can cancel the request before the drive thread |
|
4095 |
// runs (to test whether cancelling still works...) |
|
4096 |
test.Next(_L("Test asynchronous read is cancelled when running at high priority")); |
|
4097 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4098 |
test_KErrNone(r); |
0 | 4099 |
RThread thisThread; |
4100 |
thisThread.SetPriority(EPriorityRealTime); |
|
4101 |
reader.Read(0, readBuf, 100, readStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4102 |
test_Value(readStat1.Int(), readStat1==KRequestPending); |
0 | 4103 |
reader.ReadCancel(readStat1); |
4104 |
test.Printf(_L("readStat1 %d"), readStat1.Int()); |
|
4105 |
User::WaitForRequest(readStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4106 |
test_Value(readStat1.Int(), readStat1==KErrCancel); |
0 | 4107 |
reader.Close(); |
4108 |
thisThread.SetPriority(EPriorityNormal); |
|
4109 |
||
4110 |
test.Next(_L("Test asynchronous read is notified due to RFile::SetSize()")); |
|
4111 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4112 |
test_KErrNone(r); |
0 | 4113 |
reader.Read(0, readBuf, 100, readStat1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4114 |
test_Value(readStat1.Int(), readStat1==KRequestPending); |
0 | 4115 |
r = reader.SetSize(100); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4116 |
test_KErrNone(r); |
0 | 4117 |
User::WaitForRequest(readStat1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4118 |
test_KErrNone(readStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4119 |
test_Equal(100, readBuf.Length()); |
0 | 4120 |
r=reader.SetSize(0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4121 |
test_KErrNone(r); |
0 | 4122 |
reader.Close(); |
4123 |
||
4124 |
test.Next(_L("Test asynchronous read is notified due to RFile::Write()")); |
|
4125 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4126 |
test_KErrNone(r); |
0 | 4127 |
reader.Read(0, readBuf, 26, readStat1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4128 |
test_Value(readStat1.Int(), readStat1==KRequestPending); |
0 | 4129 |
RFile writer; |
4130 |
r=writer.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny); |
|
4131 |
writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
|
4132 |
User::WaitForRequest(readStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4133 |
test_KErrNone(readStat1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4134 |
test_Equal(26, readBuf.Length()); |
0 | 4135 |
reader.Close(); |
4136 |
writer.Close(); |
|
4137 |
||
4138 |
test.Next(_L("Test multiple asynchronous readers notified from separate thread")); |
|
4139 |
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4140 |
test_KErrNone(r); |
0 | 4141 |
r=reader.SetSize(0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4142 |
test_KErrNone(r); |
0 | 4143 |
const TInt KReadLen = 26; |
4144 |
test.Printf(_L(">Read%d[%d]\n"), 0, KReadLen); |
|
4145 |
reader.Read(0, readBuf, KReadLen, readStat1); |
|
4146 |
TBuf8<596> readBuf2; |
|
4147 |
test.Printf(_L(">Read%d[%d]\n"), 1, KReadLen); |
|
4148 |
reader.Read(KReadLen, readBuf2, KReadLen, readStat2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4149 |
test_Value(readStat1.Int(), readStat1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4150 |
test_Value(readStat2.Int(), readStat2==KRequestPending); |
0 | 4151 |
|
4152 |
RThread thread; |
|
4153 |
r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest12); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4154 |
test_KErrNone(r); |
0 | 4155 |
thread.Logon(thrdStat); |
4156 |
thread.Resume(); |
|
4157 |
thread.Close(); |
|
4158 |
||
4159 |
RTimer timer; |
|
4160 |
TRequestStatus timerStat(KRequestPending); |
|
4161 |
timer.CreateLocal(); |
|
4162 |
timer.After(timerStat, 30000000); // 30 seconds timeout (the following async test should take 10 seconds) |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4163 |
test_Value(timerStat.Int(), timerStat==KRequestPending); |
0 | 4164 |
|
4165 |
#define ODDPASS (pass&0x01) |
|
4166 |
#define REQSTAT (ODDPASS ? readStat2 : readStat1) |
|
4167 |
#define PENDSTAT (ODDPASS ? readStat1 : readStat2) |
|
4168 |
#define COMPLEN (ODDPASS ? KReadLen : (pass+1)*KReadLen) |
|
4169 |
#define READLEN (ODDPASS ? KReadLen : (pass+3)*KReadLen) |
|
4170 |
#define READPOS (ODDPASS ? (pass+2)*KReadLen : 0) |
|
4171 |
#define READBUF (ODDPASS ? readBuf2 : readBuf) |
|
4172 |
||
4173 |
TInt pass = 0; |
|
4174 |
FOREVER |
|
4175 |
{ |
|
4176 |
User::WaitForRequest(REQSTAT, timerStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4177 |
test_KErrNone(REQSTAT.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4178 |
test_Value(timerStat.Int(), timerStat==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4179 |
test_Equal(COMPLEN, READBUF.Length()); |
0 | 4180 |
test(READBUF.Right(KReadLen) == _L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
4181 |
test.Printf(_L(">Read%d[%d]\n"), pass&0x01, READLEN); |
|
4182 |
reader.Read(READPOS, READBUF, READLEN, REQSTAT); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4183 |
test_Value(REQSTAT.Int(), REQSTAT==KRequestPending); |
0 | 4184 |
if(++pass==10) |
4185 |
break; |
|
4186 |
} |
|
4187 |
||
4188 |
test.Next(_L("Close reader and test multiple outstanding requests are cancelled")); |
|
4189 |
timer.Close(); |
|
4190 |
User::WaitForRequest(timerStat); |
|
4191 |
reader.Close(); |
|
4192 |
User::WaitForRequest(readStat1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4193 |
test_Value(readStat1.Int(), readStat1==KErrCancel); |
0 | 4194 |
User::WaitForRequest(readStat2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4195 |
test_Value(readStat2.Int(), readStat2==KErrCancel); |
0 | 4196 |
|
4197 |
User::WaitForRequest(thrdStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4198 |
test_KErrNone(thrdStat.Int()); |
0 | 4199 |
} |
4200 |
||
4201 |
||
4202 |
//----------------------------------------------------------------------- |
|
4203 |
||
4204 |
/** |
|
4205 |
Testing that TheFs.NotifyChange() works for the root directory of the drive |
|
4206 |
*/ |
|
4207 |
void TestRootDirNotifyChange() |
|
4208 |
{ |
|
4209 |
test.Next(_L("Testing RFs::NotifyChange() on drive's root directory.")); |
|
4210 |
||
4211 |
TInt nRes; |
|
4212 |
TRequestStatus reqStatNotify1(KRequestPending); |
|
4213 |
||
4214 |
_LIT(KTestPath, "\\"); //-- root dir, actually |
|
4215 |
||
4216 |
//-- set up notifier |
|
4217 |
TheFs.NotifyChange(ENotifyAll, reqStatNotify1, KTestPath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4218 |
test_Value(reqStatNotify1.Int(), reqStatNotify1 == KRequestPending); |
0 | 4219 |
|
4220 |
//-- create a file in the root dir |
|
4221 |
RFile file; |
|
4222 |
TFileName fileName(KTestPath); |
|
4223 |
||
4224 |
fileName.Append(_L("TestFile.tst")); |
|
4225 |
||
4226 |
nRes=file.Replace(TheFs, fileName, EFileWrite|EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4227 |
test_Value(nRes, nRes == KErrNone || nRes ==KErrAlreadyExists); |
0 | 4228 |
file.Close(); |
4229 |
||
4230 |
//-- check that the notifier worked |
|
4231 |
User::WaitForRequest(reqStatNotify1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4232 |
test_KErrNone(reqStatNotify1.Int()); |
0 | 4233 |
|
4234 |
} |
|
4235 |
||
4236 |
||
4237 |
||
4238 |
//----------------------------------------------------------------------- |
|
4239 |
||
4240 |
// |
|
4241 |
// Do all tests |
|
4242 |
// |
|
4243 |
GLDEF_C void CallTestsL() |
|
4244 |
{ |
|
4245 |
||
4246 |
CreateTestDirectory(_L("\\F32-TST\\NOTIFY\\")); |
|
4247 |
||
4248 |
// Test RFs::NotifyChange() |
|
4249 |
CHECK_NO_PENDING_REQUESTS; |
|
4250 |
Test1(); |
|
4251 |
CHECK_NO_PENDING_REQUESTS; |
|
4252 |
Test2(); |
|
4253 |
CHECK_NO_PENDING_REQUESTS; |
|
4254 |
Test3(); |
|
4255 |
CHECK_NO_PENDING_REQUESTS; |
|
4256 |
Test4(); |
|
4257 |
CHECK_NO_PENDING_REQUESTS; |
|
4258 |
Test5(); |
|
4259 |
CHECK_NO_PENDING_REQUESTS; |
|
4260 |
||
4261 |
#if defined (__EPOC32__)//we have no removable media on Emulator yet .. ??? we do now |
|
4262 |
#if defined __INCLUDE_MANUAL_TESTS__ |
|
4263 |
||
4264 |
// Media change notification on every socket supported |
|
4265 |
TInt i; |
|
4266 |
for (i=0; i<KMaxPBusSockets; i++) |
|
4267 |
SocketToDrive[i]=-1; |
|
4268 |
TDriveInfoV1Buf dinfo; |
|
4269 |
UserHal::DriveInfo(dinfo); |
|
4270 |
TDriveInfoV1 &di=dinfo(); |
|
4271 |
TInt driveCount=dinfo().iTotalSupportedDrives; |
|
4272 |
TInt socketCount=dinfo().iTotalSockets; |
|
4273 |
TInt drv; |
|
4274 |
test.Printf(_L("Socket count: %d\n"), socketCount); |
|
4275 |
TUint32 mask=~(0xffffffffu<<socketCount); |
|
4276 |
||
4277 |
for (drv=0; drv<driveCount; drv++) |
|
4278 |
{ |
|
4279 |
TBool flag=EFalse; |
|
4280 |
RLocalDrive d; |
|
4281 |
TInt r=d.Connect(drv,flag); |
|
4282 |
||
4283 |
//Not all the drives are used at present |
|
4284 |
if (r == KErrNotSupported) |
|
4285 |
continue; |
|
4286 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4287 |
test_KErrNone(r); |
0 | 4288 |
TInt sockNum = 0; |
4289 |
if (d.IsRemovable(sockNum)>0) |
|
4290 |
{ |
|
4291 |
if (mask & (1<<sockNum)) |
|
4292 |
{ |
|
4293 |
SocketToDrive[sockNum]=drv; |
|
4294 |
mask &= ~(1<<sockNum); |
|
4295 |
} |
|
4296 |
} |
|
4297 |
d.Close(); |
|
4298 |
} |
|
4299 |
||
4300 |
||
4301 |
// Manual media change test |
|
4302 |
for (gSocketNumber=socketCount-1; gSocketNumber>=0; gSocketNumber--) |
|
4303 |
{ |
|
4304 |
if (SocketToDrive[gSocketNumber] != -1) |
|
4305 |
{ |
|
4306 |
test.Printf(_L("Testing socket %u, drive %u...\n"), |
|
4307 |
gSocketNumber, SocketToDrive[gSocketNumber]); |
|
4308 |
Test99(); |
|
4309 |
} |
|
4310 |
} |
|
4311 |
#endif |
|
4312 |
Test6(); |
|
4313 |
#endif |
|
4314 |
CHECK_NO_PENDING_REQUESTS; |
|
4315 |
Test7(); |
|
4316 |
CHECK_NO_PENDING_REQUESTS; |
|
4317 |
||
4318 |
||
4319 |
#if defined (__EPOC32__)//we have no removable media on Emulator yet |
|
4320 |
||
4321 |
// Test RFs::NotifyChange() extended notification |
|
4322 |
TInt uid; |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4323 |
test_KErrNone(HAL::Get(HAL::EMachineUid,uid)); |
0 | 4324 |
if(uid!=HAL::EMachineUid_Cogent && uid!=HAL::EMachineUid_IQ80310 && |
4325 |
uid != HAL::EMachineUid_Integrator && uid!=HAL::EMachineUid_X86PC) |
|
4326 |
MediaChangeExtendedNotification(); |
|
4327 |
||
4328 |
#endif |
|
4329 |
||
4330 |
CHECK_NO_PENDING_REQUESTS; |
|
4331 |
TestRequestAhead(); |
|
4332 |
CHECK_NO_PENDING_REQUESTS; |
|
4333 |
Test8(); |
|
4334 |
CHECK_NO_PENDING_REQUESTS; |
|
4335 |
Test9(); |
|
4336 |
CHECK_NO_PENDING_REQUESTS; |
|
4337 |
Test10(); |
|
4338 |
CHECK_NO_PENDING_REQUESTS; |
|
4339 |
Test11(); |
|
4340 |
CHECK_NO_PENDING_REQUESTS; |
|
4341 |
Test12(); |
|
4342 |
CHECK_NO_PENDING_REQUESTS; |
|
4343 |
Test13(); |
|
4344 |
CHECK_NO_PENDING_REQUESTS; |
|
4345 |
Test14(); |
|
4346 |
CHECK_NO_PENDING_REQUESTS; |
|
4347 |
Test15(); |
|
4348 |
CHECK_NO_PENDING_REQUESTS; |
|
4349 |
Test16(); |
|
4350 |
CHECK_NO_PENDING_REQUESTS; |
|
4351 |
Test17(); |
|
4352 |
CHECK_NO_PENDING_REQUESTS; |
|
4353 |
Test18(); |
|
4354 |
CHECK_NO_PENDING_REQUESTS; |
|
4355 |
TestAsyncReader(); |
|
4356 |
CHECK_NO_PENDING_REQUESTS; |
|
4357 |
DeleteTestDirectory(); |
|
4358 |
CHECK_NO_PENDING_REQUESTS; |
|
4359 |
TestRootDirNotifyChange(); |
|
4360 |
CHECK_NO_PENDING_REQUESTS; |
|
4361 |
} |