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