kerneltest/f32test/server/t_notify.cpp
changeset 109 b3a1d9898418
parent 0 a41df078684a
child 200 73ea206103e6
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
    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"
   107 // Thread entry point
   108 // Thread entry point
   108 //
   109 //
   109 	{
   110 	{
   110 	RFs fs;
   111 	RFs fs;
   111 	TInt r=fs.Connect();
   112 	TInt r=fs.Connect();
   112 	test(r==KErrNone);
   113 	test_KErrNone(r);
   113 	r=fs.SetSessionPath(gSessionPath);
   114 	r=fs.SetSessionPath(gSessionPath);
   114 	test(r==KErrNone);
   115 	test_KErrNone(r);
   115 	TTestCode testCode=*(TTestCode*)&aTestCode;
   116 	TTestCode testCode=*(TTestCode*)&aTestCode;
   116 	RFile f;
   117 	RFile f;
   117 	switch (testCode)
   118 	switch (testCode)
   118 		{
   119 		{
   119 
   120 
   120 	case ETest1:
   121 	case ETest1:
   121 		r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream);
   122 		r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream);
   122 		test(r==KErrNone);
   123 		test_KErrNone(r);
   123 		f.Close();
   124 		f.Close();
   124 		break;
   125 		break;
   125 
   126 
   126 	case ETest2:
   127 	case ETest2:
   127 		r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileStream);
   128 		r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileStream);
   128 		test(r==KErrNone);
   129 		test_KErrNone(r);
   129 		f.Close();
   130 		f.Close();
   130 		break;
   131 		break;
   131 
   132 
   132 	case ETest3:
   133 	case ETest3:
   133 		r=fs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\"));
   134 		r=fs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\"));
   134 		test((r==KErrNone)||(r==KErrAlreadyExists));
   135 		test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   135 		break;
   136 		break;
   136 
   137 
   137 	case ETest4:
   138 	case ETest4:
   138 		{
   139 		{
   139 		TRequestStatus s;
   140 		TRequestStatus s;
   146 
   147 
   147 	case ETest5:
   148 	case ETest5:
   148 		{
   149 		{
   149 		RFile file;
   150 		RFile file;
   150 		TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
   151 		TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
   151 		test(r==KErrNone);
   152 		test_KErrNone(r);
   152 		r=file.SetSize(sizeof(TCheckedUid));
   153 		r=file.SetSize(sizeof(TCheckedUid));
   153 		test(r==KErrNone);
   154 		test_KErrNone(r);
   154 		r=file.Write(sizeof(TCheckedUid),_L8("012345678912"));
   155 		r=file.Write(sizeof(TCheckedUid),_L8("012345678912"));
   155 		test(r==KErrNone);
   156 		test_KErrNone(r);
   156 		TBuf8<64> dum;
   157 		TBuf8<64> dum;
   157 		r=file.Read(0,dum);
   158 		r=file.Read(0,dum);
   158 		test(r==KErrNone);
   159 		test_KErrNone(r);
   159 		file.Close();
   160 		file.Close();
   160 
   161 
   161 		r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
   162 		r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
   162 		test(r==KErrNone);
   163 		test_KErrNone(r);
   163 		r=file.SetSize(50);
   164 		r=file.SetSize(50);
   164 		test(r==KErrNone);
   165 		test_KErrNone(r);
   165 		r=file.Write(sizeof(TCheckedUid),_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
   166 		r=file.Write(sizeof(TCheckedUid),_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
   166 		test(r==KErrNone);
   167 		test_KErrNone(r);
   167 		r=file.Read(0,dum);
   168 		r=file.Read(0,dum);
   168 		test(r==KErrNone);
   169 		test_KErrNone(r);
   169 		file.Close();
   170 		file.Close();
   170 
   171 
   171 		r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
   172 		r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
   172 		test(r==KErrNone);
   173 		test_KErrNone(r);
   173 		r=file.SetSize(50);
   174 		r=file.SetSize(50);
   174 		test(r==KErrNone);
   175 		test_KErrNone(r);
   175 		r=file.Write(sizeof(TCheckedUid),_L8("01234567890123456789"));
   176 		r=file.Write(sizeof(TCheckedUid),_L8("01234567890123456789"));
   176 		test(r==KErrNone);
   177 		test_KErrNone(r);
   177 		r=file.Read(0,dum);
   178 		r=file.Read(0,dum);
   178 		test(r==KErrNone);
   179 		test_KErrNone(r);
   179 		file.Close();
   180 		file.Close();
   180 		gSleepThread.Signal();
   181 		gSleepThread.Signal();
   181 		}
   182 		}
   182 		break;
   183 		break;
   183 
   184 
   191 
   192 
   192 	case ETest7:
   193 	case ETest7:
   193 		{
   194 		{
   194 		RFile file;
   195 		RFile file;
   195 		TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFILE.TXT"),EFileRead|EFileWrite);
   196 		TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFILE.TXT"),EFileRead|EFileWrite);
   196 		test(r==KErrNone);
   197 		test_KErrNone(r);
   197 		r=file.Write(_L8("asdfasdfasdf"));
   198 		r=file.Write(_L8("asdfasdfasdf"));
   198 		test(r==KErrNone);
   199 		test_KErrNone(r);
   199 		file.Close();
   200 		file.Close();
   200 		gSleepThread.Signal();
   201 		gSleepThread.Signal();
   201 		}
   202 		}
   202 		break;
   203 		break;
   203 
   204 
   204 	case ETest8:
   205 	case ETest8:
   205 		{
   206 		{
   206 		r=f.Open(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileRead|EFileWrite);
   207 		r=f.Open(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileRead|EFileWrite);
   207 		test(r==KErrNone);
   208 		test_KErrNone(r);
   208 		f.SetSize(500);
   209 		f.SetSize(500);
   209 		f.Close();
   210 		f.Close();
   210 		break;
   211 		break;
   211 		}
   212 		}
   212 
   213 
   222 		break;
   223 		break;
   223 	case ETest10:
   224 	case ETest10:
   224 		{
   225 		{
   225 		TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
   226 		TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
   226 		r=fs.MkDir(path);
   227 		r=fs.MkDir(path);
   227 		test(r==KErrNone);
   228 		test_KErrNone(r);
   228 		break;
   229 		break;
   229 		}
   230 		}
   230 	case ETest11:
   231 	case ETest11:
   231 		{
   232 		{
   232 		TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
   233 		TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
   233 		RFile file;
   234 		RFile file;
   234 		r=file.Replace(fs,path,EFileStream);
   235 		r=file.Replace(fs,path,EFileStream);
   235 		test(r==KErrNone);
   236 		test_KErrNone(r);
   236 		file.Close();
   237 		file.Close();
   237 		break;
   238 		break;
   238 		}
   239 		}
   239 	case ETest12:
   240 	case ETest12:
   240 		{
   241 		{
   241 		RFile writer;
   242 		RFile writer;
   242 		TInt r=writer.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny);
   243 		TInt r=writer.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny);
   243 		test(r==KErrNone);
   244 		test_KErrNone(r);
   244 		TInt i;
   245 		TInt i;
   245 		for(i=0; i<10; i++)
   246 		for(i=0; i<10; i++)
   246 			{
   247 			{
   247 			r=writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
   248 			r=writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
   248 			test(r==KErrNone);
   249 			test_KErrNone(r);
   249 			User::After(1000000);
   250 			User::After(1000000);
   250 			}
   251 			}
   251 		writer.Close();
   252 		writer.Close();
   252 		break;
   253 		break;
   253 		}
   254 		}
   286 	TRequestStatus thrdStat(KRequestPending);
   287 	TRequestStatus thrdStat(KRequestPending);
   287 	TInt r;
   288 	TInt r;
   288 	TheFs.NotifyChange(ENotifyEntry,reqStat);
   289 	TheFs.NotifyChange(ENotifyEntry,reqStat);
   289 	RThread thread;
   290 	RThread thread;
   290 	r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
   291 	r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
   291 	test(r==KErrNone);
   292 	test_KErrNone(r);
   292 	thread.Logon(thrdStat);
   293 	thread.Logon(thrdStat);
   293 	thread.Resume();
   294 	thread.Resume();
   294 	User::WaitForRequest(thrdStat);
   295 	User::WaitForRequest(thrdStat);
   295 	test(thrdStat==KErrNone);
   296 	test(thrdStat==KErrNone);
   296 	thread.Close();
   297 	thread.Close();
   297 	User::WaitForRequest(reqStat);
   298 	User::WaitForRequest(reqStat);
   298 	test(reqStat==KErrNone);
   299 	test(reqStat==KErrNone);
   299 
   300 
   300 	RFile file;
   301 	RFile file;
   301 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite|EFileShareExclusive);
   302 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite|EFileShareExclusive);
   302 	test(r==KErrNone);
   303 	test_KErrNone(r);
   303 	file.Write(_L8("Somewhere over the rainbow..."),reqStat);
   304 	file.Write(_L8("Somewhere over the rainbow..."),reqStat);
   304 	User::WaitForRequest(reqStat);
   305 	User::WaitForRequest(reqStat);
   305 	test(reqStat==KErrNone);
   306 	test(reqStat==KErrNone);
   306 	TBuf8<256> buf;
   307 	TBuf8<256> buf;
   307 	file.Read(0, buf,reqStat);
   308 	file.Read(0, buf,reqStat);
   308 	User::WaitForRequest(reqStat);
   309 	User::WaitForRequest(reqStat);
   309 	test(reqStat==KErrNone);
   310 	test(reqStat==KErrNone);
   310 	file.Close();
   311 	file.Close();
   311 
   312 
   312 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive);
   313 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive);
   313 	test(r==KErrArgument);
   314 	test_Value(r, r == KErrArgument);
   314 
   315 
   315 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly);
   316 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly);
   316 	test(r==KErrArgument);
   317 	test_Value(r, r == KErrArgument);
   317 
   318 
   318 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
   319 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
   319 	test(r==KErrNone);
   320 	test_KErrNone(r);
   320 	file.Read(0, buf, 100, reqStat);
   321 	file.Read(0, buf, 100, reqStat);
   321 	test(reqStat==KRequestPending);
   322 	test(reqStat==KRequestPending);
   322 	file.Close();
   323 	file.Close();
   323 	User::WaitForRequest(reqStat);
   324 	User::WaitForRequest(reqStat);
   324 	test(reqStat==KErrCancel);
   325 	test(reqStat==KErrCancel);
   325 
   326 
   326 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
   327 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
   327 	test(r==KErrNone);
   328 	test_KErrNone(r);
   328 	file.Read(0, buf, 100, reqStat);
   329 	file.Read(0, buf, 100, reqStat);
   329 	test(reqStat==KRequestPending);
   330 	test(reqStat==KRequestPending);
   330 	file.ReadCancel(reqStat);
   331 	file.ReadCancel(reqStat);
   331 	User::WaitForRequest(reqStat);
   332 	User::WaitForRequest(reqStat);
   332 	test(reqStat==KErrCancel);
   333 	test(reqStat==KErrCancel);
   333 	file.Close();
   334 	file.Close();
   334 
   335 
   335 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
   336 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
   336 	test(r==KErrNone);
   337 	test_KErrNone(r);
   337 	file.Read(0, buf, 100, reqStat);
   338 	file.Read(0, buf, 100, reqStat);
   338 	test(reqStat==KRequestPending);
   339 	test(reqStat==KRequestPending);
   339 	file.SetSize(100);
   340 	file.SetSize(100);
   340 	User::WaitForRequest(reqStat);
   341 	User::WaitForRequest(reqStat);
   341 	test(reqStat==KErrNone);
   342 	test(reqStat==KErrNone);
   384 	test.Next(_L("Test notification of multiple clients"));
   385 	test.Next(_L("Test notification of multiple clients"));
   385 
   386 
   386 	TRequestStatus reqStat1(KRequestPending);
   387 	TRequestStatus reqStat1(KRequestPending);
   387 	RFs fs1;
   388 	RFs fs1;
   388 	TInt r=fs1.Connect();
   389 	TInt r=fs1.Connect();
   389 	test(r==KErrNone);
   390 	test_KErrNone(r);
   390 	fs1.NotifyChange(ENotifyEntry,reqStat1);
   391 	fs1.NotifyChange(ENotifyEntry,reqStat1);
   391 
   392 
   392 	TRequestStatus reqStat2(KRequestPending);
   393 	TRequestStatus reqStat2(KRequestPending);
   393 	RFs fs2;
   394 	RFs fs2;
   394 	r=fs2.Connect();
   395 	r=fs2.Connect();
   395 	test(r==KErrNone);
   396 	test_KErrNone(r);
   396 	fs2.NotifyChange(ENotifyEntry,reqStat2);
   397 	fs2.NotifyChange(ENotifyEntry,reqStat2);
   397 
   398 
   398 	test(reqStat1==KRequestPending);
   399 	test(reqStat1==KRequestPending);
   399 	test(reqStat2==KRequestPending);
   400 	test(reqStat2==KRequestPending);
   400 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
   401 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
   401 	test(r==KErrNone);
   402 	test_KErrNone(r);
   402 	User::WaitForRequest(reqStat1);
   403 	User::WaitForRequest(reqStat1);
   403 	User::WaitForRequest(reqStat2);
   404 	User::WaitForRequest(reqStat2);
   404 	test(reqStat1==KErrNone);
   405 	test(reqStat1==KErrNone);
   405 	test(reqStat2==KErrNone);
   406 	test(reqStat2==KErrNone);
   406 	}
   407 	}
   412 	{
   413 	{
   413 
   414 
   414 	test.Next(_L("Cancel notification"));
   415 	test.Next(_L("Cancel notification"));
   415 	RFs fs1;
   416 	RFs fs1;
   416 	TInt r=fs1.Connect();
   417 	TInt r=fs1.Connect();
   417 	test(r==KErrNone);
   418 	test_KErrNone(r);
   418 
   419 
   419 	TRequestStatus status1;
   420 	TRequestStatus status1;
   420 	TRequestStatus status2;
   421 	TRequestStatus status2;
   421 	TRequestStatus status3;
   422 	TRequestStatus status3;
   422 	TRequestStatus status4;
   423 	TRequestStatus status4;
   509 //
   510 //
   510 	{
   511 	{
   511 
   512 
   512 	test.Next(_L("Kill client"));
   513 	test.Next(_L("Kill client"));
   513 	TInt r=gSleepThread.CreateLocal(0);
   514 	TInt r=gSleepThread.CreateLocal(0);
   514 	test(r==KErrNone);
   515 	test_KErrNone(r);
   515 	RThread clientThread;
   516 	RThread clientThread;
   516 	r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest4);
   517 	r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest4);
   517 	if (r!=KErrNone)
   518 	if (r!=KErrNone)
   518 		{
   519 		{
   519 		test.Printf(_L(" ERROR: Failed to create clientthread %d\n"),r);
   520 		test.Printf(_L(" ERROR: Failed to create clientthread %d\n"),r);
   530 	User::SetJustInTime(jit);
   531 	User::SetJustInTime(jit);
   531 
   532 
   532 	clientThread.Close();
   533 	clientThread.Close();
   533 
   534 
   534 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\"));
   535 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\"));
   535 	test(r==KErrNone || r==KErrAlreadyExists);
   536 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   536 	MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
   537 	MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
   537 	User::After(1000);
   538 	User::After(1000);
   538 	}
   539 	}
   539 
   540 
   540 static void Test5()
   541 static void Test5()
   546 	test.Next(_L("Test reads and writes do not cause notification"));
   547 	test.Next(_L("Test reads and writes do not cause notification"));
   547 
   548 
   548 
   549 
   549 	RFile file;
   550 	RFile file;
   550 	TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
   551 	TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
   551 	test(r==KErrNone);
   552 	test_KErrNone(r);
   552 	file.Close();
   553 	file.Close();
   553 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
   554 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
   554 	test(r==KErrNone);
   555 	test_KErrNone(r);
   555 	file.Close();
   556 	file.Close();
   556 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
   557 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
   557 	test(r==KErrNone);
   558 	test_KErrNone(r);
   558 	file.Close();
   559 	file.Close();
   559 
   560 
   560 	TRequestStatus reqStat=0;
   561 	TRequestStatus reqStat=0;
   561 	TheFs.NotifyChange(ENotifyEntry,reqStat);
   562 	TheFs.NotifyChange(ENotifyEntry,reqStat);
   562 	test(reqStat==KRequestPending);
   563 	test(reqStat==KRequestPending);
   563 
   564 
   564 	r=gSleepThread.CreateLocal(0);
   565 	r=gSleepThread.CreateLocal(0);
   565 	test(r==KErrNone);
   566 	test_KErrNone(r);
   566 	RThread clientThread;
   567 	RThread clientThread;
   567 	r=clientThread.Create(_L("Test5Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
   568 	r=clientThread.Create(_L("Test5Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
   568 	test(r==KErrNone);
   569 	test_KErrNone(r);
   569 	clientThread.Resume();
   570 	clientThread.Resume();
   570 	gSleepThread.Wait();
   571 	gSleepThread.Wait();
   571 	test(reqStat==KRequestPending);
   572 	test(reqStat==KRequestPending);
   572 
   573 
   573 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
   574 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
   574 	test(r==KErrNone);
   575 	test_KErrNone(r);
   575 	User::WaitForRequest(reqStat);
   576 	User::WaitForRequest(reqStat);
   576 	test(reqStat==KErrNone);
   577 	test(reqStat==KErrNone);
   577 
   578 
   578 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
   579 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
   579 	test(r==KErrNone);
   580 	test_KErrNone(r);
   580 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
   581 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
   581 	test(r==KErrNone);
   582 	test_KErrNone(r);
   582 
   583 
   583 
   584 
   584 
   585 
   585 	gSleepThread.Close();
   586 	gSleepThread.Close();
   586 	clientThread.Close();
   587 	clientThread.Close();
   592 //	Test media change notification
   593 //	Test media change notification
   593 //
   594 //
   594 	{
   595 	{
   595 	TDriveInfo driveInfo;
   596 	TDriveInfo driveInfo;
   596 	TInt r=TheFs.Drive(driveInfo,CurrentDrive());
   597 	TInt r=TheFs.Drive(driveInfo,CurrentDrive());
   597 	test(r==KErrNone);
   598 	test_KErrNone(r);
   598 	// only test on removable media
   599 	// only test on removable media
   599 	if (driveInfo.iDriveAtt&KDriveAttRemovable)
   600 	if (driveInfo.iDriveAtt&KDriveAttRemovable)
   600         {
   601         {
   601         TBuf<64> b;
   602         TBuf<64> b;
   602         b.Format(_L("Test Media change notification (socket:%d)"),gSocketNumber);
   603         b.Format(_L("Test Media change notification (socket:%d)"),gSocketNumber);
   604         TRequestStatus reqStat=0;
   605         TRequestStatus reqStat=0;
   605         TInt r;
   606         TInt r;
   606         TheFs.NotifyChange(ENotifyEntry,reqStat);
   607         TheFs.NotifyChange(ENotifyEntry,reqStat);
   607         test(reqStat==KRequestPending);
   608         test(reqStat==KRequestPending);
   608         r=gSleepThread.CreateLocal(0);
   609         r=gSleepThread.CreateLocal(0);
   609         test(r==KErrNone);
   610         test_KErrNone(r);
   610         RThread clientThread;
   611         RThread clientThread;
   611         r=clientThread.Create(_L("Test6Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
   612         r=clientThread.Create(_L("Test6Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
   612         test(r==KErrNone);
   613         test_KErrNone(r);
   613         clientThread.Resume();
   614         clientThread.Resume();
   614         gSleepThread.Wait();
   615         gSleepThread.Wait();
   615         TInt reqInt=reqStat.Int();
   616         TInt reqInt=reqStat.Int();
   616         test(reqInt==KErrNone);
   617         test(reqInt==KErrNone);
   617         User::WaitForRequest(reqStat);
   618         User::WaitForRequest(reqStat);
   621         }
   622         }
   622 	
   623 	
   623         //-- it seems that after generating media change the meia driver isn't ready for some time
   624         //-- it seems that after generating media change the meia driver isn't ready for some time
   624         User::After(2000000);
   625         User::After(2000000);
   625 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   626 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   626 	    test(r==KErrNone);
   627 	    test_KErrNone(r);
   627 
   628 
   628     
   629     
   629     }
   630     }
   630 #endif
   631 #endif
   631 
   632 
   641 	TInt r;
   642 	TInt r;
   642 	TheFs.NotifyChange(ENotifyEntry,reqStat);
   643 	TheFs.NotifyChange(ENotifyEntry,reqStat);
   643 	test(reqStat==KRequestPending);
   644 	test(reqStat==KRequestPending);
   644 
   645 
   645 	r=gSleepThread.CreateLocal(0);
   646 	r=gSleepThread.CreateLocal(0);
   646 	test(r==KErrNone);
   647 	test_KErrNone(r);
   647 	RThread clientThread;
   648 	RThread clientThread;
   648 	r=clientThread.Create(_L("Test7Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest7);
   649 	r=clientThread.Create(_L("Test7Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest7);
   649 	test(r==KErrNone);
   650 	test_KErrNone(r);
   650 	clientThread.Resume();
   651 	clientThread.Resume();
   651 	gSleepThread.Wait();
   652 	gSleepThread.Wait();
   652 	test(reqStat==KRequestPending);
   653 	test(reqStat==KRequestPending);
   653 
   654 
   654 	r=TheFs.Delete(_L("Newfile.txt"));
   655 	r=TheFs.Delete(_L("Newfile.txt"));
   655 	test(r==KErrNone);
   656 	test_KErrNone(r);
   656 
   657 
   657 	User::WaitForRequest(reqStat);
   658 	User::WaitForRequest(reqStat);
   658 
   659 
   659 	gSleepThread.Close();
   660 	gSleepThread.Close();
   660 	clientThread.Close();
   661 	clientThread.Close();
   667 //	Always notified of media change - regardless of requested TNotifyType
   668 //	Always notified of media change - regardless of requested TNotifyType
   668 //
   669 //
   669 	{
   670 	{
   670 	TDriveInfo driveInfo;
   671 	TDriveInfo driveInfo;
   671 	TInt r=TheFs.Drive(driveInfo,CurrentDrive());
   672 	TInt r=TheFs.Drive(driveInfo,CurrentDrive());
   672 	test(r==KErrNone);
   673 	test_KErrNone(r);
   673 	// only test on removable media
   674 	// only test on removable media
   674 	if (driveInfo.iDriveAtt&KDriveAttRemovable)
   675 	if (driveInfo.iDriveAtt&KDriveAttRemovable)
   675 		{
   676 		{
   676 		test.Next(_L("Test Media change extended notification"));
   677 		test.Next(_L("Test Media change extended notification"));
   677 		TRequestStatus reqStat=0;
   678 		TRequestStatus reqStat=0;
   678 		TFileName path = _L("\\F32-tst\\NOTIFY\\");
   679 		TFileName path = _L("\\F32-tst\\NOTIFY\\");
   679 		TInt r;
   680 		TInt r;
   680 		TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   681 		TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   681 		test(reqStat==KRequestPending);
   682 		test(reqStat==KRequestPending);
   682 		r=gSleepThread.CreateLocal(0);
   683 		r=gSleepThread.CreateLocal(0);
   683 		test(r==KErrNone);
   684 		test_KErrNone(r);
   684 		RThread clientThread;
   685 		RThread clientThread;
   685 		gSocketNumber=0;
   686 		gSocketNumber=0;
   686 		r=clientThread.Create(_L("Test6Thread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);	//only generates a media change on removable media
   687 		r=clientThread.Create(_L("Test6Thread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);	//only generates a media change on removable media
   687 		test(r==KErrNone);
   688 		test_KErrNone(r);
   688 		clientThread.Resume();
   689 		clientThread.Resume();
   689 		gSleepThread.Wait();
   690 		gSleepThread.Wait();
   690 		User::WaitForRequest(reqStat);
   691 		User::WaitForRequest(reqStat);
   691 		test(reqStat==KErrNone);
   692 		test(reqStat==KErrNone);
   692 		WaitForMediaChange();
   693 		WaitForMediaChange();
   694 		clientThread.Close();
   695 		clientThread.Close();
   695 
   696 
   696         //-- it seems that after generating media change the meia driver isn't ready for some time
   697         //-- it seems that after generating media change the meia driver isn't ready for some time
   697         User::After(2000000);
   698         User::After(2000000);
   698 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   699 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   699 	    test(r==KErrNone);
   700 	    test_KErrNone(r);
   700 
   701 
   701 
   702 
   702 		TheFs.NotifyChange(ENotifyDisk,reqStat,path);
   703 		TheFs.NotifyChange(ENotifyDisk,reqStat,path);
   703 		test(reqStat==KRequestPending);
   704 		test(reqStat==KRequestPending);
   704 		r=gSleepThread.CreateLocal(0);
   705 		r=gSleepThread.CreateLocal(0);
   705 		test(r==KErrNone);
   706 		test_KErrNone(r);
   706 		r=clientThread.Create(_L("Test6Thread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
   707 		r=clientThread.Create(_L("Test6Thread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
   707 		test(r==KErrNone);
   708 		test_KErrNone(r);
   708 		clientThread.Resume();
   709 		clientThread.Resume();
   709 		gSleepThread.Wait();
   710 		gSleepThread.Wait();
   710 		User::WaitForRequest(reqStat);
   711 		User::WaitForRequest(reqStat);
   711 		test(reqStat==KErrNone);
   712 		test(reqStat==KErrNone);
   712 		WaitForMediaChange();
   713 		WaitForMediaChange();
   714 		clientThread.Close();
   715 		clientThread.Close();
   715 
   716 
   716         //-- it seems that after generating media change the meia driver isn't ready for some time
   717         //-- it seems that after generating media change the meia driver isn't ready for some time
   717         User::After(2000000);
   718         User::After(2000000);
   718 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   719 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   719 	    test(r==KErrNone);
   720 	    test_KErrNone(r);
   720 
   721 
   721 		TheFs.NotifyChange(ENotifyWrite,reqStat,path);
   722 		TheFs.NotifyChange(ENotifyWrite,reqStat,path);
   722 		test(reqStat==KRequestPending);
   723 		test(reqStat==KRequestPending);
   723 		r=gSleepThread.CreateLocal(0);
   724 		r=gSleepThread.CreateLocal(0);
   724 		test(r==KErrNone);
   725 		test_KErrNone(r);
   725 		r=clientThread.Create(_L("Test6Thread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
   726 		r=clientThread.Create(_L("Test6Thread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
   726 		test(r==KErrNone);
   727 		test_KErrNone(r);
   727 		clientThread.Resume();
   728 		clientThread.Resume();
   728 		gSleepThread.Wait();
   729 		gSleepThread.Wait();
   729 		User::WaitForRequest(reqStat);
   730 		User::WaitForRequest(reqStat);
   730 		test(reqStat==KErrNone);
   731 		test(reqStat==KErrNone);
   731 		WaitForMediaChange();
   732 		WaitForMediaChange();
   733 		clientThread.Close();
   734 		clientThread.Close();
   734 
   735 
   735         //-- it seems that after generating media change the meia driver isn't ready for some time
   736         //-- it seems that after generating media change the meia driver isn't ready for some time
   736         User::After(2000000);
   737         User::After(2000000);
   737 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   738 	    r=TheFs.Drive(driveInfo,CurrentDrive());
   738 	    test(r==KErrNone);
   739 	    test_KErrNone(r);
   739 
   740 
   740 		}
   741 		}
   741 	}
   742 	}
   742 #endif
   743 #endif
   743 
   744 
   748 	{
   749 	{
   749 	test.Next(_L("Test Request Ahead"));
   750 	test.Next(_L("Test Request Ahead"));
   750 //	First a simple example
   751 //	First a simple example
   751 
   752 
   752 	TInt r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"));
   753 	TInt r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"));
   753 	test((r==KErrNotFound)||(r==KErrPathNotFound)||(r==KErrNone));
   754 	test_Value(r, (r == KErrNotFound)||(r==KErrPathNotFound)||(r==KErrNone));
   754 
   755 
   755 	TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
   756 	TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
   756 	TRequestStatus reqStat(KRequestPending);
   757 	TRequestStatus reqStat(KRequestPending);
   757 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   758 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   758 	test(reqStat==KRequestPending);
   759 	test(reqStat==KRequestPending);
   759 
   760 
   760 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"));
   761 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"));
   761 	test(r==KErrNone);
   762 	test_KErrNone(r);
   762 
   763 
   763 	User::WaitForRequest(reqStat);
   764 	User::WaitForRequest(reqStat);
   764 	test(reqStat==KErrNone);
   765 	test(reqStat==KErrNone);
   765 
   766 
   766 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
   767 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
   767 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   768 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   768 	test(reqStat==KRequestPending);
   769 	test(reqStat==KRequestPending);
   769 
   770 
   770 	RFile file;
   771 	RFile file;
   771 	r=file.Replace(TheFs,path,EFileStream);
   772 	r=file.Replace(TheFs,path,EFileStream);
   772 	test(r==KErrNone);
   773 	test_KErrNone(r);
   773 	file.Close();
   774 	file.Close();
   774 
   775 
   775 	User::WaitForRequest(reqStat);
   776 	User::WaitForRequest(reqStat);
   776 	test(reqStat==KErrNone);
   777 	test(reqStat==KErrNone);
   777 
   778 
   778 	r=TheFs.Delete(path);
   779 	r=TheFs.Delete(path);
   779 	test(r==KErrNone);
   780 	test_KErrNone(r);
   780 
   781 
   781 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   782 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   782 	test(reqStat==KRequestPending);
   783 	test(reqStat==KRequestPending);
   783 //	Now cancel the outstanding request
   784 //	Now cancel the outstanding request
   784 	TheFs.NotifyChangeCancel(reqStat);
   785 	TheFs.NotifyChangeCancel(reqStat);
   788 //	Repeat with a ENotifyFile request
   789 //	Repeat with a ENotifyFile request
   789 	TheFs.NotifyChange(ENotifyFile,reqStat,path);
   790 	TheFs.NotifyChange(ENotifyFile,reqStat,path);
   790 	test(reqStat==KRequestPending);
   791 	test(reqStat==KRequestPending);
   791 
   792 
   792 	r=file.Replace(TheFs,path,EFileStream);
   793 	r=file.Replace(TheFs,path,EFileStream);
   793 	test(r==KErrNone);
   794 	test_KErrNone(r);
   794 	file.Close();
   795 	file.Close();
   795 
   796 
   796 	User::WaitForRequest(reqStat);
   797 	User::WaitForRequest(reqStat);
   797 	test(reqStat==KErrNone);
   798 	test(reqStat==KErrNone);
   798 
   799 
   799 	r=TheFs.Delete(path);
   800 	r=TheFs.Delete(path);
   800 	test(r==KErrNone);
   801 	test_KErrNone(r);
   801 
   802 
   802 	TheFs.NotifyChange(ENotifyFile,reqStat,path);
   803 	TheFs.NotifyChange(ENotifyFile,reqStat,path);
   803 	test(reqStat==KRequestPending);
   804 	test(reqStat==KRequestPending);
   804 //	Now cancel the outstanding request
   805 //	Now cancel the outstanding request
   805 	TheFs.NotifyChangeCancel(reqStat);
   806 	TheFs.NotifyChangeCancel(reqStat);
   809 //	Repeat with an ENotifyAttributes request
   810 //	Repeat with an ENotifyAttributes request
   810 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
   811 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
   811 	test(reqStat==KRequestPending);
   812 	test(reqStat==KRequestPending);
   812 
   813 
   813 	r=file.Replace(TheFs,path,EFileStream);
   814 	r=file.Replace(TheFs,path,EFileStream);
   814 	test(r==KErrNone);
   815 	test_KErrNone(r);
   815 	file.Close();
   816 	file.Close();
   816 
   817 
   817 	User::WaitForRequest(reqStat);
   818 	User::WaitForRequest(reqStat);
   818 	test(reqStat==KErrNone);	//	Monitoring attributes but informed anyway
   819 	test(reqStat==KErrNone);	//	Monitoring attributes but informed anyway
   819 
   820 
   820 	r=TheFs.Delete(path);
   821 	r=TheFs.Delete(path);
   821 	test(r==KErrNone);
   822 	test_KErrNone(r);
   822 
   823 
   823 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
   824 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
   824 	test(reqStat==KRequestPending);
   825 	test(reqStat==KRequestPending);
   825 //	Now cancel the outstanding request
   826 //	Now cancel the outstanding request
   826 	TheFs.NotifyChangeCancel(reqStat);
   827 	TheFs.NotifyChangeCancel(reqStat);
   830 //	Repeat with an ENotifyWrite request
   831 //	Repeat with an ENotifyWrite request
   831 	TheFs.NotifyChange(ENotifyWrite,reqStat,path);
   832 	TheFs.NotifyChange(ENotifyWrite,reqStat,path);
   832 	test(reqStat==KRequestPending);
   833 	test(reqStat==KRequestPending);
   833 
   834 
   834 	r=file.Replace(TheFs,path,EFileStream);
   835 	r=file.Replace(TheFs,path,EFileStream);
   835 	test(r==KErrNone);
   836 	test_KErrNone(r);
   836 	file.Close();
   837 	file.Close();
   837 
   838 
   838 	User::WaitForRequest(reqStat);
   839 	User::WaitForRequest(reqStat);
   839 	test(reqStat==KErrNone);	//	Monitoring file writing but informed anyway
   840 	test(reqStat==KErrNone);	//	Monitoring file writing but informed anyway
   840 
   841 
   841 	r=TheFs.Delete(path);
   842 	r=TheFs.Delete(path);
   842 	test(r==KErrNone);
   843 	test_KErrNone(r);
   843 
   844 
   844 	TheFs.NotifyChange(ENotifyWrite,reqStat,path);
   845 	TheFs.NotifyChange(ENotifyWrite,reqStat,path);
   845 	test(reqStat==KRequestPending);
   846 	test(reqStat==KRequestPending);
   846 //	Now cancel the outstanding request
   847 //	Now cancel the outstanding request
   847 	TheFs.NotifyChangeCancel(reqStat);
   848 	TheFs.NotifyChangeCancel(reqStat);
   851 //	Repeat with an ENotifyDisk request
   852 //	Repeat with an ENotifyDisk request
   852 	TheFs.NotifyChange(ENotifyDisk,reqStat,path);
   853 	TheFs.NotifyChange(ENotifyDisk,reqStat,path);
   853 	test(reqStat==KRequestPending);
   854 	test(reqStat==KRequestPending);
   854 
   855 
   855 	r=file.Replace(TheFs,path,EFileStream);
   856 	r=file.Replace(TheFs,path,EFileStream);
   856 	test(r==KErrNone);
   857 	test_KErrNone(r);
   857 	file.Close();
   858 	file.Close();
   858 
   859 
   859 	User::WaitForRequest(reqStat);
   860 	User::WaitForRequest(reqStat);
   860 	test(reqStat==KErrNone);	//	Monitoring disk activity but informed anyway
   861 	test(reqStat==KErrNone);	//	Monitoring disk activity but informed anyway
   861 
   862 
   862 	r=TheFs.Delete(path);
   863 	r=TheFs.Delete(path);
   863 	test(r==KErrNone);
   864 	test_KErrNone(r);
   864 
   865 
   865 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
   866 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
   866 	test(reqStat==KRequestPending);
   867 	test(reqStat==KRequestPending);
   867 //	Now cancel the outstanding request
   868 //	Now cancel the outstanding request
   868 	TheFs.NotifyChangeCancel(reqStat);
   869 	TheFs.NotifyChangeCancel(reqStat);
   875 
   876 
   876 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
   877 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
   877 	test(reqStat==KRequestPending);
   878 	test(reqStat==KRequestPending);
   878 
   879 
   879 	TheFs.MkDir(path);
   880 	TheFs.MkDir(path);
   880 	test(r==KErrNone);
   881 	test_KErrNone(r);
   881 
   882 
   882 	User::WaitForRequest(reqStat);
   883 	User::WaitForRequest(reqStat);
   883 	test(reqStat==KErrNone);
   884 	test(reqStat==KErrNone);
   884 
   885 
   885 	TheFs.RmDir(path);
   886 	TheFs.RmDir(path);
   886 	test(r==KErrNone);
   887 	test_KErrNone(r);
   887 
   888 
   888 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
   889 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
   889 	test(r==KErrNone);
   890 	test_KErrNone(r);
   890 	test(reqStat==KRequestPending);
   891 	test(reqStat==KRequestPending);
   891 
   892 
   892 //	Now cancel the outstanding request
   893 //	Now cancel the outstanding request
   893 	TheFs.NotifyChangeCancel(reqStat);
   894 	TheFs.NotifyChangeCancel(reqStat);
   894 	User::WaitForRequest(reqStat);
   895 	User::WaitForRequest(reqStat);
   895 	test(reqStat==KErrCancel);
   896 	test(reqStat==KErrCancel);
   896 
   897 
   897 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
   898 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
   898 	test(r==KErrNone);
   899 	test_KErrNone(r);
   899 	test(reqStat==KRequestPending);
   900 	test(reqStat==KRequestPending);
   900 
   901 
   901 //	Get a separate thread to create the directory
   902 //	Get a separate thread to create the directory
   902 	RThread thread;
   903 	RThread thread;
   903 	thread.Create(_L("RequestAheadyThready"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10);
   904 	thread.Create(_L("RequestAheadyThready"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10);
   910 	test(thrdStat==KErrNone);
   911 	test(thrdStat==KErrNone);
   911 	User::WaitForRequest(reqStat);
   912 	User::WaitForRequest(reqStat);
   912 	test(reqStat==KErrNone);
   913 	test(reqStat==KErrNone);
   913 
   914 
   914 	TheFs.RmDir(path);
   915 	TheFs.RmDir(path);
   915 	test(r==KErrNone);
   916 	test_KErrNone(r);
   916 
   917 
   917 //	Check that notification is not received for a non-existent file if only the previously
   918 //	Check that notification is not received for a non-existent file if only the previously
   918 //	non existent directory that contains it is created
   919 //	non existent directory that contains it is created
   919 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
   920 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
   920 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   921 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   921 	test(r==KErrNone);
   922 	test_KErrNone(r);
   922 	test(reqStat==KRequestPending);
   923 	test(reqStat==KRequestPending);
   923 
   924 
   924 	thread.Create(_L("RequestAheadThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10);
   925 	thread.Create(_L("RequestAheadThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10);
   925 	thread.Logon(thrdStat);
   926 	thread.Logon(thrdStat);
   926 	thread.Resume();
   927 	thread.Resume();
   940 
   941 
   941 	User::WaitForRequest(reqStat);
   942 	User::WaitForRequest(reqStat);
   942 	test(reqStat==KErrNone);
   943 	test(reqStat==KErrNone);
   943 
   944 
   944 	TheFs.Delete(path);
   945 	TheFs.Delete(path);
   945 	test(r==KErrNone);
   946 	test_KErrNone(r);
   946 
   947 
   947 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   948 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   948 	test(r==KErrNone);
   949 	test_KErrNone(r);
   949 	test(reqStat==KRequestPending);
   950 	test(reqStat==KRequestPending);
   950 
   951 
   951 //	Now cancel the outstanding request
   952 //	Now cancel the outstanding request
   952 	TheFs.NotifyChangeCancel(reqStat);
   953 	TheFs.NotifyChangeCancel(reqStat);
   953 	User::WaitForRequest(reqStat);
   954 	User::WaitForRequest(reqStat);
   954 	test(reqStat==KErrCancel);
   955 	test(reqStat==KErrCancel);
   955 
   956 
   956 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
   957 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
   957 	TheFs.RmDir(path);
   958 	TheFs.RmDir(path);
   958 	test(r==KErrNone);
   959 	test_KErrNone(r);
   959 	}
   960 	}
   960 
   961 
   961 
   962 
   962 static void Test8()
   963 static void Test8()
   963 //
   964 //
   972 
   973 
   973 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   974 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   974 	test(reqStat==KRequestPending);
   975 	test(reqStat==KRequestPending);
   975 	RThread thread;
   976 	RThread thread;
   976 	TInt r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
   977 	TInt r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
   977 	test(r==KErrNone);
   978 	test_KErrNone(r);
   978 	thread.Logon(thrdStat);
   979 	thread.Logon(thrdStat);
   979 	thread.Resume();
   980 	thread.Resume();
   980 	User::WaitForRequest(thrdStat);
   981 	User::WaitForRequest(thrdStat);
   981 	test(thrdStat==KErrNone);
   982 	test(thrdStat==KErrNone);
   982 	User::WaitForRequest(reqStat);
   983 	User::WaitForRequest(reqStat);
   986 //	Repeat the test
   987 //	Repeat the test
   987 	test.Next(_L("Repeat Test notification of an entry change"));
   988 	test.Next(_L("Repeat Test notification of an entry change"));
   988 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   989 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
   989 	test(reqStat==KRequestPending);
   990 	test(reqStat==KRequestPending);
   990 	r=thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
   991 	r=thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
   991 	test(r==KErrNone);
   992 	test_KErrNone(r);
   992 	thread.Logon(thrdStat);
   993 	thread.Logon(thrdStat);
   993 	thread.Resume();
   994 	thread.Resume();
   994 	User::WaitForRequest(thrdStat);
   995 	User::WaitForRequest(thrdStat);
   995 	test(thrdStat==KErrNone);
   996 	test(thrdStat==KErrNone);
   996 	User::WaitForRequest(reqStat);
   997 	User::WaitForRequest(reqStat);
  1008 //	Test it can be notified again
  1009 //	Test it can be notified again
  1009 	test.Next(_L("Test notification still works"));
  1010 	test.Next(_L("Test notification still works"));
  1010 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1011 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1011 	test(reqStat==KRequestPending);
  1012 	test(reqStat==KRequestPending);
  1012 	r=thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1013 	r=thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1013 	test(r==KErrNone);
  1014 	test_KErrNone(r);
  1014 	thread.Logon(thrdStat);
  1015 	thread.Logon(thrdStat);
  1015 	thread.Resume();
  1016 	thread.Resume();
  1016 	User::WaitForRequest(thrdStat);
  1017 	User::WaitForRequest(thrdStat);
  1017 	test(thrdStat==KErrNone);
  1018 	test(thrdStat==KErrNone);
  1018 	User::WaitForRequest(reqStat);
  1019 	User::WaitForRequest(reqStat);
  1022 //	Test notification doesn't occur when a change occurs above the directory monitored
  1023 //	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
  1024 //	(Notification of rename events occurring above the directory which affect the path
  1024 //	will occur - this is tested for in Test18())
  1025 //	will occur - this is tested for in Test18())
  1025 	test.Next(_L("Test changing above monitored directory"));
  1026 	test.Next(_L("Test changing above monitored directory"));
  1026 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1027 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1027 	test((r==KErrNone)||(r==KErrAlreadyExists));
  1028 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
  1028 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1029 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1029 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1030 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1030 	test(reqStat==KRequestPending);
  1031 	test(reqStat==KRequestPending);
  1031 	r=thread.Create(_L("MyThread4"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1032 	r=thread.Create(_L("MyThread4"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1032 	test(r==KErrNone);
  1033 	test_KErrNone(r);
  1033 	thread.Logon(thrdStat);
  1034 	thread.Logon(thrdStat);
  1034 	thread.Resume();
  1035 	thread.Resume();
  1035 	User::WaitForRequest(thrdStat);
  1036 	User::WaitForRequest(thrdStat);
  1036 	test(thrdStat==KErrNone);
  1037 	test(thrdStat==KErrNone);
  1037 	User::After(500000);
  1038 	User::After(500000);
  1044 //	Test notification occurs when a change is made to the subdirectory monitored
  1045 //	Test notification occurs when a change is made to the subdirectory monitored
  1045 	test.Next(_L("Create a file in monitored subdirectory"));
  1046 	test.Next(_L("Create a file in monitored subdirectory"));
  1046 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1047 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1047 	test(reqStat==KRequestPending);
  1048 	test(reqStat==KRequestPending);
  1048 	r=thread.Create(_L("MyThread5"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2);
  1049 	r=thread.Create(_L("MyThread5"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2);
  1049 	test(r==KErrNone);
  1050 	test_KErrNone(r);
  1050 	thread.Logon(thrdStat);
  1051 	thread.Logon(thrdStat);
  1051 	thread.Resume();
  1052 	thread.Resume();
  1052 	User::WaitForRequest(thrdStat);
  1053 	User::WaitForRequest(thrdStat);
  1053 	test(thrdStat==KErrNone);
  1054 	test(thrdStat==KErrNone);
  1054 	User::WaitForRequest(reqStat);
  1055 	User::WaitForRequest(reqStat);
  1057 
  1058 
  1058 	test.Next(_L("Create a directory in monitored subdirectory"));
  1059 	test.Next(_L("Create a directory in monitored subdirectory"));
  1059 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1060 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1060 	test(reqStat==KRequestPending);
  1061 	test(reqStat==KRequestPending);
  1061 	r=thread.Create(_L("MyThread6"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest3);
  1062 	r=thread.Create(_L("MyThread6"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest3);
  1062 	test(r==KErrNone);
  1063 	test_KErrNone(r);
  1063 	thread.Logon(thrdStat);
  1064 	thread.Logon(thrdStat);
  1064 	thread.Resume();
  1065 	thread.Resume();
  1065 	User::WaitForRequest(thrdStat);
  1066 	User::WaitForRequest(thrdStat);
  1066 	test(thrdStat==KErrNone);
  1067 	test(thrdStat==KErrNone);
  1067 	User::WaitForRequest(reqStat);
  1068 	User::WaitForRequest(reqStat);
  1069 	thread.Close();
  1070 	thread.Close();
  1070 
  1071 
  1071 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1072 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1072 	test(reqStat==KRequestPending);
  1073 	test(reqStat==KRequestPending);
  1073 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
  1074 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
  1074 	test(r==KErrNone);
  1075 	test_KErrNone(r);
  1075 	User::WaitForRequest(reqStat);
  1076 	User::WaitForRequest(reqStat);
  1076 	test(reqStat==KErrNone);
  1077 	test(reqStat==KErrNone);
  1077 
  1078 
  1078 
  1079 
  1079 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
  1080 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
  1080 	test(r==KErrNone);
  1081 	test_KErrNone(r);
  1081 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\"));
  1082 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\"));
  1082 	test(r==KErrNone);
  1083 	test_KErrNone(r);
  1083 
  1084 
  1084 //	Test again that notification doesn't occur above the subdirectory being monitored
  1085 //	Test again that notification doesn't occur above the subdirectory being monitored
  1085 	test.Next(_L("Test changing above monitored directory"));
  1086 	test.Next(_L("Test changing above monitored directory"));
  1086 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1087 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1087 	test((r==KErrNone)||(r==KErrAlreadyExists));
  1088 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
  1088 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1089 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1089 
  1090 
  1090 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1091 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1091 	test(reqStat==KRequestPending);
  1092 	test(reqStat==KRequestPending);
  1092 	r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1093 	r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1093 	test(r==KErrNone);
  1094 	test_KErrNone(r);
  1094 	thread.Logon(thrdStat);
  1095 	thread.Logon(thrdStat);
  1095 	thread.Resume();
  1096 	thread.Resume();
  1096 	User::WaitForRequest(thrdStat);
  1097 	User::WaitForRequest(thrdStat);
  1097 	test(thrdStat==KErrNone);
  1098 	test(thrdStat==KErrNone);
  1098 	User::After(500000);
  1099 	User::After(500000);
  1105 //	Test notification occurs when a change is made to the subdirectory monitored
  1106 //	Test notification occurs when a change is made to the subdirectory monitored
  1106 	test.Next(_L("Delete a file in monitored subdirectory"));
  1107 	test.Next(_L("Delete a file in monitored subdirectory"));
  1107 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1108 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1108 	test(reqStat==KRequestPending);
  1109 	test(reqStat==KRequestPending);
  1109 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
  1110 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
  1110 	test(r==KErrNone);
  1111 	test_KErrNone(r);
  1111 	User::WaitForRequest(reqStat);
  1112 	User::WaitForRequest(reqStat);
  1112 	test(reqStat==KErrNone);
  1113 	test(reqStat==KErrNone);
  1113 
  1114 
  1114 	RFile file;
  1115 	RFile file;
  1115 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream);
  1116 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream);
  1116 	test(r==KErrNone);
  1117 	test_KErrNone(r);
  1117 	file.Close();
  1118 	file.Close();
  1118 
  1119 
  1119 //	Test notification on a specific file
  1120 //	Test notification on a specific file
  1120 	test.Next(_L("Monitor changes to a specific file"));
  1121 	test.Next(_L("Monitor changes to a specific file"));
  1121 	path+=_L("WickedWitch.msg");
  1122 	path+=_L("WickedWitch.msg");
  1122 	TheFs.NotifyChange(ENotifyAll,reqStat,path);
  1123 	TheFs.NotifyChange(ENotifyAll,reqStat,path);
  1123 	test(reqStat==KRequestPending);
  1124 	test(reqStat==KRequestPending);
  1124 	r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
  1125 	r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
  1125 	test(r==KErrNone);
  1126 	test_KErrNone(r);
  1126 	thread.Logon(thrdStat);
  1127 	thread.Logon(thrdStat);
  1127 	thread.Resume();
  1128 	thread.Resume();
  1128 	User::WaitForRequest(thrdStat);
  1129 	User::WaitForRequest(thrdStat);
  1129 	test(thrdStat==KErrNone);
  1130 	test(thrdStat==KErrNone);
  1130 	User::WaitForRequest(reqStat);
  1131 	User::WaitForRequest(reqStat);
  1149 //	Test notification occurs when a change is made to the file
  1150 //	Test notification occurs when a change is made to the file
  1150 	test.Next(_L("Delete monitored file"));
  1151 	test.Next(_L("Delete monitored file"));
  1151 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1152 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1152 	test(reqStat==KRequestPending);
  1153 	test(reqStat==KRequestPending);
  1153 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
  1154 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
  1154 	test(r==KErrNone);
  1155 	test_KErrNone(r);
  1155 	User::WaitForRequest(reqStat);
  1156 	User::WaitForRequest(reqStat);
  1156 	test(reqStat==KErrNone);
  1157 	test(reqStat==KErrNone);
  1157 
  1158 
  1158 //	Test notification request is now submitted on the non existent path successfully
  1159 //	Test notification request is now submitted on the non existent path successfully
  1159 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1160 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1164 
  1165 
  1165 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc");
  1166 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc");
  1166 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1167 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1167 	test(reqStat==KRequestPending);
  1168 	test(reqStat==KRequestPending);
  1168 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"));
  1169 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"));
  1169 	test(r==KErrNone);
  1170 	test_KErrNone(r);
  1170 	User::WaitForRequest(reqStat);
  1171 	User::WaitForRequest(reqStat);
  1171 	test(reqStat==KErrNone);
  1172 	test(reqStat==KErrNone);
  1172 
  1173 
  1173 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1174 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1174 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1175 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1175 	test(reqStat==KRequestPending);
  1176 	test(reqStat==KRequestPending);
  1176 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1177 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1177 	test(r==KErrNone);
  1178 	test_KErrNone(r);
  1178 	User::WaitForRequest(reqStat);
  1179 	User::WaitForRequest(reqStat);
  1179 	test(reqStat==KErrNone);
  1180 	test(reqStat==KErrNone);
  1180 
  1181 
  1181 //	Submit a request for a path which does not yet exist
  1182 //	Submit a request for a path which does not yet exist
  1182 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
  1183 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
  1183 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1184 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1184 	test(reqStat==KRequestPending);
  1185 	test(reqStat==KRequestPending);
  1185 //	Now create the directory we are waiting on
  1186 //	Now create the directory we are waiting on
  1186 	r=TheFs.MkDir(path);
  1187 	r=TheFs.MkDir(path);
  1187 	test(r==KErrNone);
  1188 	test_KErrNone(r);
  1188 //	Make sure the notification has now been received
  1189 //	Make sure the notification has now been received
  1189 	User::WaitForRequest(reqStat);
  1190 	User::WaitForRequest(reqStat);
  1190 	test(reqStat==KErrNone);
  1191 	test(reqStat==KErrNone);
  1191 
  1192 
  1192 //	Submit a request for a file which does not yet exist
  1193 //	Submit a request for a file which does not yet exist
  1193 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\Red-Shoes.red");
  1194 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\Red-Shoes.red");
  1194 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1195 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1195 	test(reqStat==KRequestPending);
  1196 	test(reqStat==KRequestPending);
  1196 //	Now create the file we are waiting on
  1197 //	Now create the file we are waiting on
  1197 	r=file.Replace(TheFs,path,EFileStream);
  1198 	r=file.Replace(TheFs,path,EFileStream);
  1198 	test(r==KErrNone);
  1199 	test_KErrNone(r);
  1199 	file.Close();
  1200 	file.Close();
  1200 //	Make sure the notification has now been received
  1201 //	Make sure the notification has now been received
  1201 	User::WaitForRequest(reqStat);
  1202 	User::WaitForRequest(reqStat);
  1202 	test(reqStat==KErrNone);
  1203 	test(reqStat==KErrNone);
  1203 //	Submit another notification request and delete the file
  1204 //	Submit another notification request and delete the file
  1204 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1205 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1205 	test(reqStat==KRequestPending);
  1206 	test(reqStat==KRequestPending);
  1206 	r=TheFs.Delete(path);
  1207 	r=TheFs.Delete(path);
  1207 	test(r==KErrNone);
  1208 	test_KErrNone(r);
  1208 	User::WaitForRequest(reqStat);
  1209 	User::WaitForRequest(reqStat);
  1209 	test(reqStat==KErrNone);
  1210 	test(reqStat==KErrNone);
  1210 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
  1211 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
  1211 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1212 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
  1212 	test(reqStat==KRequestPending);
  1213 	test(reqStat==KRequestPending);
  1213 	r=TheFs.RmDir(path);
  1214 	r=TheFs.RmDir(path);
  1214 	test(r==KErrNone);
  1215 	test_KErrNone(r);
  1215 	User::WaitForRequest(reqStat);
  1216 	User::WaitForRequest(reqStat);
  1216 	test(reqStat==KErrNone);
  1217 	test(reqStat==KErrNone);
  1217 	// test passing in an empty string
  1218 	// test passing in an empty string
  1218 	TheFs.NotifyChange(ENotifyEntry,reqStat,_L(""));
  1219 	TheFs.NotifyChange(ENotifyEntry,reqStat,_L(""));
  1219 	User::WaitForRequest(reqStat);
  1220 	User::WaitForRequest(reqStat);
  1229 	test.Next(_L("Test notification of multiple clients"));
  1230 	test.Next(_L("Test notification of multiple clients"));
  1230 
  1231 
  1231 //	Create five sessions monitoring various levels of a directory tree
  1232 //	Create five sessions monitoring various levels of a directory tree
  1232 
  1233 
  1233 	TInt r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\"));
  1234 	TInt r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\"));
  1234 	test((r==KErrNone)||(r==KErrAlreadyExists));
  1235 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
  1235 	RFile file;
  1236 	RFile file;
  1236 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"),EFileStream);
  1237 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"),EFileStream);
  1237 	test(r==KErrNone);
  1238 	test_KErrNone(r);
  1238 	file.Close();
  1239 	file.Close();
  1239 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"),EFileStream);
  1240 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"),EFileStream);
  1240 	test(r==KErrNone);
  1241 	test_KErrNone(r);
  1241 	file.Close();
  1242 	file.Close();
  1242 
  1243 
  1243 	TFileName path1=_L("\\F32-TST\\");
  1244 	TFileName path1=_L("\\F32-TST\\");
  1244 	TFileName path2=_L("\\F32-TST\\NOTIFY\\");
  1245 	TFileName path2=_L("\\F32-TST\\NOTIFY\\");
  1245 	TFileName path3=_L("\\F32-TST\\NOTIFY\\ANIMAL\\");
  1246 	TFileName path3=_L("\\F32-TST\\NOTIFY\\ANIMAL\\");
  1248 	TFileName path6=_L("?:\\F32-TST\\");
  1249 	TFileName path6=_L("?:\\F32-TST\\");
  1249 
  1250 
  1250 	TRequestStatus reqStat1(KRequestPending);
  1251 	TRequestStatus reqStat1(KRequestPending);
  1251 	RFs fs1;
  1252 	RFs fs1;
  1252 	r=fs1.Connect();
  1253 	r=fs1.Connect();
  1253 	test(r==KErrNone);
  1254 	test_KErrNone(r);
  1254 	r=fs1.SetSessionPath(gSessionPath);
  1255 	r=fs1.SetSessionPath(gSessionPath);
  1255 	test(r==KErrNone);
  1256 	test_KErrNone(r);
  1256 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1257 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1257 
  1258 
  1258 	TRequestStatus reqStat2(KRequestPending);
  1259 	TRequestStatus reqStat2(KRequestPending);
  1259 	RFs fs2;
  1260 	RFs fs2;
  1260 	r=fs2.Connect();
  1261 	r=fs2.Connect();
  1261 	test(r==KErrNone);
  1262 	test_KErrNone(r);
  1262 	r=fs2.SetSessionPath(gSessionPath);
  1263 	r=fs2.SetSessionPath(gSessionPath);
  1263 	test(r==KErrNone);
  1264 	test_KErrNone(r);
  1264 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
  1265 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
  1265 
  1266 
  1266 	TRequestStatus reqStat3(KRequestPending);
  1267 	TRequestStatus reqStat3(KRequestPending);
  1267 	RFs fs3;
  1268 	RFs fs3;
  1268 	r=fs3.Connect();
  1269 	r=fs3.Connect();
  1269 	test(r==KErrNone);
  1270 	test_KErrNone(r);
  1270 	r=fs3.SetSessionPath(gSessionPath);
  1271 	r=fs3.SetSessionPath(gSessionPath);
  1271 	test(r==KErrNone);
  1272 	test_KErrNone(r);
  1272 	fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
  1273 	fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
  1273 
  1274 
  1274 	TRequestStatus reqStat4(KRequestPending);
  1275 	TRequestStatus reqStat4(KRequestPending);
  1275 	RFs fs4;
  1276 	RFs fs4;
  1276 	r=fs4.Connect();
  1277 	r=fs4.Connect();
  1277 	test(r==KErrNone);
  1278 	test_KErrNone(r);
  1278 	r=fs4.SetSessionPath(gSessionPath);
  1279 	r=fs4.SetSessionPath(gSessionPath);
  1279 	test(r==KErrNone);
  1280 	test_KErrNone(r);
  1280 	fs4.NotifyChange(ENotifyEntry,reqStat4,path4);
  1281 	fs4.NotifyChange(ENotifyEntry,reqStat4,path4);
  1281 
  1282 
  1282 	TRequestStatus reqStat5(KRequestPending);
  1283 	TRequestStatus reqStat5(KRequestPending);
  1283 	RFs fs5;
  1284 	RFs fs5;
  1284 	r=fs5.Connect();
  1285 	r=fs5.Connect();
  1285 	test(r==KErrNone);
  1286 	test_KErrNone(r);
  1286 	r=fs5.SetSessionPath(gSessionPath);
  1287 	r=fs5.SetSessionPath(gSessionPath);
  1287 	test(r==KErrNone);
  1288 	test_KErrNone(r);
  1288 	fs5.NotifyChange(ENotifyEntry,reqStat5,path5);
  1289 	fs5.NotifyChange(ENotifyEntry,reqStat5,path5);
  1289 
  1290 
  1290 	TRequestStatus reqStat6(KRequestPending);
  1291 	TRequestStatus reqStat6(KRequestPending);
  1291 	RFs fs6;
  1292 	RFs fs6;
  1292 	r=fs6.Connect();
  1293 	r=fs6.Connect();
  1293 	test(r==KErrNone);
  1294 	test_KErrNone(r);
  1294 	r=fs6.SetSessionPath(gSessionPath);
  1295 	r=fs6.SetSessionPath(gSessionPath);
  1295 	test(r==KErrNone);
  1296 	test_KErrNone(r);
  1296 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
  1297 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
  1297 
  1298 
  1298 	test(reqStat1==KRequestPending);
  1299 	test(reqStat1==KRequestPending);
  1299 	test(reqStat2==KRequestPending);
  1300 	test(reqStat2==KRequestPending);
  1300 	test(reqStat3==KRequestPending);
  1301 	test(reqStat3==KRequestPending);
  1304 
  1305 
  1305 //	Make a change a the top level and check that only the session monitoring
  1306 //	Make a change a the top level and check that only the session monitoring
  1306 //	that level is notified
  1307 //	that level is notified
  1307 	test.Next(_L("Test only client monitoring top level is notified"));
  1308 	test.Next(_L("Test only client monitoring top level is notified"));
  1308 	r=file.Replace(TheFs,_L("\\F32-TST\\NewFile.txt"),EFileStream);
  1309 	r=file.Replace(TheFs,_L("\\F32-TST\\NewFile.txt"),EFileStream);
  1309 	test(r==KErrNone);
  1310 	test_KErrNone(r);
  1310 	file.Close();
  1311 	file.Close();
  1311 	User::WaitForRequest(reqStat1);
  1312 	User::WaitForRequest(reqStat1);
  1312 	test(reqStat1==KErrNone);
  1313 	test(reqStat1==KErrNone);
  1313 	test(reqStat2==KRequestPending);
  1314 	test(reqStat2==KRequestPending);
  1314 	test(reqStat3==KRequestPending);
  1315 	test(reqStat3==KRequestPending);
  1316 	test(reqStat5==KRequestPending);
  1317 	test(reqStat5==KRequestPending);
  1317 	User::WaitForRequest(reqStat6);
  1318 	User::WaitForRequest(reqStat6);
  1318 	test(reqStat6==KErrNone);
  1319 	test(reqStat6==KErrNone);
  1319 
  1320 
  1320 	r=TheFs.Delete(_L("\\F32-TST\\NewFile.txt"));
  1321 	r=TheFs.Delete(_L("\\F32-TST\\NewFile.txt"));
  1321 	test(r==KErrNone);
  1322 	test_KErrNone(r);
  1322 
  1323 
  1323 //	Renew the notify request at the top level and make a change one step lower
  1324 //	Renew the notify request at the top level and make a change one step lower
  1324 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1325 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1325 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
  1326 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
  1326 	test(reqStat1==KRequestPending);
  1327 	test(reqStat1==KRequestPending);
  1327 	test(reqStat6==KRequestPending);
  1328 	test(reqStat6==KRequestPending);
  1328 
  1329 
  1329 	test.Next(_L("Test clients monitoring levels 1 and 2 are notified"));
  1330 	test.Next(_L("Test clients monitoring levels 1 and 2 are notified"));
  1330 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream);
  1331 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream);
  1331 	test(r==KErrNone);
  1332 	test_KErrNone(r);
  1332 	file.Close();
  1333 	file.Close();
  1333 
  1334 
  1334 	User::WaitForRequest(reqStat1);
  1335 	User::WaitForRequest(reqStat1);
  1335 	User::WaitForRequest(reqStat2);
  1336 	User::WaitForRequest(reqStat2);
  1336 	test(reqStat1==KErrNone);
  1337 	test(reqStat1==KErrNone);
  1340 	test(reqStat5==KRequestPending);
  1341 	test(reqStat5==KRequestPending);
  1341 	User::WaitForRequest(reqStat6);
  1342 	User::WaitForRequest(reqStat6);
  1342 	test(reqStat6==KErrNone);
  1343 	test(reqStat6==KErrNone);
  1343 
  1344 
  1344 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NewFile.txt"));
  1345 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NewFile.txt"));
  1345 	test(r==KErrNone);
  1346 	test_KErrNone(r);
  1346 
  1347 
  1347 //	Renew the notify request at the top and second levels and make a change
  1348 //	Renew the notify request at the top and second levels and make a change
  1348 //	one step lower still
  1349 //	one step lower still
  1349 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1350 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1350 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
  1351 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
  1353 	test(reqStat2==KRequestPending);
  1354 	test(reqStat2==KRequestPending);
  1354 	test(reqStat6==KRequestPending);
  1355 	test(reqStat6==KRequestPending);
  1355 
  1356 
  1356 	test.Next(_L("Test clients monitoring levels 1,2 and 3 are notified"));
  1357 	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);
  1358 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"),EFileStream);
  1358 	test(r==KErrNone);
  1359 	test_KErrNone(r);
  1359 	file.Close();
  1360 	file.Close();
  1360 
  1361 
  1361 	User::WaitForRequest(reqStat1);
  1362 	User::WaitForRequest(reqStat1);
  1362 	User::WaitForRequest(reqStat2);
  1363 	User::WaitForRequest(reqStat2);
  1363 	User::WaitForRequest(reqStat3);
  1364 	User::WaitForRequest(reqStat3);
  1368 	test(reqStat5==KRequestPending);
  1369 	test(reqStat5==KRequestPending);
  1369 	User::WaitForRequest(reqStat6);
  1370 	User::WaitForRequest(reqStat6);
  1370 	test(reqStat6==KErrNone);
  1371 	test(reqStat6==KErrNone);
  1371 
  1372 
  1372 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"));
  1373 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"));
  1373 	test(r==KErrNone);
  1374 	test_KErrNone(r);
  1374 
  1375 
  1375 //	Renew the notify request at the top, second and third levels and make a change
  1376 //	Renew the notify request at the top, second and third levels and make a change
  1376 //	one step lower still
  1377 //	one step lower still
  1377 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1378 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
  1378 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
  1379 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
  1383 	test(reqStat3==KRequestPending);
  1384 	test(reqStat3==KRequestPending);
  1384 	test(reqStat6==KRequestPending);
  1385 	test(reqStat6==KRequestPending);
  1385 
  1386 
  1386 	test.Next(_L("Test clients monitoring levels 1 - 4 are notified"));
  1387 	test.Next(_L("Test clients monitoring levels 1 - 4 are notified"));
  1387 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"));
  1388 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"));
  1388 	test(r==KErrNone);
  1389 	test_KErrNone(r);
  1389 	User::WaitForRequest(reqStat1);
  1390 	User::WaitForRequest(reqStat1);
  1390 	User::WaitForRequest(reqStat2);
  1391 	User::WaitForRequest(reqStat2);
  1391 	User::WaitForRequest(reqStat3);
  1392 	User::WaitForRequest(reqStat3);
  1392 	User::WaitForRequest(reqStat4);
  1393 	User::WaitForRequest(reqStat4);
  1393 	test(reqStat1==KErrNone);
  1394 	test(reqStat1==KErrNone);
  1413 	test(reqStat4==KRequestPending);
  1414 	test(reqStat4==KRequestPending);
  1414 	test(reqStat6==KRequestPending);
  1415 	test(reqStat6==KRequestPending);
  1415 
  1416 
  1416 	test.Next(_L("Test clients monitoring levels 1 - 3 and 5 are notified"));
  1417 	test.Next(_L("Test clients monitoring levels 1 - 3 and 5 are notified"));
  1417 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"));
  1418 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"));
  1418 	test(r==KErrNone);
  1419 	test_KErrNone(r);
  1419 	User::WaitForRequest(reqStat1);
  1420 	User::WaitForRequest(reqStat1);
  1420 	User::WaitForRequest(reqStat2);
  1421 	User::WaitForRequest(reqStat2);
  1421 	User::WaitForRequest(reqStat3);
  1422 	User::WaitForRequest(reqStat3);
  1422 //	Don't wait for reqStat4
  1423 //	Don't wait for reqStat4
  1423 	User::WaitForRequest(reqStat5);
  1424 	User::WaitForRequest(reqStat5);
  1448 	test(reqStat4==KRequestPending);
  1449 	test(reqStat4==KRequestPending);
  1449 	test(reqStat5==KRequestPending);
  1450 	test(reqStat5==KRequestPending);
  1450 	test(reqStat6==KRequestPending);
  1451 	test(reqStat6==KRequestPending);
  1451 
  1452 
  1452 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\"));
  1453 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\"));
  1453 	test(r==KErrNone);
  1454 	test_KErrNone(r);
  1454 	User::WaitForRequest(reqStat1);
  1455 	User::WaitForRequest(reqStat1);
  1455 	User::WaitForRequest(reqStat2);
  1456 	User::WaitForRequest(reqStat2);
  1456 	User::WaitForRequest(reqStat3);
  1457 	User::WaitForRequest(reqStat3);
  1457 	test(reqStat1==KErrNone);
  1458 	test(reqStat1==KErrNone);
  1458 	test(reqStat2==KErrNone);
  1459 	test(reqStat2==KErrNone);
  1507 
  1508 
  1508 	test.Next(_L("Cancel notification request using simple function"));
  1509 	test.Next(_L("Cancel notification request using simple function"));
  1509 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  1510 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  1510 	RFs fs1;
  1511 	RFs fs1;
  1511 	TInt r=fs1.Connect();
  1512 	TInt r=fs1.Connect();
  1512 	test(r==KErrNone);
  1513 	test_KErrNone(r);
  1513 	r=fs1.SetSessionPath(gSessionPath);
  1514 	r=fs1.SetSessionPath(gSessionPath);
  1514 	test(r==KErrNone);
  1515 	test_KErrNone(r);
  1515 
  1516 
  1516 	TRequestStatus status1;
  1517 	TRequestStatus status1;
  1517 	TRequestStatus status2;
  1518 	TRequestStatus status2;
  1518 	TRequestStatus status3;
  1519 	TRequestStatus status3;
  1519 	TRequestStatus status4;
  1520 	TRequestStatus status4;
  1568 	test(status3==KRequestPending);
  1569 	test(status3==KRequestPending);
  1569 	test(status4==KRequestPending);
  1570 	test(status4==KRequestPending);
  1570 	test(status5==KErrCancel);
  1571 	test(status5==KErrCancel);
  1571 
  1572 
  1572 	r=TheFs.MkDir(_L("\\F32-TST\\TROPICANA\\"));
  1573 	r=TheFs.MkDir(_L("\\F32-TST\\TROPICANA\\"));
  1573 	test(r==KErrNone);
  1574 	test_KErrNone(r);
  1574 	test(status1==KRequestPending);
  1575 	test(status1==KRequestPending);
  1575 	test(status2==KRequestPending);
  1576 	test(status2==KRequestPending);
  1576 	test(status3==KRequestPending);
  1577 	test(status3==KRequestPending);
  1577 	test(status4==KRequestPending);
  1578 	test(status4==KRequestPending);
  1578 
  1579 
  1583 	test(status2==KErrCancel);
  1584 	test(status2==KErrCancel);
  1584 	test(status3==KRequestPending);
  1585 	test(status3==KRequestPending);
  1585 	test(status4==KRequestPending);
  1586 	test(status4==KRequestPending);
  1586 
  1587 
  1587 	r=TheFs.RmDir(_L("\\F32-TST\\TROPICANA\\"));
  1588 	r=TheFs.RmDir(_L("\\F32-TST\\TROPICANA\\"));
  1588 	test(r==KErrNone);
  1589 	test_KErrNone(r);
  1589 	test(status1==KRequestPending);
  1590 	test(status1==KRequestPending);
  1590 	test(status3==KRequestPending);
  1591 	test(status3==KRequestPending);
  1591 	test(status4==KRequestPending);
  1592 	test(status4==KRequestPending);
  1592 
  1593 
  1593 	fs1.NotifyChangeCancel(status4);
  1594 	fs1.NotifyChangeCancel(status4);
  1620 	{
  1621 	{
  1621 
  1622 
  1622 	test.Next(_L("Kill client while it is monitoring changes to a directory"));
  1623 	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
  1624 //	Call CreateLocal to create RSemaphore gSleepThread which is local to this process
  1624 	TInt r=gSleepThread.CreateLocal(0);
  1625 	TInt r=gSleepThread.CreateLocal(0);
  1625 	test(r==KErrNone);
  1626 	test_KErrNone(r);
  1626 
  1627 
  1627 	RThread clientThread;
  1628 	RThread clientThread;
  1628 	r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest9);
  1629 	r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest9);
  1629 	test(r==KErrNone);
  1630 	test_KErrNone(r);
  1630 	clientThread.Resume();
  1631 	clientThread.Resume();
  1631 	gSleepThread.Wait();	//	Wait for gSleepThread to be signalled
  1632 	gSleepThread.Wait();	//	Wait for gSleepThread to be signalled
  1632 							//	Client thread is waiting for notification of changes
  1633 							//	Client thread is waiting for notification of changes
  1633 							//	to directory \\F32-TST\\NOTIFY
  1634 							//	to directory \\F32-TST\\NOTIFY
  1634 
  1635 
  1639 
  1640 
  1640 	clientThread.Close();
  1641 	clientThread.Close();
  1641 
  1642 
  1642 //	Make a change and check there's no disaster
  1643 //	Make a change and check there's no disaster
  1643 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\"));
  1644 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\"));
  1644 	test(r==KErrNone || r==KErrAlreadyExists);
  1645 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
  1645 	MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
  1646 	MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
  1646 	User::After(1000);
  1647 	User::After(1000);
  1647 	}
  1648 	}
  1648 
  1649 
  1649 
  1650 
  1656 
  1657 
  1657 	test.Next(_L("Test reads and writes do not cause notification under ENotifyEntry"));
  1658 	test.Next(_L("Test reads and writes do not cause notification under ENotifyEntry"));
  1658 
  1659 
  1659 	RFile file;
  1660 	RFile file;
  1660 	TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
  1661 	TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
  1661 	test(r==KErrNone);
  1662 	test_KErrNone(r);
  1662 	file.Close();
  1663 	file.Close();
  1663 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
  1664 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
  1664 	test(r==KErrNone);
  1665 	test_KErrNone(r);
  1665 	file.Close();
  1666 	file.Close();
  1666 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
  1667 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
  1667 	test(r==KErrNone);
  1668 	test_KErrNone(r);
  1668 	file.Close();
  1669 	file.Close();
  1669 
  1670 
  1670 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  1671 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  1671 	TRequestStatus reqStat1(KRequestPending);
  1672 	TRequestStatus reqStat1(KRequestPending);
  1672 	RFs fs1;
  1673 	RFs fs1;
  1673 	r=fs1.Connect();
  1674 	r=fs1.Connect();
  1674 	test(r==KErrNone);
  1675 	test_KErrNone(r);
  1675 	r=fs1.SetSessionPath(gSessionPath);
  1676 	r=fs1.SetSessionPath(gSessionPath);
  1676 	test(r==KErrNone);
  1677 	test_KErrNone(r);
  1677 	fs1.NotifyChange(ENotifyEntry,reqStat1,path);
  1678 	fs1.NotifyChange(ENotifyEntry,reqStat1,path);
  1678 
  1679 
  1679 	TRequestStatus reqStat2(KRequestPending);
  1680 	TRequestStatus reqStat2(KRequestPending);
  1680 	RFs fs2;
  1681 	RFs fs2;
  1681 	r=fs2.Connect();
  1682 	r=fs2.Connect();
  1682 	test(r==KErrNone);
  1683 	test_KErrNone(r);
  1683 	r=fs2.SetSessionPath(gSessionPath);
  1684 	r=fs2.SetSessionPath(gSessionPath);
  1684 	test(r==KErrNone);
  1685 	test_KErrNone(r);
  1685 	fs2.NotifyChange(ENotifyEntry,reqStat2,path);
  1686 	fs2.NotifyChange(ENotifyEntry,reqStat2,path);
  1686 
  1687 
  1687 	TRequestStatus reqStat3(KRequestPending);
  1688 	TRequestStatus reqStat3(KRequestPending);
  1688 	RFs fs3;
  1689 	RFs fs3;
  1689 	r=fs3.Connect();
  1690 	r=fs3.Connect();
  1690 	test(r==KErrNone);
  1691 	test_KErrNone(r);
  1691 	r=fs3.SetSessionPath(gSessionPath);
  1692 	r=fs3.SetSessionPath(gSessionPath);
  1692 	test(r==KErrNone);
  1693 	test_KErrNone(r);
  1693 	fs3.NotifyChange(ENotifyEntry,reqStat3,path);
  1694 	fs3.NotifyChange(ENotifyEntry,reqStat3,path);
  1694 
  1695 
  1695 	test(reqStat1==KRequestPending);
  1696 	test(reqStat1==KRequestPending);
  1696 	test(reqStat2==KRequestPending);
  1697 	test(reqStat2==KRequestPending);
  1697 	test(reqStat3==KRequestPending);
  1698 	test(reqStat3==KRequestPending);
  1698 
  1699 
  1699 	r=gSleepThread.CreateLocal(0);
  1700 	r=gSleepThread.CreateLocal(0);
  1700 	test(r==KErrNone);
  1701 	test_KErrNone(r);
  1701 	RThread thread1;
  1702 	RThread thread1;
  1702 	r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  1703 	r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  1703 	test(r==KErrNone);
  1704 	test_KErrNone(r);
  1704 	thread1.Resume();
  1705 	thread1.Resume();
  1705 	gSleepThread.Wait();
  1706 	gSleepThread.Wait();
  1706 
  1707 
  1707 	test(reqStat1==KRequestPending);
  1708 	test(reqStat1==KRequestPending);
  1708 	test(reqStat2==KRequestPending);
  1709 	test(reqStat2==KRequestPending);
  1709 	test(reqStat3==KRequestPending);
  1710 	test(reqStat3==KRequestPending);
  1710 
  1711 
  1711 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  1712 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  1712 	test(r==KErrNone);
  1713 	test_KErrNone(r);
  1713 	User::WaitForRequest(reqStat1);
  1714 	User::WaitForRequest(reqStat1);
  1714 	User::WaitForRequest(reqStat2);
  1715 	User::WaitForRequest(reqStat2);
  1715 	User::WaitForRequest(reqStat3);
  1716 	User::WaitForRequest(reqStat3);
  1716 	test(reqStat1==KErrNone);	//	All three notifications occur because they
  1717 	test(reqStat1==KErrNone);	//	All three notifications occur because they
  1717 	test(reqStat2==KErrNone);	//	are all monitoring the top level directory
  1718 	test(reqStat2==KErrNone);	//	are all monitoring the top level directory
  1720 	gSleepThread.Close();
  1721 	gSleepThread.Close();
  1721 	thread1.Close();
  1722 	thread1.Close();
  1722 
  1723 
  1723 	test.Next(_L("Test reads and writes do cause notification under ENotifyAll"));
  1724 	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);
  1725 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
  1725 	test(r==KErrNone);
  1726 	test_KErrNone(r);
  1726 	file.Close();
  1727 	file.Close();
  1727 
  1728 
  1728 	fs1.NotifyChange(ENotifyAll,reqStat1,path);
  1729 	fs1.NotifyChange(ENotifyAll,reqStat1,path);
  1729 	fs2.NotifyChange(ENotifyAll,reqStat2,path);
  1730 	fs2.NotifyChange(ENotifyAll,reqStat2,path);
  1730 	fs3.NotifyChange(ENotifyAll,reqStat3,path);
  1731 	fs3.NotifyChange(ENotifyAll,reqStat3,path);
  1732 	test(reqStat1==KRequestPending);
  1733 	test(reqStat1==KRequestPending);
  1733 	test(reqStat2==KRequestPending);
  1734 	test(reqStat2==KRequestPending);
  1734 	test(reqStat3==KRequestPending);
  1735 	test(reqStat3==KRequestPending);
  1735 
  1736 
  1736 	r=gSleepThread.CreateLocal(0);
  1737 	r=gSleepThread.CreateLocal(0);
  1737 	test(r==KErrNone);
  1738 	test_KErrNone(r);
  1738 	RThread thread2;
  1739 	RThread thread2;
  1739 	r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  1740 	r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  1740 	test(r==KErrNone);
  1741 	test_KErrNone(r);
  1741 	thread2.Resume();
  1742 	thread2.Resume();
  1742 	gSleepThread.Wait();
  1743 	gSleepThread.Wait();
  1743 
  1744 
  1744 	User::WaitForRequest(reqStat1);
  1745 	User::WaitForRequest(reqStat1);
  1745 	User::WaitForRequest(reqStat2);
  1746 	User::WaitForRequest(reqStat2);
  1766 	test(reqStat1==KRequestPending);
  1767 	test(reqStat1==KRequestPending);
  1767 	test(reqStat2==KRequestPending);
  1768 	test(reqStat2==KRequestPending);
  1768 	test(reqStat3==KRequestPending);
  1769 	test(reqStat3==KRequestPending);
  1769 
  1770 
  1770 	r=gSleepThread.CreateLocal(0);
  1771 	r=gSleepThread.CreateLocal(0);
  1771 	test(r==KErrNone);
  1772 	test_KErrNone(r);
  1772 	RThread thread3;
  1773 	RThread thread3;
  1773 	r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  1774 	r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  1774 	test(r==KErrNone);
  1775 	test_KErrNone(r);
  1775 	thread3.Resume();
  1776 	thread3.Resume();
  1776 	gSleepThread.Wait();
  1777 	gSleepThread.Wait();
  1777 
  1778 
  1778 	User::WaitForRequest(reqStat1);
  1779 	User::WaitForRequest(reqStat1);
  1779 	test(reqStat1==KErrNone);
  1780 	test(reqStat1==KErrNone);
  1780 	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyEntry
  1781 	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyEntry
  1781 	User::WaitForRequest(reqStat3);
  1782 	User::WaitForRequest(reqStat3);
  1782 	test(reqStat3==KErrNone);
  1783 	test(reqStat3==KErrNone);
  1783 
  1784 
  1784 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
  1785 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
  1785 	test(r==KErrNone);
  1786 	test_KErrNone(r);
  1786 	User::WaitForRequest(reqStat2);
  1787 	User::WaitForRequest(reqStat2);
  1787 	test(reqStat2==KErrNone);
  1788 	test(reqStat2==KErrNone);
  1788 
  1789 
  1789 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  1790 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  1790 	test(r==KErrNone);
  1791 	test_KErrNone(r);
  1791 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
  1792 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
  1792 	test(r==KErrNone);
  1793 	test_KErrNone(r);
  1793 
  1794 
  1794 	gSleepThread.Close();
  1795 	gSleepThread.Close();
  1795 	thread3.Close();
  1796 	thread3.Close();
  1796 	fs1.Close();
  1797 	fs1.Close();
  1797 	fs2.Close();
  1798 	fs2.Close();
  1804 //	Test file notification
  1805 //	Test file notification
  1805 //
  1806 //
  1806 	{
  1807 	{
  1807 	RFs fs;	//	Session to be notified of any changes
  1808 	RFs fs;	//	Session to be notified of any changes
  1808 	TInt r=fs.Connect();
  1809 	TInt r=fs.Connect();
  1809 	test(r==KErrNone);
  1810 	test_KErrNone(r);
  1810 	r=fs.SetSessionPath(gSessionPath);
  1811 	r=fs.SetSessionPath(gSessionPath);
  1811 	test(r==KErrNone);
  1812 	test_KErrNone(r);
  1812 
  1813 
  1813 
  1814 
  1814 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1815 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
  1815 	test(r==KErrNone||r==KErrAlreadyExists);
  1816 	test_Value(r, r == KErrNone||r==KErrAlreadyExists);
  1816 
  1817 
  1817 	RFile file;
  1818 	RFile file;
  1818 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream);
  1819 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream);
  1819 	test(r==KErrNone||KErrAlreadyExists);
  1820 	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
  1820 	file.Close();
  1821 	file.Close();
  1821 
  1822 
  1822 //	Test notification on a specific file
  1823 //	Test notification on a specific file
  1823 	test.Next(_L("Monitor changes to a specific file"));
  1824 	test.Next(_L("Monitor changes to a specific file"));
  1824 	TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg");
  1825 	TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg");
  1826 	TRequestStatus thrdStat(KRequestPending);
  1827 	TRequestStatus thrdStat(KRequestPending);
  1827 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1828 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1828 	test(reqStat==KRequestPending);
  1829 	test(reqStat==KRequestPending);
  1829 	RThread thread;
  1830 	RThread thread;
  1830 	r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
  1831 	r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
  1831 	test(r==KErrNone);
  1832 	test_KErrNone(r);
  1832 	thread.Logon(thrdStat);
  1833 	thread.Logon(thrdStat);
  1833 	thread.Resume();
  1834 	thread.Resume();
  1834 	User::WaitForRequest(thrdStat);
  1835 	User::WaitForRequest(thrdStat);
  1835 	test(thrdStat==KErrNone);
  1836 	test(thrdStat==KErrNone);
  1836 	User::WaitForRequest(reqStat);
  1837 	User::WaitForRequest(reqStat);
  1838 	thread.Close();
  1839 	thread.Close();
  1839 //	Test notification does not occur if a change is made above the file
  1840 //	Test notification does not occur if a change is made above the file
  1840 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  1841 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  1841 	test(reqStat==KRequestPending);
  1842 	test(reqStat==KRequestPending);
  1842 	r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1843 	r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
  1843 	test(r==KErrNone);
  1844 	test_KErrNone(r);
  1844 	thread.Logon(thrdStat);
  1845 	thread.Logon(thrdStat);
  1845 	thread.Resume();
  1846 	thread.Resume();
  1846 	User::WaitForRequest(thrdStat);
  1847 	User::WaitForRequest(thrdStat);
  1847 	test(thrdStat==KErrNone);
  1848 	test(thrdStat==KErrNone);
  1848 	User::After(500000);
  1849 	User::After(500000);
  1849 	thread.Close();
  1850 	thread.Close();
  1850 	test(reqStat==KRequestPending);
  1851 	test(reqStat==KRequestPending);
  1851 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
  1852 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
  1852 	test(r==KErrNone);
  1853 	test_KErrNone(r);
  1853 
  1854 
  1854 //	Test notification does not occur if a change is made to another file
  1855 //	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);
  1856 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"),EFileStream);
  1856 	test(r==KErrNone);
  1857 	test_KErrNone(r);
  1857 	test(reqStat==KRequestPending);
  1858 	test(reqStat==KRequestPending);
  1858 	file.Close();
  1859 	file.Close();
  1859 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"));
  1860 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"));
  1860 	test(r==KErrNone);
  1861 	test_KErrNone(r);
  1861 	test(reqStat==KRequestPending);
  1862 	test(reqStat==KRequestPending);
  1862 
  1863 
  1863 
  1864 
  1864 //	Test notification occurs when a change is made to the file
  1865 //	Test notification occurs when a change is made to the file
  1865 	test.Next(_L("Delete monitored file"));
  1866 	test.Next(_L("Delete monitored file"));
  1866 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
  1867 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
  1867 	test(r==KErrNone);
  1868 	test_KErrNone(r);
  1868 	User::WaitForRequest(reqStat);
  1869 	User::WaitForRequest(reqStat);
  1869 	test(reqStat==KErrNone);
  1870 	test(reqStat==KErrNone);
  1870 
  1871 
  1871 	fs.Close();
  1872 	fs.Close();
  1872 	}
  1873 	}
  1878 //	Test notification request succeeds with all RFile and RFs operations which result in
  1879 //	Test notification request succeeds with all RFile and RFs operations which result in
  1879 //	notifications
  1880 //	notifications
  1880 //
  1881 //
  1881 	RFs fs;
  1882 	RFs fs;
  1882 	TInt r=fs.Connect();	//	Session to be notified of any changes
  1883 	TInt r=fs.Connect();	//	Session to be notified of any changes
  1883 	test(r==KErrNone);
  1884 	test_KErrNone(r);
  1884 	r=fs.SetSessionPath(gSessionPath);
  1885 	r=fs.SetSessionPath(gSessionPath);
  1885 	test(r==KErrNone);
  1886 	test_KErrNone(r);
  1886 
  1887 
  1887 //	RFile::Write() to a file within the monitored directory
  1888 //	RFile::Write() to a file within the monitored directory
  1888 	test.Next(_L("RFile::Write()"));
  1889 	test.Next(_L("RFile::Write()"));
  1889 	TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc");
  1890 	TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc");
  1890 	TRequestStatus reqStat(KRequestPending);
  1891 	TRequestStatus reqStat(KRequestPending);
  1892 	RFile file;
  1893 	RFile file;
  1893 
  1894 
  1894 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1895 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1895 	test(reqStat==KRequestPending);
  1896 	test(reqStat==KRequestPending);
  1896 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1897 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1897 	test(r==KErrNone);
  1898 	test_KErrNone(r);
  1898 	User::WaitForRequest(reqStat);
  1899 	User::WaitForRequest(reqStat);
  1899 	test(reqStat==KErrNone);
  1900 	test(reqStat==KErrNone);
  1900 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1901 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1901 	test(reqStat==KRequestPending);
  1902 	test(reqStat==KRequestPending);
  1902 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  1903 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  1903 	test(r==KErrNone);
  1904 	test_KErrNone(r);
  1904 	file.Close();
  1905 	file.Close();
  1905 	User::WaitForRequest(reqStat);
  1906 	User::WaitForRequest(reqStat);
  1906 	test(reqStat==KErrNone);
  1907 	test(reqStat==KErrNone);
  1907 
  1908 
  1908 //	RFile::Read() a file within the monitored directory - no notification for reads
  1909 //	RFile::Read() a file within the monitored directory - no notification for reads
  1909 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1910 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  1910 	TBuf8<100> temp;
  1911 	TBuf8<100> temp;
  1911 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1912 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1912 	test(reqStat==KRequestPending);
  1913 	test(reqStat==KRequestPending);
  1913 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1914 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1914 	test(r==KErrNone);
  1915 	test_KErrNone(r);
  1915 	test(reqStat==KRequestPending);
  1916 	test(reqStat==KRequestPending);
  1916 	r=file.Read(0,temp,100);
  1917 	r=file.Read(0,temp,100);
  1917 	test(reqStat==KRequestPending);
  1918 	test(reqStat==KRequestPending);
  1918 
  1919 
  1919 //	RFile::SetAtt() of a file within the monitored directory
  1920 //	RFile::SetAtt() of a file within the monitored directory
  1920 	test.Next(_L("RFile::SetAtt()"));
  1921 	test.Next(_L("RFile::SetAtt()"));
  1921 	r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
  1922 	r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
  1922 	test(r==KErrNone);
  1923 	test_KErrNone(r);
  1923 	User::WaitForRequest(reqStat);
  1924 	User::WaitForRequest(reqStat);
  1924 	test(reqStat==KErrNone);
  1925 	test(reqStat==KErrNone);
  1925 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1926 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1926 	test(reqStat==KRequestPending);
  1927 	test(reqStat==KRequestPending);
  1927 
  1928 
  1928 //	RFile::SetSize() of a file within the monitored directory
  1929 //	RFile::SetSize() of a file within the monitored directory
  1929 	test.Next(_L("RFile::SetSize()"));
  1930 	test.Next(_L("RFile::SetSize()"));
  1930 	r=file.SetSize(256);
  1931 	r=file.SetSize(256);
  1931 	test(r==KErrNone);
  1932 	test_KErrNone(r);
  1932 	User::WaitForRequest(reqStat);
  1933 	User::WaitForRequest(reqStat);
  1933 	test(reqStat==KErrNone);
  1934 	test(reqStat==KErrNone);
  1934 	file.Close();
  1935 	file.Close();
  1935 
  1936 
  1936 //	RFile::Temp() to create a temp file within the monitored directory
  1937 //	RFile::Temp() to create a temp file within the monitored directory
  1937 	test.Next(_L("RFile::Temp()"));
  1938 	test.Next(_L("RFile::Temp()"));
  1938 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1939 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1939 	test(reqStat==KRequestPending);
  1940 	test(reqStat==KRequestPending);
  1940 	TFileName fileName;
  1941 	TFileName fileName;
  1941 	r=file.Temp(TheFs,path,fileName,EFileWrite);
  1942 	r=file.Temp(TheFs,path,fileName,EFileWrite);
  1942 	test(r==KErrNone);
  1943 	test_KErrNone(r);
  1943 	User::WaitForRequest(reqStat);
  1944 	User::WaitForRequest(reqStat);
  1944 	test(reqStat==KErrNone);
  1945 	test(reqStat==KErrNone);
  1945 	file.Close();
  1946 	file.Close();
  1946 
  1947 
  1947 //	RFile::SetModified() to change modification time of a file within monitored dir
  1948 //	RFile::SetModified() to change modification time of a file within monitored dir
  1949 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1950 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1950 	test(reqStat==KRequestPending);
  1951 	test(reqStat==KRequestPending);
  1951 	TTime now;
  1952 	TTime now;
  1952 	now.HomeTime();
  1953 	now.HomeTime();
  1953 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1954 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1954 	test(r==KErrNone);
  1955 	test_KErrNone(r);
  1955 	test(reqStat==KRequestPending);
  1956 	test(reqStat==KRequestPending);
  1956 	file.SetModified(now);
  1957 	file.SetModified(now);
  1957 	file.Close();
  1958 	file.Close();
  1958 	User::WaitForRequest(reqStat);
  1959 	User::WaitForRequest(reqStat);
  1959 	test(reqStat==KErrNone);
  1960 	test(reqStat==KErrNone);
  1964 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1965 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1965 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
  1966 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
  1966 	test(reqStat==KRequestPending);
  1967 	test(reqStat==KRequestPending);
  1967 	now.HomeTime();
  1968 	now.HomeTime();
  1968 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
  1969 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
  1969 	test(r==KErrNone);
  1970 	test_KErrNone(r);
  1970 	User::WaitForRequest(reqStat);
  1971 	User::WaitForRequest(reqStat);
  1971 	test(reqStat==KErrNone);
  1972 	test(reqStat==KErrNone);
  1972 
  1973 
  1973 //	RFile::Set() to change file's modification time and attributes
  1974 //	RFile::Set() to change file's modification time and attributes
  1974 	test.Next(_L("RFile::Set()"));
  1975 	test.Next(_L("RFile::Set()"));
  1975 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1976 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1976 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1977 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  1977 	test(r==KErrNone);
  1978 	test_KErrNone(r);
  1978 	test(reqStat==KRequestPending);
  1979 	test(reqStat==KRequestPending);
  1979 	now.HomeTime();
  1980 	now.HomeTime();
  1980 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  1981 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  1981 	file.Close();
  1982 	file.Close();
  1982 	User::WaitForRequest(reqStat);
  1983 	User::WaitForRequest(reqStat);
  1986 	test.Next(_L("RFs::SetDriveName()"));
  1987 	test.Next(_L("RFs::SetDriveName()"));
  1987 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1988 	fs.NotifyChange(ENotifyAll,reqStat,path);
  1988 	test(reqStat==KRequestPending);
  1989 	test(reqStat==KRequestPending);
  1989 	User::After(KNotifyChangeAfter);
  1990 	User::After(KNotifyChangeAfter);
  1990 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  1991 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  1991 	test(r==KErrNone);
  1992 	test_KErrNone(r);
  1992 	User::WaitForRequest(reqStat);
  1993 	User::WaitForRequest(reqStat);
  1993 	test(reqStat==KErrNone);
  1994 	test(reqStat==KErrNone);
  1994 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  1995 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  1995 	User::After(KNotifyChangeAfter);
  1996 	User::After(KNotifyChangeAfter);
  1996 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
  1997 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
  1997 	test(r==KErrNone);
  1998 	test_KErrNone(r);
  1998 	test(reqStat==KRequestPending);
  1999 	test(reqStat==KRequestPending);
  1999 	fs.NotifyChangeCancel(reqStat);
  2000 	fs.NotifyChangeCancel(reqStat);
  2000 	User::WaitForRequest(reqStat);
  2001 	User::WaitForRequest(reqStat);
  2001 	test(reqStat==KErrCancel);
  2002 	test(reqStat==KErrCancel);
  2002 	fs.NotifyChange(ENotifyDisk,reqStat,path);
  2003 	fs.NotifyChange(ENotifyDisk,reqStat,path);
  2003 	User::After(KNotifyChangeAfter);
  2004 	User::After(KNotifyChangeAfter);
  2004 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
  2005 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
  2005 	test(r==KErrNone);
  2006 	test_KErrNone(r);
  2006 	test(reqStat==KRequestPending);
  2007 	test(reqStat==KRequestPending);
  2007 	fs.NotifyChangeCancel(reqStat);
  2008 	fs.NotifyChangeCancel(reqStat);
  2008 	User::WaitForRequest(reqStat);
  2009 	User::WaitForRequest(reqStat);
  2009 	test(reqStat==KErrCancel);
  2010 	test(reqStat==KErrCancel);
  2010 
  2011 
  2012 //	RFs::MkDir()
  2013 //	RFs::MkDir()
  2013 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2014 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2014 	test(reqStat==KRequestPending);
  2015 	test(reqStat==KRequestPending);
  2015 	test.Next(_L("RFs::MkDir()"));
  2016 	test.Next(_L("RFs::MkDir()"));
  2016 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2017 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2017 	test(r==KErrNone);
  2018 	test_KErrNone(r);
  2018 	User::WaitForRequest(reqStat);
  2019 	User::WaitForRequest(reqStat);
  2019 	test(reqStat==KErrNone);
  2020 	test(reqStat==KErrNone);
  2020 
  2021 
  2021 //	RFs::RmDir()
  2022 //	RFs::RmDir()
  2022 	test.Next(_L("RFs::RmDir()"));
  2023 	test.Next(_L("RFs::RmDir()"));
  2023 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2024 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2024 	test(reqStat==KRequestPending);
  2025 	test(reqStat==KRequestPending);
  2025 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2026 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2026 	test(r==KErrNone);
  2027 	test_KErrNone(r);
  2027 	User::WaitForRequest(reqStat);
  2028 	User::WaitForRequest(reqStat);
  2028 	test(reqStat==KErrNone);
  2029 	test(reqStat==KErrNone);
  2029 
  2030 
  2030 //	RFile::Create()
  2031 //	RFile::Create()
  2031 	test.Next(_L("RFile::Create()"));
  2032 	test.Next(_L("RFile::Create()"));
  2032 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2033 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2033 	test(reqStat==KRequestPending);
  2034 	test(reqStat==KRequestPending);
  2034 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2035 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2035 	test(r==KErrNone);
  2036 	test_KErrNone(r);
  2036 	User::WaitForRequest(reqStat);
  2037 	User::WaitForRequest(reqStat);
  2037 	test(reqStat==KErrNone);
  2038 	test(reqStat==KErrNone);
  2038 	file.Close();
  2039 	file.Close();
  2039 
  2040 
  2040 //	RFs::Delete()
  2041 //	RFs::Delete()
  2041 	test.Next(_L("RFs::Delete()"));
  2042 	test.Next(_L("RFs::Delete()"));
  2042 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2043 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2043 	test(reqStat==KRequestPending);
  2044 	test(reqStat==KRequestPending);
  2044 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2045 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2045 	test(r==KErrNone);
  2046 	test_KErrNone(r);
  2046 	User::WaitForRequest(reqStat);
  2047 	User::WaitForRequest(reqStat);
  2047 	test(reqStat==KErrNone);
  2048 	test(reqStat==KErrNone);
  2048 
  2049 
  2049 //	RFile::Replace()
  2050 //	RFile::Replace()
  2050 	test.Next(_L("RFile::Replace()"));
  2051 	test.Next(_L("RFile::Replace()"));
  2051 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2052 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2052 	test(reqStat==KRequestPending);
  2053 	test(reqStat==KRequestPending);
  2053 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2054 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2054 	test(r==KErrNone);
  2055 	test_KErrNone(r);
  2055 	User::WaitForRequest(reqStat);
  2056 	User::WaitForRequest(reqStat);
  2056 	test(reqStat==KErrNone);
  2057 	test(reqStat==KErrNone);
  2057 	file.Close();
  2058 	file.Close();
  2058 
  2059 
  2059 //	RFs::Delete()
  2060 //	RFs::Delete()
  2060 	test.Next(_L("RFs::Delete()"));
  2061 	test.Next(_L("RFs::Delete()"));
  2061 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2062 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2062 	test(reqStat==KRequestPending);
  2063 	test(reqStat==KRequestPending);
  2063 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2064 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2064 	test(r==KErrNone);
  2065 	test_KErrNone(r);
  2065 	User::WaitForRequest(reqStat);
  2066 	User::WaitForRequest(reqStat);
  2066 	test(reqStat==KErrNone);
  2067 	test(reqStat==KErrNone);
  2067 
  2068 
  2068 //	RFs::SetVolumeLabel() - should only be notification when monitoring relevant TNotifyTypes
  2069 //	RFs::SetVolumeLabel() - should only be notification when monitoring relevant TNotifyTypes
  2069 	test.Next(_L("RFs::SetVolumeLabel"));
  2070 	test.Next(_L("RFs::SetVolumeLabel"));
  2072 	TInt driveNum=CurrentDrive();
  2073 	TInt driveNum=CurrentDrive();
  2073 	TVolumeInfo volInfo;
  2074 	TVolumeInfo volInfo;
  2074 	TFileName currentVolName;
  2075 	TFileName currentVolName;
  2075 
  2076 
  2076 	r=TheFs.Volume(volInfo,driveNum);
  2077 	r=TheFs.Volume(volInfo,driveNum);
  2077 	test(r==KErrNone);
  2078 	test_KErrNone(r);
  2078 	test(reqStat==KRequestPending);
  2079 	test(reqStat==KRequestPending);
  2079 	currentVolName=volInfo.iName;
  2080 	currentVolName=volInfo.iName;
  2080 
  2081 
  2081 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  2082 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  2082 	if (r==KErrNone)
  2083 	if (r==KErrNone)
  2083 		{
  2084 		{
  2084 		User::WaitForRequest(reqStat);
  2085 		User::WaitForRequest(reqStat);
  2085 		test(reqStat==KErrNone);
  2086 		test(reqStat==KErrNone);
  2086 		r=TheFs.Volume(volInfo,driveNum);
  2087 		r=TheFs.Volume(volInfo,driveNum);
  2087 		test(r==KErrNone);
  2088 		test_KErrNone(r);
  2088 		test(volInfo.iName==_L("VOL"));
  2089 		test(volInfo.iName==_L("VOL"));
  2089 	//	Test notification occurs under ENotifyDisk
  2090 	//	Test notification occurs under ENotifyDisk
  2090 		fs.NotifyChange(ENotifyDisk,reqStat,path);
  2091 		fs.NotifyChange(ENotifyDisk,reqStat,path);
  2091 		test(reqStat==KRequestPending);
  2092 		test(reqStat==KRequestPending);
  2092 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  2093 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  2093 		test(r==KErrNone);
  2094 		test_KErrNone(r);
  2094 		User::WaitForRequest(reqStat);
  2095 		User::WaitForRequest(reqStat);
  2095 		test(reqStat==KErrNone);
  2096 		test(reqStat==KErrNone);
  2096 		r=TheFs.Volume(volInfo,driveNum);
  2097 		r=TheFs.Volume(volInfo,driveNum);
  2097 		test(r==KErrNone);
  2098 		test_KErrNone(r);
  2098 
  2099 
  2099 		test(volInfo.iName==_L("ABCDEFGHIJK"));
  2100 		test(volInfo.iName==_L("ABCDEFGHIJK"));
  2100 
  2101 
  2101 	//	Test notification does not occur under ENotifyAttributes
  2102 	//	Test notification does not occur under ENotifyAttributes
  2102 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
  2103 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
  2103 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
  2104 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
  2104 		test(r==KErrNone);
  2105 		test_KErrNone(r);
  2105 		test(reqStat==KRequestPending);
  2106 		test(reqStat==KRequestPending);
  2106 		r=TheFs.Volume(volInfo,driveNum);
  2107 		r=TheFs.Volume(volInfo,driveNum);
  2107 		test(r==KErrNone);
  2108 		test_KErrNone(r);
  2108 
  2109 
  2109 		test(volInfo.iName==_L("TROPICANA"));
  2110 		test(volInfo.iName==_L("TROPICANA"));
  2110 
  2111 
  2111 		fs.NotifyChangeCancel(reqStat);
  2112 		fs.NotifyChangeCancel(reqStat);
  2112 		User::WaitForRequest(reqStat);
  2113 		User::WaitForRequest(reqStat);
  2113 		test(reqStat==KErrCancel);
  2114 		test(reqStat==KErrCancel);
  2114 	//	Test notification occurs under ENotifyEntry
  2115 	//	Test notification occurs under ENotifyEntry
  2115 		fs.NotifyChange(ENotifyEntry,reqStat,path);
  2116 		fs.NotifyChange(ENotifyEntry,reqStat,path);
  2116 		test(reqStat==KRequestPending);
  2117 		test(reqStat==KRequestPending);
  2117 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  2118 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  2118 		test(r==KErrNone);
  2119 		test_KErrNone(r);
  2119 		User::WaitForRequest(reqStat);
  2120 		User::WaitForRequest(reqStat);
  2120 		test(reqStat==KErrNone);
  2121 		test(reqStat==KErrNone);
  2121 		r=TheFs.Volume(volInfo,driveNum);
  2122 		r=TheFs.Volume(volInfo,driveNum);
  2122 		test(r==KErrNone);
  2123 		test_KErrNone(r);
  2123 		test(volInfo.iName==currentVolName);
  2124 		test(volInfo.iName==currentVolName);
  2124 		}
  2125 		}
  2125 
  2126 
  2126 	else	//	RFs::SetVolumeLabel() doesn't work on subst drives
  2127 	else	//	RFs::SetVolumeLabel() doesn't work on subst drives
  2127 		{
  2128 		{
  2135 
  2136 
  2136 	test.Next(_L("RFs::Rename()"));
  2137 	test.Next(_L("RFs::Rename()"));
  2137 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2138 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2138 	test(reqStat==KRequestPending);
  2139 	test(reqStat==KRequestPending);
  2139 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
  2140 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
  2140 	test(r==KErrNone);
  2141 	test_KErrNone(r);
  2141 	User::WaitForRequest(reqStat);
  2142 	User::WaitForRequest(reqStat);
  2142 	test(reqStat==KErrNone);
  2143 	test(reqStat==KErrNone);
  2143 
  2144 
  2144 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
  2145 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
  2145 	test(r==KErrNone);
  2146 	test_KErrNone(r);
  2146 
  2147 
  2147 #if defined(__WINS__)
  2148 #if defined(__WINS__)
  2148 	if(gSessionPath[0]=='Y'||gSessionPath[0]=='X')
  2149 	if(gSessionPath[0]=='Y'||gSessionPath[0]=='X')
  2149 #endif
  2150 #endif
  2150 		{
  2151 		{
  2151 		test.Next(_L("RFs::Rename() with max path length"));
  2152 		test.Next(_L("RFs::Rename() with max path length"));
  2152 		TFileName longName=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  2153 		TFileName longName=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
  2153 		while(longName.Length()<(KMaxFileName-2))
  2154 		while(longName.Length()<(KMaxFileName-2))
  2154 			longName+=_L("a");
  2155 			longName+=_L("a");
  2155 		r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),longName);
  2156 		r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),longName);
  2156 		test(r==KErrNone);
  2157 		test_KErrNone(r);
  2157 		fs.NotifyChange(ENotifyEntry,reqStat,longName);
  2158 		fs.NotifyChange(ENotifyEntry,reqStat,longName);
  2158 		test(reqStat==KRequestPending);
  2159 		test(reqStat==KRequestPending);
  2159 		r=TheFs.Rename(longName,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
  2160 		r=TheFs.Rename(longName,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
  2160 		test(r==KErrNone);
  2161 		test_KErrNone(r);
  2161 		User::WaitForRequest(reqStat);
  2162 		User::WaitForRequest(reqStat);
  2162 		test(reqStat==KErrNone);
  2163 		test(reqStat==KErrNone);
  2163 		}
  2164 		}
  2164 
  2165 
  2165 	fs.Close();
  2166 	fs.Close();
  2173 //	Repeat Test15 operations in a subtree of that monitored, and ensure notification
  2174 //	Repeat Test15 operations in a subtree of that monitored, and ensure notification
  2174 //	occurs for a variety of RFile and RFs operations
  2175 //	occurs for a variety of RFile and RFs operations
  2175 //
  2176 //
  2176 	RFs fs;					//	Session to be notified when a change occurs
  2177 	RFs fs;					//	Session to be notified when a change occurs
  2177 	TInt r=fs.Connect();
  2178 	TInt r=fs.Connect();
  2178 	test(r==KErrNone);
  2179 	test_KErrNone(r);
  2179 	r=fs.SetSessionPath(gSessionPath);
  2180 	r=fs.SetSessionPath(gSessionPath);
  2180 	test(r==KErrNone);
  2181 	test_KErrNone(r);
  2181 
  2182 
  2182 //	RFile::Write() to a file in the subtree
  2183 //	RFile::Write() to a file in the subtree
  2183 	test.Next(_L("RFile::Write()"));
  2184 	test.Next(_L("RFile::Write()"));
  2184 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  2185 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  2185 	TRequestStatus reqStat(KRequestPending);
  2186 	TRequestStatus reqStat(KRequestPending);
  2186 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2187 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2187 
  2188 
  2188 	RFile file;
  2189 	RFile file;
  2189 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2190 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2190 	test(r==KErrNone);
  2191 	test_KErrNone(r);
  2191 	test(reqStat==KRequestPending);
  2192 	test(reqStat==KRequestPending);
  2192 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  2193 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  2193 	file.Close();
  2194 	file.Close();
  2194 	User::WaitForRequest(reqStat);
  2195 	User::WaitForRequest(reqStat);
  2195 	test(reqStat==KErrNone);
  2196 	test(reqStat==KErrNone);
  2196 
  2197 
  2197 //	RFile::Read() a file within the monitored directory - no notification for reads
  2198 //	RFile::Read() a file within the monitored directory - no notification for reads
  2198 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2199 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2199 	TBuf8<100> temp;
  2200 	TBuf8<100> temp;
  2200 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2201 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2201 	test(r==KErrNone);
  2202 	test_KErrNone(r);
  2202 	test(reqStat==KRequestPending);
  2203 	test(reqStat==KRequestPending);
  2203 	r=file.Read(0,temp,100);
  2204 	r=file.Read(0,temp,100);
  2204 	test(reqStat==KRequestPending);
  2205 	test(reqStat==KRequestPending);
  2205 
  2206 
  2206 //	RFile::SetAtt() of a file within the monitored directory
  2207 //	RFile::SetAtt() of a file within the monitored directory
  2207 	test.Next(_L("RFile::SetAtt()"));
  2208 	test.Next(_L("RFile::SetAtt()"));
  2208 	r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
  2209 	r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
  2209 	test(r==KErrNone);
  2210 	test_KErrNone(r);
  2210 	User::WaitForRequest(reqStat);
  2211 	User::WaitForRequest(reqStat);
  2211 	test(reqStat==KErrNone);
  2212 	test(reqStat==KErrNone);
  2212 
  2213 
  2213 //	RFile::SetSize() of a file within the monitored directory
  2214 //	RFile::SetSize() of a file within the monitored directory
  2214 	test.Next(_L("RFile::SetSize()"));
  2215 	test.Next(_L("RFile::SetSize()"));
  2215 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2216 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2216 	test(reqStat==KRequestPending);
  2217 	test(reqStat==KRequestPending);
  2217 	r=file.SetSize(256);
  2218 	r=file.SetSize(256);
  2218 	test(r==KErrNone);
  2219 	test_KErrNone(r);
  2219 	User::WaitForRequest(reqStat);
  2220 	User::WaitForRequest(reqStat);
  2220 	test(reqStat==KErrNone);
  2221 	test(reqStat==KErrNone);
  2221 	file.Close();
  2222 	file.Close();
  2222 
  2223 
  2223 //	RFile::Temp() to create a temp file in the subtree
  2224 //	RFile::Temp() to create a temp file in the subtree
  2224 	test.Next(_L("RFile::Temp()"));
  2225 	test.Next(_L("RFile::Temp()"));
  2225 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2226 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2226 	test(reqStat==KRequestPending);
  2227 	test(reqStat==KRequestPending);
  2227 	TFileName fileName;
  2228 	TFileName fileName;
  2228 	r=file.Temp(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"),fileName,EFileWrite);
  2229 	r=file.Temp(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"),fileName,EFileWrite);
  2229 	test(r==KErrNone);
  2230 	test_KErrNone(r);
  2230 	User::WaitForRequest(reqStat);
  2231 	User::WaitForRequest(reqStat);
  2231 	test(reqStat==KErrNone);
  2232 	test(reqStat==KErrNone);
  2232 	file.Close();
  2233 	file.Close();
  2233 
  2234 
  2234 //	RFile::SetModified() to change modification time of a file within monitored dir
  2235 //	RFile::SetModified() to change modification time of a file within monitored dir
  2235 	test.Next(_L("RFile::SetModified()"));
  2236 	test.Next(_L("RFile::SetModified()"));
  2236 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2237 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2237 	TTime now;
  2238 	TTime now;
  2238 	now.HomeTime();
  2239 	now.HomeTime();
  2239 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2240 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2240 	test(r==KErrNone);
  2241 	test_KErrNone(r);
  2241 	test(reqStat==KRequestPending);
  2242 	test(reqStat==KRequestPending);
  2242 	file.SetModified(now);
  2243 	file.SetModified(now);
  2243 	file.Close();
  2244 	file.Close();
  2244 	User::WaitForRequest(reqStat);
  2245 	User::WaitForRequest(reqStat);
  2245 	test(reqStat==KErrNone);
  2246 	test(reqStat==KErrNone);
  2250 	TEntry entry;
  2251 	TEntry entry;
  2251 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
  2252 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
  2252 	test(reqStat==KRequestPending);
  2253 	test(reqStat==KRequestPending);
  2253 	now.HomeTime();
  2254 	now.HomeTime();
  2254 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
  2255 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
  2255 	test(r==KErrNone);
  2256 	test_KErrNone(r);
  2256 	User::WaitForRequest(reqStat);
  2257 	User::WaitForRequest(reqStat);
  2257 	test(reqStat==KErrNone);
  2258 	test(reqStat==KErrNone);
  2258 
  2259 
  2259 //	RFile::Set() to change file's modification time and attributes
  2260 //	RFile::Set() to change file's modification time and attributes
  2260 	test.Next(_L("RFile::Set()"));
  2261 	test.Next(_L("RFile::Set()"));
  2261 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2262 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2262 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2263 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2263 	test(r==KErrNone);
  2264 	test_KErrNone(r);
  2264 	test(reqStat==KRequestPending);
  2265 	test(reqStat==KRequestPending);
  2265 	now.HomeTime();
  2266 	now.HomeTime();
  2266 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  2267 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  2267 	file.Close();
  2268 	file.Close();
  2268 	User::WaitForRequest(reqStat);
  2269 	User::WaitForRequest(reqStat);
  2272 	test.Next(_L("RFs::SetDriveName()"));
  2273 	test.Next(_L("RFs::SetDriveName()"));
  2273 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2274 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2274 	test(reqStat==KRequestPending);
  2275 	test(reqStat==KRequestPending);
  2275 	User::After(KNotifyChangeAfter);
  2276 	User::After(KNotifyChangeAfter);
  2276 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  2277 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  2277 	test(r==KErrNone);
  2278 	test_KErrNone(r);
  2278 	User::WaitForRequest(reqStat);
  2279 	User::WaitForRequest(reqStat);
  2279 	test(reqStat==KErrNone);
  2280 	test(reqStat==KErrNone);
  2280 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2281 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2281 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
  2282 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
  2282 	test(r==KErrNone);
  2283 	test_KErrNone(r);
  2283 	test(reqStat==KRequestPending);
  2284 	test(reqStat==KRequestPending);
  2284 	User::After(KNotifyChangeAfter);
  2285 	User::After(KNotifyChangeAfter);
  2285 	fs.NotifyChangeCancel(reqStat);
  2286 	fs.NotifyChangeCancel(reqStat);
  2286 	User::WaitForRequest(reqStat);
  2287 	User::WaitForRequest(reqStat);
  2287 	test(reqStat==KErrCancel);
  2288 	test(reqStat==KErrCancel);
  2288 	fs.NotifyChange(ENotifyDisk,reqStat,path);
  2289 	fs.NotifyChange(ENotifyDisk,reqStat,path);
  2289 	User::After(KNotifyChangeAfter);
  2290 	User::After(KNotifyChangeAfter);
  2290 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
  2291 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
  2291 	test(r==KErrNone);
  2292 	test_KErrNone(r);
  2292 	test(reqStat==KRequestPending);
  2293 	test(reqStat==KRequestPending);
  2293 	fs.NotifyChangeCancel(reqStat);
  2294 	fs.NotifyChangeCancel(reqStat);
  2294 	User::WaitForRequest(reqStat);
  2295 	User::WaitForRequest(reqStat);
  2295 	test(reqStat==KErrCancel);
  2296 	test(reqStat==KErrCancel);
  2296 
  2297 
  2297 //	RFs::MkDir()
  2298 //	RFs::MkDir()
  2298 	test.Next(_L("RFs::MkDir()"));
  2299 	test.Next(_L("RFs::MkDir()"));
  2299 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2300 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2300 	test(reqStat==KRequestPending);
  2301 	test(reqStat==KRequestPending);
  2301 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2302 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2302 	test(r==KErrNone);
  2303 	test_KErrNone(r);
  2303 	User::WaitForRequest(reqStat);
  2304 	User::WaitForRequest(reqStat);
  2304 	test(reqStat==KErrNone);
  2305 	test(reqStat==KErrNone);
  2305 
  2306 
  2306 //	RFs::RmDir()
  2307 //	RFs::RmDir()
  2307 	test.Next(_L("RFs::RmDir()"));
  2308 	test.Next(_L("RFs::RmDir()"));
  2308 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2309 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2309 	test(reqStat==KRequestPending);
  2310 	test(reqStat==KRequestPending);
  2310 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2311 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2311 	test(r==KErrNone);
  2312 	test_KErrNone(r);
  2312 	User::WaitForRequest(reqStat);
  2313 	User::WaitForRequest(reqStat);
  2313 	test(reqStat==KErrNone);
  2314 	test(reqStat==KErrNone);
  2314 
  2315 
  2315 //	RFile::Create()
  2316 //	RFile::Create()
  2316 	test.Next(_L("RFile::Create()"));
  2317 	test.Next(_L("RFile::Create()"));
  2317 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2318 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2318 	test(reqStat==KRequestPending);
  2319 	test(reqStat==KRequestPending);
  2319 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2320 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2320 	test(r==KErrNone);
  2321 	test_KErrNone(r);
  2321 	User::WaitForRequest(reqStat);
  2322 	User::WaitForRequest(reqStat);
  2322 	test(reqStat==KErrNone);
  2323 	test(reqStat==KErrNone);
  2323 	file.Close();
  2324 	file.Close();
  2324 
  2325 
  2325 //	RFs::Delete()
  2326 //	RFs::Delete()
  2326 	test.Next(_L("RFs::Delete()"));
  2327 	test.Next(_L("RFs::Delete()"));
  2327 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2328 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2328 	test(reqStat==KRequestPending);
  2329 	test(reqStat==KRequestPending);
  2329 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2330 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2330 	test(r==KErrNone);
  2331 	test_KErrNone(r);
  2331 	User::WaitForRequest(reqStat);
  2332 	User::WaitForRequest(reqStat);
  2332 	test(reqStat==KErrNone);
  2333 	test(reqStat==KErrNone);
  2333 
  2334 
  2334 //	RFile::Replace()
  2335 //	RFile::Replace()
  2335 	test.Next(_L("RFile::Replace()"));
  2336 	test.Next(_L("RFile::Replace()"));
  2336 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2337 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2337 	test(reqStat==KRequestPending);
  2338 	test(reqStat==KRequestPending);
  2338 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2339 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2339 	test(r==KErrNone);
  2340 	test_KErrNone(r);
  2340 	User::WaitForRequest(reqStat);
  2341 	User::WaitForRequest(reqStat);
  2341 	test(reqStat==KErrNone);
  2342 	test(reqStat==KErrNone);
  2342 	file.Close();
  2343 	file.Close();
  2343 
  2344 
  2344 //	RFs::Delete()
  2345 //	RFs::Delete()
  2345 	test.Next(_L("RFs::Delete()"));
  2346 	test.Next(_L("RFs::Delete()"));
  2346 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2347 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2347 	test(reqStat==KRequestPending);
  2348 	test(reqStat==KRequestPending);
  2348 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2349 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2349 	test(r==KErrNone);
  2350 	test_KErrNone(r);
  2350 	User::WaitForRequest(reqStat);
  2351 	User::WaitForRequest(reqStat);
  2351 	test(reqStat==KErrNone);
  2352 	test(reqStat==KErrNone);
  2352 
  2353 
  2353 //	RFs::SetVolumeLabel() - should be notification under relevant TNotifyType monitoring
  2354 //	RFs::SetVolumeLabel() - should be notification under relevant TNotifyType monitoring
  2354 //	The operation is non-path specific so all outstanding interested requests are notified
  2355 //	The operation is non-path specific so all outstanding interested requests are notified
  2358 
  2359 
  2359 	TInt driveNum=CurrentDrive();
  2360 	TInt driveNum=CurrentDrive();
  2360 	TVolumeInfo volInfo;
  2361 	TVolumeInfo volInfo;
  2361 	TFileName currentVolName;
  2362 	TFileName currentVolName;
  2362 	r=TheFs.Volume(volInfo,driveNum);
  2363 	r=TheFs.Volume(volInfo,driveNum);
  2363 	test(r==KErrNone);
  2364 	test_KErrNone(r);
  2364 	test(reqStat==KRequestPending);
  2365 	test(reqStat==KRequestPending);
  2365 	currentVolName=volInfo.iName;
  2366 	currentVolName=volInfo.iName;
  2366 
  2367 
  2367 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  2368 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  2368 	if (r==KErrNone)
  2369 	if (r==KErrNone)
  2369 		{
  2370 		{
  2370 		User::WaitForRequest(reqStat);
  2371 		User::WaitForRequest(reqStat);
  2371 		test(reqStat==KErrNone);
  2372 		test(reqStat==KErrNone);
  2372 		r=TheFs.Volume(volInfo,driveNum);
  2373 		r=TheFs.Volume(volInfo,driveNum);
  2373 		test(r==KErrNone);
  2374 		test_KErrNone(r);
  2374 		test(volInfo.iName==_L("VOL"));
  2375 		test(volInfo.iName==_L("VOL"));
  2375 	//	Test notification occurs under ENotifyDisk
  2376 	//	Test notification occurs under ENotifyDisk
  2376 		fs.NotifyChange(ENotifyDisk,reqStat,path);
  2377 		fs.NotifyChange(ENotifyDisk,reqStat,path);
  2377 		test(reqStat==KRequestPending);
  2378 		test(reqStat==KRequestPending);
  2378 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  2379 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  2379 		test(r==KErrNone);
  2380 		test_KErrNone(r);
  2380 		User::WaitForRequest(reqStat);
  2381 		User::WaitForRequest(reqStat);
  2381 		test(reqStat==KErrNone);
  2382 		test(reqStat==KErrNone);
  2382 		r=TheFs.Volume(volInfo,driveNum);
  2383 		r=TheFs.Volume(volInfo,driveNum);
  2383 		test(r==KErrNone);
  2384 		test_KErrNone(r);
  2384 
  2385 
  2385 		test(volInfo.iName==_L("ABCDEFGHIJK"));
  2386 		test(volInfo.iName==_L("ABCDEFGHIJK"));
  2386 
  2387 
  2387 	//	Test notification does not occur under ENotifyAttributes
  2388 	//	Test notification does not occur under ENotifyAttributes
  2388 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
  2389 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
  2389 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
  2390 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
  2390 		test(r==KErrNone);
  2391 		test_KErrNone(r);
  2391 		test(reqStat==KRequestPending);
  2392 		test(reqStat==KRequestPending);
  2392 		r=TheFs.Volume(volInfo,driveNum);
  2393 		r=TheFs.Volume(volInfo,driveNum);
  2393 		test(r==KErrNone);
  2394 		test_KErrNone(r);
  2394 
  2395 
  2395 		test(volInfo.iName==_L("TROPICANA"));
  2396 		test(volInfo.iName==_L("TROPICANA"));
  2396 
  2397 
  2397 		fs.NotifyChangeCancel(reqStat);
  2398 		fs.NotifyChangeCancel(reqStat);
  2398 		User::WaitForRequest(reqStat);
  2399 		User::WaitForRequest(reqStat);
  2399 		test(reqStat==KErrCancel);
  2400 		test(reqStat==KErrCancel);
  2400 	//	Test notification occurs under ENotifyEntry
  2401 	//	Test notification occurs under ENotifyEntry
  2401 		fs.NotifyChange(ENotifyEntry,reqStat,path);
  2402 		fs.NotifyChange(ENotifyEntry,reqStat,path);
  2402 		test(reqStat==KRequestPending);
  2403 		test(reqStat==KRequestPending);
  2403 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  2404 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  2404 		test(r==KErrNone);
  2405 		test_KErrNone(r);
  2405 		User::WaitForRequest(reqStat);
  2406 		User::WaitForRequest(reqStat);
  2406 		test(reqStat==KErrNone);
  2407 		test(reqStat==KErrNone);
  2407 		r=TheFs.Volume(volInfo,driveNum);
  2408 		r=TheFs.Volume(volInfo,driveNum);
  2408 		test(r==KErrNone);
  2409 		test_KErrNone(r);
  2409 		test(volInfo.iName==currentVolName);
  2410 		test(volInfo.iName==currentVolName);
  2410 		}
  2411 		}
  2411 
  2412 
  2412 	else	//	RFs::SetVolumeLabel() doesn't work on subst drives
  2413 	else	//	RFs::SetVolumeLabel() doesn't work on subst drives
  2413 		{
  2414 		{
  2420 
  2421 
  2421 //	Test that notification is made when change is made to monitored directory
  2422 //	Test that notification is made when change is made to monitored directory
  2422 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2423 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2423 	test(reqStat==KRequestPending);
  2424 	test(reqStat==KRequestPending);
  2424 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2425 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2425 	test(r==KErrNone);
  2426 	test_KErrNone(r);
  2426 	User::WaitForRequest(reqStat);
  2427 	User::WaitForRequest(reqStat);
  2427 	test(reqStat==KErrNone);
  2428 	test(reqStat==KErrNone);
  2428 
  2429 
  2429 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2430 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2430 	test(reqStat==KRequestPending);
  2431 	test(reqStat==KRequestPending);
  2431 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2432 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2432 	test(r==KErrNone);
  2433 	test_KErrNone(r);
  2433 	User::WaitForRequest(reqStat);
  2434 	User::WaitForRequest(reqStat);
  2434 	test(reqStat==KErrNone);
  2435 	test(reqStat==KErrNone);
  2435 	fs.Close();
  2436 	fs.Close();
  2436 	}
  2437 	}
  2437 
  2438 
  2443 //	Repeat Test15 operations in a subtree of that monitored, and ensure notification
  2444 //	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
  2445 //	does occur for a variety of file operations when subtree watching is on
  2445 //
  2446 //
  2446 	RFs fs;
  2447 	RFs fs;
  2447 	TInt r=fs.Connect();	//	Session to be notified when a change occurs
  2448 	TInt r=fs.Connect();	//	Session to be notified when a change occurs
  2448 	test(r==KErrNone);
  2449 	test_KErrNone(r);
  2449 	r=fs.SetSessionPath(gSessionPath);
  2450 	r=fs.SetSessionPath(gSessionPath);
  2450 	test(r==KErrNone);
  2451 	test_KErrNone(r);
  2451 
  2452 
  2452 //	RFile::Write() to a file in the subtree
  2453 //	RFile::Write() to a file in the subtree
  2453 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  2454 	TFileName path=_L("\\F32-TST\\NOTIFY\\");
  2454 	TRequestStatus reqStat(KRequestPending);
  2455 	TRequestStatus reqStat(KRequestPending);
  2455 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2456 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2456 
  2457 
  2457 	RFile file;
  2458 	RFile file;
  2458 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2459 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2459 	test(r==KErrNone);
  2460 	test_KErrNone(r);
  2460 	test(reqStat==KRequestPending);
  2461 	test(reqStat==KRequestPending);
  2461 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  2462 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  2462 	file.Close();
  2463 	file.Close();
  2463 	User::WaitForRequest(reqStat);
  2464 	User::WaitForRequest(reqStat);
  2464 	test(reqStat==KErrNone);
  2465 	test(reqStat==KErrNone);
  2465 
  2466 
  2466 //	RFile::Read() a file within the monitored directory - no notification for reads
  2467 //	RFile::Read() a file within the monitored directory - no notification for reads
  2467 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2468 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2468 	TBuf8<100> temp;
  2469 	TBuf8<100> temp;
  2469 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2470 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2470 	test(r==KErrNone);
  2471 	test_KErrNone(r);
  2471 	test(reqStat==KRequestPending);
  2472 	test(reqStat==KRequestPending);
  2472 	r=file.Read(0,temp,100);
  2473 	r=file.Read(0,temp,100);
  2473 	test(reqStat==KRequestPending);
  2474 	test(reqStat==KRequestPending);
  2474 
  2475 
  2475 //	RFile::SetAtt() of a file within the monitored directory
  2476 //	RFile::SetAtt() of a file within the monitored directory
  2476 	r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
  2477 	r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
  2477 	test(r==KErrNone);
  2478 	test_KErrNone(r);
  2478 	User::WaitForRequest(reqStat);
  2479 	User::WaitForRequest(reqStat);
  2479 	test(reqStat==KErrNone);
  2480 	test(reqStat==KErrNone);
  2480 
  2481 
  2481 //	RFile::SetSize() of a file within the monitored directory
  2482 //	RFile::SetSize() of a file within the monitored directory
  2482 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2483 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2483 	test(reqStat==KRequestPending);
  2484 	test(reqStat==KRequestPending);
  2484 	r=file.SetSize(256);
  2485 	r=file.SetSize(256);
  2485 	test(r==KErrNone);
  2486 	test_KErrNone(r);
  2486 	User::WaitForRequest(reqStat);
  2487 	User::WaitForRequest(reqStat);
  2487 	test(reqStat==KErrNone);
  2488 	test(reqStat==KErrNone);
  2488 	file.Close();
  2489 	file.Close();
  2489 
  2490 
  2490 
  2491 
  2491 //	RFile::SetModified() to change modification time of a file within monitored dir
  2492 //	RFile::SetModified() to change modification time of a file within monitored dir
  2492 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2493 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2493 	TTime now;
  2494 	TTime now;
  2494 	now.HomeTime();
  2495 	now.HomeTime();
  2495 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2496 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2496 	test(r==KErrNone);
  2497 	test_KErrNone(r);
  2497 	test(reqStat==KRequestPending);
  2498 	test(reqStat==KRequestPending);
  2498 	file.SetModified(now);
  2499 	file.SetModified(now);
  2499 	file.Close();
  2500 	file.Close();
  2500 	User::WaitForRequest(reqStat);
  2501 	User::WaitForRequest(reqStat);
  2501 	test(reqStat==KErrNone);
  2502 	test(reqStat==KErrNone);
  2505 	TEntry entry;
  2506 	TEntry entry;
  2506 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
  2507 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
  2507 	test(reqStat==KRequestPending);
  2508 	test(reqStat==KRequestPending);
  2508 	now.HomeTime();
  2509 	now.HomeTime();
  2509 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
  2510 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
  2510 	test(r==KErrNone);
  2511 	test_KErrNone(r);
  2511 	User::WaitForRequest(reqStat);
  2512 	User::WaitForRequest(reqStat);
  2512 	test(reqStat==KErrNone);
  2513 	test(reqStat==KErrNone);
  2513 
  2514 
  2514 //	RFile::Set() to change file's modification time and attributes
  2515 //	RFile::Set() to change file's modification time and attributes
  2515 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2516 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2516 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2517 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
  2517 	test(r==KErrNone);
  2518 	test_KErrNone(r);
  2518 	test(reqStat==KRequestPending);
  2519 	test(reqStat==KRequestPending);
  2519 	now.HomeTime();
  2520 	now.HomeTime();
  2520 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  2521 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  2521 	file.Close();
  2522 	file.Close();
  2522 	User::WaitForRequest(reqStat);
  2523 	User::WaitForRequest(reqStat);
  2525 //	RFs::SetDriveName() - should be no notification ever with extended notification
  2526 //	RFs::SetDriveName() - should be no notification ever with extended notification
  2526 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2527 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2527 	test(reqStat==KRequestPending);
  2528 	test(reqStat==KRequestPending);
  2528 	User::After(KNotifyChangeAfter);
  2529 	User::After(KNotifyChangeAfter);
  2529 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  2530 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  2530 	test(r==KErrNone);
  2531 	test_KErrNone(r);
  2531 	User::WaitForRequest(reqStat);
  2532 	User::WaitForRequest(reqStat);
  2532 	test(reqStat==KErrNone);
  2533 	test(reqStat==KErrNone);
  2533 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2534 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2534 	User::After(KNotifyChangeAfter);
  2535 	User::After(KNotifyChangeAfter);
  2535 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
  2536 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
  2536 	test(r==KErrNone);
  2537 	test_KErrNone(r);
  2537 	test(reqStat==KRequestPending);
  2538 	test(reqStat==KRequestPending);
  2538 	fs.NotifyChangeCancel(reqStat);
  2539 	fs.NotifyChangeCancel(reqStat);
  2539 	User::WaitForRequest(reqStat);
  2540 	User::WaitForRequest(reqStat);
  2540 	fs.NotifyChange(ENotifyDisk,reqStat,path);
  2541 	fs.NotifyChange(ENotifyDisk,reqStat,path);
  2541 	User::After(KNotifyChangeAfter);
  2542 	User::After(KNotifyChangeAfter);
  2542 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
  2543 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
  2543 	test(r==KErrNone);
  2544 	test_KErrNone(r);
  2544 	test(reqStat==KRequestPending);
  2545 	test(reqStat==KRequestPending);
  2545 	fs.NotifyChangeCancel(reqStat);
  2546 	fs.NotifyChangeCancel(reqStat);
  2546 	User::WaitForRequest(reqStat);
  2547 	User::WaitForRequest(reqStat);
  2547 	test(reqStat==KErrCancel);
  2548 	test(reqStat==KErrCancel);
  2548 
  2549 
  2549 
  2550 
  2550 //	RFs::MkDir()
  2551 //	RFs::MkDir()
  2551 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2552 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2552 	test(reqStat==KRequestPending);
  2553 	test(reqStat==KRequestPending);
  2553 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2554 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2554 	test(r==KErrNone);
  2555 	test_KErrNone(r);
  2555 	User::WaitForRequest(reqStat);
  2556 	User::WaitForRequest(reqStat);
  2556 	test(reqStat==KErrNone);
  2557 	test(reqStat==KErrNone);
  2557 
  2558 
  2558 //	RFs::RmDir()
  2559 //	RFs::RmDir()
  2559 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2560 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2560 	test(reqStat==KRequestPending);
  2561 	test(reqStat==KRequestPending);
  2561 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2562 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
  2562 	test(r==KErrNone);
  2563 	test_KErrNone(r);
  2563 	User::WaitForRequest(reqStat);
  2564 	User::WaitForRequest(reqStat);
  2564 	test(reqStat==KErrNone);
  2565 	test(reqStat==KErrNone);
  2565 
  2566 
  2566 //	RFile::Create()
  2567 //	RFile::Create()
  2567 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2568 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2568 	test(reqStat==KRequestPending);
  2569 	test(reqStat==KRequestPending);
  2569 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2570 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2570 	test(r==KErrNone);
  2571 	test_KErrNone(r);
  2571 	User::WaitForRequest(reqStat);
  2572 	User::WaitForRequest(reqStat);
  2572 	test(reqStat==KErrNone);
  2573 	test(reqStat==KErrNone);
  2573 	file.Close();
  2574 	file.Close();
  2574 
  2575 
  2575 //	RFs::Delete()
  2576 //	RFs::Delete()
  2576 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2577 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2577 	test(reqStat==KRequestPending);
  2578 	test(reqStat==KRequestPending);
  2578 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2579 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2579 	test(r==KErrNone);
  2580 	test_KErrNone(r);
  2580 	User::WaitForRequest(reqStat);
  2581 	User::WaitForRequest(reqStat);
  2581 	test(reqStat==KErrNone);
  2582 	test(reqStat==KErrNone);
  2582 
  2583 
  2583 //	RFile::Replace()
  2584 //	RFile::Replace()
  2584 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2585 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2585 	test(reqStat==KRequestPending);
  2586 	test(reqStat==KRequestPending);
  2586 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2587 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
  2587 	test(r==KErrNone);
  2588 	test_KErrNone(r);
  2588 	User::WaitForRequest(reqStat);
  2589 	User::WaitForRequest(reqStat);
  2589 	test(reqStat==KErrNone);
  2590 	test(reqStat==KErrNone);
  2590 	file.Close();
  2591 	file.Close();
  2591 
  2592 
  2592 //	RFs::Delete()
  2593 //	RFs::Delete()
  2593 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2594 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2594 	test(reqStat==KRequestPending);
  2595 	test(reqStat==KRequestPending);
  2595 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2596 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
  2596 	test(r==KErrNone);
  2597 	test_KErrNone(r);
  2597 	User::WaitForRequest(reqStat);
  2598 	User::WaitForRequest(reqStat);
  2598 	test(reqStat==KErrNone);
  2599 	test(reqStat==KErrNone);
  2599 
  2600 
  2600 //	RFs::SetVolumeLabel()
  2601 //	RFs::SetVolumeLabel()
  2601 //	Not path specific, so all outstanding requests of correct TNotifyType are notified
  2602 //	Not path specific, so all outstanding requests of correct TNotifyType are notified
  2602 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2603 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2603 	TInt driveNum=CurrentDrive();
  2604 	TInt driveNum=CurrentDrive();
  2604 	TVolumeInfo volInfo;
  2605 	TVolumeInfo volInfo;
  2605 	TFileName currentVolName;
  2606 	TFileName currentVolName;
  2606 	r=TheFs.Volume(volInfo,driveNum);
  2607 	r=TheFs.Volume(volInfo,driveNum);
  2607 	test(r==KErrNone);
  2608 	test_KErrNone(r);
  2608 	test(reqStat==KRequestPending);
  2609 	test(reqStat==KRequestPending);
  2609 	currentVolName=volInfo.iName;
  2610 	currentVolName=volInfo.iName;
  2610 
  2611 
  2611 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  2612 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  2612 	if (r==KErrNone)
  2613 	if (r==KErrNone)
  2613 		{
  2614 		{
  2614 		User::WaitForRequest(reqStat);
  2615 		User::WaitForRequest(reqStat);
  2615 		test(reqStat==KErrNone);
  2616 		test(reqStat==KErrNone);
  2616 		r=TheFs.Volume(volInfo,driveNum);
  2617 		r=TheFs.Volume(volInfo,driveNum);
  2617 		test(r==KErrNone);
  2618 		test_KErrNone(r);
  2618 		test(volInfo.iName==_L("VOL"));
  2619 		test(volInfo.iName==_L("VOL"));
  2619 	//	Test notification occurs under ENotifyDisk
  2620 	//	Test notification occurs under ENotifyDisk
  2620 		fs.NotifyChange(ENotifyDisk,reqStat,path);
  2621 		fs.NotifyChange(ENotifyDisk,reqStat,path);
  2621 		test(reqStat==KRequestPending);
  2622 		test(reqStat==KRequestPending);
  2622 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  2623 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  2623 		test(r==KErrNone);
  2624 		test_KErrNone(r);
  2624 		User::WaitForRequest(reqStat);
  2625 		User::WaitForRequest(reqStat);
  2625 		test(reqStat==KErrNone);
  2626 		test(reqStat==KErrNone);
  2626 		r=TheFs.Volume(volInfo,driveNum);
  2627 		r=TheFs.Volume(volInfo,driveNum);
  2627 		test(r==KErrNone);
  2628 		test_KErrNone(r);
  2628 
  2629 
  2629 		test(volInfo.iName==_L("ABCDEFGHIJK"));
  2630 		test(volInfo.iName==_L("ABCDEFGHIJK"));
  2630 
  2631 
  2631 	//	Test notification does not occur under ENotifyAttributes
  2632 	//	Test notification does not occur under ENotifyAttributes
  2632 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
  2633 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
  2633 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
  2634 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
  2634 		test(r==KErrNone);
  2635 		test_KErrNone(r);
  2635 		test(reqStat==KRequestPending);
  2636 		test(reqStat==KRequestPending);
  2636 		r=TheFs.Volume(volInfo,driveNum);
  2637 		r=TheFs.Volume(volInfo,driveNum);
  2637 		test(r==KErrNone);
  2638 		test_KErrNone(r);
  2638 
  2639 
  2639 		test(volInfo.iName==_L("TROPICANA"));
  2640 		test(volInfo.iName==_L("TROPICANA"));
  2640 
  2641 
  2641 		fs.NotifyChangeCancel(reqStat);
  2642 		fs.NotifyChangeCancel(reqStat);
  2642 		User::WaitForRequest(reqStat);
  2643 		User::WaitForRequest(reqStat);
  2643 		test(reqStat==KErrCancel);
  2644 		test(reqStat==KErrCancel);
  2644 	//	Test notification occurs under ENotifyEntry
  2645 	//	Test notification occurs under ENotifyEntry
  2645 		fs.NotifyChange(ENotifyEntry,reqStat,path);
  2646 		fs.NotifyChange(ENotifyEntry,reqStat,path);
  2646 		test(reqStat==KRequestPending);
  2647 		test(reqStat==KRequestPending);
  2647 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  2648 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  2648 		test(r==KErrNone);
  2649 		test_KErrNone(r);
  2649 		User::WaitForRequest(reqStat);
  2650 		User::WaitForRequest(reqStat);
  2650 		test(reqStat==KErrNone);
  2651 		test(reqStat==KErrNone);
  2651 		r=TheFs.Volume(volInfo,driveNum);
  2652 		r=TheFs.Volume(volInfo,driveNum);
  2652 		test(r==KErrNone);
  2653 		test_KErrNone(r);
  2653 		test(volInfo.iName==currentVolName);
  2654 		test(volInfo.iName==currentVolName);
  2654 		}
  2655 		}
  2655 
  2656 
  2656 	else	//	RFs::SetVolumeLabel() doesn't work on subst drives
  2657 	else	//	RFs::SetVolumeLabel() doesn't work on subst drives
  2657 		{
  2658 		{
  2662 
  2663 
  2663 //	RFs::Rename()
  2664 //	RFs::Rename()
  2664 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2665 	fs.NotifyChange(ENotifyEntry,reqStat,path);
  2665 	test(reqStat==KRequestPending);
  2666 	test(reqStat==KRequestPending);
  2666 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
  2667 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
  2667 	test(r==KErrNone);
  2668 	test_KErrNone(r);
  2668 	User::WaitForRequest(reqStat);
  2669 	User::WaitForRequest(reqStat);
  2669 	test(reqStat==KErrNone);
  2670 	test(reqStat==KErrNone);
  2670 
  2671 
  2671 //	Test that notification is made when change is made to monitored directory
  2672 //	Test that notification is made when change is made to monitored directory
  2672 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2673 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2673 	test(reqStat==KRequestPending);
  2674 	test(reqStat==KRequestPending);
  2674 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2675 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2675 	test(r==KErrNone);
  2676 	test_KErrNone(r);
  2676 	User::WaitForRequest(reqStat);
  2677 	User::WaitForRequest(reqStat);
  2677 	test(reqStat==KErrNone);
  2678 	test(reqStat==KErrNone);
  2678 
  2679 
  2679 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2680 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2680 	test(reqStat==KRequestPending);
  2681 	test(reqStat==KRequestPending);
  2681 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2682 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  2682 	test(r==KErrNone);
  2683 	test_KErrNone(r);
  2683 	User::WaitForRequest(reqStat);
  2684 	User::WaitForRequest(reqStat);
  2684 	test(reqStat==KErrNone);
  2685 	test(reqStat==KErrNone);
  2685 	fs.Close();
  2686 	fs.Close();
  2686 	}
  2687 	}
  2687 
  2688 
  2694 
  2695 
  2695 	test.Next(_L("Test reads and writes do not cause notification under ENotifyEntry"));
  2696 	test.Next(_L("Test reads and writes do not cause notification under ENotifyEntry"));
  2696 
  2697 
  2697 	RFile file;
  2698 	RFile file;
  2698 	TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
  2699 	TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
  2699 	test(r==KErrNone);
  2700 	test_KErrNone(r);
  2700 	file.Close();
  2701 	file.Close();
  2701 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
  2702 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
  2702 	test(r==KErrNone);
  2703 	test_KErrNone(r);
  2703 	file.Close();
  2704 	file.Close();
  2704 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
  2705 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
  2705 	test(r==KErrNone);
  2706 	test_KErrNone(r);
  2706 	file.Close();
  2707 	file.Close();
  2707 
  2708 
  2708 	RFs fs;
  2709 	RFs fs;
  2709 	r=fs.Connect();
  2710 	r=fs.Connect();
  2710 	test(r==KErrNone);
  2711 	test_KErrNone(r);
  2711 	r=fs.SetSessionPath(gSessionPath);
  2712 	r=fs.SetSessionPath(gSessionPath);
  2712 	test(r==KErrNone);
  2713 	test_KErrNone(r);
  2713 
  2714 
  2714 	TRequestStatus reqStat1(KRequestPending);
  2715 	TRequestStatus reqStat1(KRequestPending);
  2715 	TFileName path1=_L("\\F32-TST\\NOTIFY\\");
  2716 	TFileName path1=_L("\\F32-TST\\NOTIFY\\");
  2716 	fs.NotifyChange(ENotifyEntry,reqStat1,path1);
  2717 	fs.NotifyChange(ENotifyEntry,reqStat1,path1);
  2717 
  2718 
  2757 	TFileName path4=_L("\\F32-TST\\NOTIFY\\dingo.txt");
  2758 	TFileName path4=_L("\\F32-TST\\NOTIFY\\dingo.txt");
  2758 	fs.NotifyChange(ENotifyEntry,reqStat4,path4);
  2759 	fs.NotifyChange(ENotifyEntry,reqStat4,path4);
  2759 
  2760 
  2760 
  2761 
  2761 	r=gSleepThread.CreateLocal(0);
  2762 	r=gSleepThread.CreateLocal(0);
  2762 	test(r==KErrNone);
  2763 	test_KErrNone(r);
  2763 	RThread thread1;
  2764 	RThread thread1;
  2764 	r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  2765 	r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  2765 	test(r==KErrNone);
  2766 	test_KErrNone(r);
  2766 	thread1.Resume();
  2767 	thread1.Resume();
  2767 	gSleepThread.Wait();
  2768 	gSleepThread.Wait();
  2768 
  2769 
  2769 	test(status1==KRequestPending);
  2770 	test(status1==KRequestPending);
  2770 	test(status2==KRequestPending);
  2771 	test(status2==KRequestPending);
  2784 	test(reqStat2==KRequestPending);
  2785 	test(reqStat2==KRequestPending);
  2785 	test(reqStat3==KRequestPending);
  2786 	test(reqStat3==KRequestPending);
  2786 	test(reqStat4==KRequestPending);
  2787 	test(reqStat4==KRequestPending);
  2787 
  2788 
  2788 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  2789 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  2789 	test(r==KErrNone);
  2790 	test_KErrNone(r);
  2790 	User::WaitForRequest(reqStat1);
  2791 	User::WaitForRequest(reqStat1);
  2791 	test(reqStat1==KErrNone);
  2792 	test(reqStat1==KErrNone);
  2792 	User::WaitForRequest(status1);
  2793 	User::WaitForRequest(status1);
  2793 	test(status1==KErrNone);
  2794 	test(status1==KErrNone);
  2794 	User::WaitForRequest(status2);
  2795 	User::WaitForRequest(status2);
  2827 	gSleepThread.Close();
  2828 	gSleepThread.Close();
  2828 	thread1.Close();
  2829 	thread1.Close();
  2829 
  2830 
  2830 	test.Next(_L("Test reads and writes do cause notification under ENotifyAll"));
  2831 	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);
  2832 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
  2832 	test(r==KErrNone);
  2833 	test_KErrNone(r);
  2833 	file.Close();
  2834 	file.Close();
  2834 
  2835 
  2835 	fs.NotifyChange(ENotifyAll,reqStat1,path1);
  2836 	fs.NotifyChange(ENotifyAll,reqStat1,path1);
  2836 	fs.NotifyChange(ENotifyEntry,reqStat2,path2);
  2837 	fs.NotifyChange(ENotifyEntry,reqStat2,path2);
  2837 	fs.NotifyChange(ENotifyAll,reqStat3,path3);
  2838 	fs.NotifyChange(ENotifyAll,reqStat3,path3);
  2840 	test(reqStat2==KRequestPending);
  2841 	test(reqStat2==KRequestPending);
  2841 	test(reqStat3==KRequestPending);
  2842 	test(reqStat3==KRequestPending);
  2842 	test(reqStat4==KRequestPending);
  2843 	test(reqStat4==KRequestPending);
  2843 
  2844 
  2844 	r=gSleepThread.CreateLocal(0);
  2845 	r=gSleepThread.CreateLocal(0);
  2845 	test(r==KErrNone);
  2846 	test_KErrNone(r);
  2846 	RThread thread2;
  2847 	RThread thread2;
  2847 	r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  2848 	r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  2848 	test(r==KErrNone);
  2849 	test_KErrNone(r);
  2849 	thread2.Resume();
  2850 	thread2.Resume();
  2850 	gSleepThread.Wait();
  2851 	gSleepThread.Wait();
  2851 
  2852 
  2852 	User::WaitForRequest(reqStat1);
  2853 	User::WaitForRequest(reqStat1);
  2853 	test(reqStat1==KErrNone);
  2854 	test(reqStat1==KErrNone);
  2866 	test(reqStat2==KRequestPending);
  2867 	test(reqStat2==KRequestPending);
  2867 	test(reqStat3==KRequestPending);
  2868 	test(reqStat3==KRequestPending);
  2868 	test(reqStat4==KRequestPending);
  2869 	test(reqStat4==KRequestPending);
  2869 
  2870 
  2870 	r=gSleepThread.CreateLocal(0);
  2871 	r=gSleepThread.CreateLocal(0);
  2871 	test(r==KErrNone);
  2872 	test_KErrNone(r);
  2872 	RThread thread3;
  2873 	RThread thread3;
  2873 	r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  2874 	r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
  2874 	test(r==KErrNone);
  2875 	test_KErrNone(r);
  2875 	thread3.Resume();
  2876 	thread3.Resume();
  2876 	gSleepThread.Wait();
  2877 	gSleepThread.Wait();
  2877 
  2878 
  2878 	User::WaitForRequest(reqStat1);
  2879 	User::WaitForRequest(reqStat1);
  2879 	test(reqStat1==KErrNone);
  2880 	test(reqStat1==KErrNone);
  2882 	test(reqStat3==KErrNone);
  2883 	test(reqStat3==KErrNone);
  2883 	test(reqStat4==KRequestPending);	//	Monitoring with ENotifyEntry
  2884 	test(reqStat4==KRequestPending);	//	Monitoring with ENotifyEntry
  2884 
  2885 
  2885 	RFs fs2;
  2886 	RFs fs2;
  2886 	r=fs2.Connect();
  2887 	r=fs2.Connect();
  2887 	test(r==KErrNone);
  2888 	test_KErrNone(r);
  2888 	r=fs2.SetSessionPath(gSessionPath);
  2889 	r=fs2.SetSessionPath(gSessionPath);
  2889 	test(r==KErrNone);
  2890 	test_KErrNone(r);
  2890 
  2891 
  2891 	TRequestStatus reqStat(KRequestPending);
  2892 	TRequestStatus reqStat(KRequestPending);
  2892 	fs2.NotifyChange(ENotifyEntry,reqStat);
  2893 	fs2.NotifyChange(ENotifyEntry,reqStat);
  2893 	test(reqStat==KRequestPending);
  2894 	test(reqStat==KRequestPending);
  2894 
  2895 
  2895 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  2896 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
  2896 	test(r==KErrNone);
  2897 	test_KErrNone(r);
  2897 	User::WaitForRequest(reqStat2);
  2898 	User::WaitForRequest(reqStat2);
  2898 	test(reqStat2==KErrNone);
  2899 	test(reqStat2==KErrNone);
  2899 	test(reqStat4==KRequestPending);
  2900 	test(reqStat4==KRequestPending);
  2900 	User::WaitForRequest(reqStat);
  2901 	User::WaitForRequest(reqStat);
  2901 	test(reqStat==KErrNone);
  2902 	test(reqStat==KErrNone);
  2902 
  2903 
  2903 	fs2.NotifyChange(ENotifyAll,reqStat);
  2904 	fs2.NotifyChange(ENotifyAll,reqStat);
  2904 	test(reqStat==KRequestPending);
  2905 	test(reqStat==KRequestPending);
  2905 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
  2906 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
  2906 	test(r==KErrNone);
  2907 	test_KErrNone(r);
  2907 	User::WaitForRequest(reqStat);
  2908 	User::WaitForRequest(reqStat);
  2908 	test(reqStat==KErrNone);
  2909 	test(reqStat==KErrNone);
  2909 	test(reqStat4==KRequestPending);
  2910 	test(reqStat4==KRequestPending);
  2910 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
  2911 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
  2911 	test(r==KErrNone);
  2912 	test_KErrNone(r);
  2912 	User::WaitForRequest(reqStat4);
  2913 	User::WaitForRequest(reqStat4);
  2913 	test(reqStat4==KErrNone);
  2914 	test(reqStat4==KErrNone);
  2914 
  2915 
  2915 	gSleepThread.Close();
  2916 	gSleepThread.Close();
  2916 	thread3.Close();
  2917 	thread3.Close();
  2926 //	enum TNotifyType {ENotifyEntry=0x00,ENotifyAll=0x01,ENotifyFile=0x04,ENotifyDir=0x08,
  2927 //	enum TNotifyType {ENotifyEntry=0x00,ENotifyAll=0x01,ENotifyFile=0x04,ENotifyDir=0x08,
  2927 //				ENotifyAttributes=0x10,ENotifyWrite=0x20,ENotifyDisk=0x40};
  2928 //				ENotifyAttributes=0x10,ENotifyWrite=0x20,ENotifyDisk=0x40};
  2928 //
  2929 //
  2929 	RFs fs;
  2930 	RFs fs;
  2930 	TInt r=fs.Connect();	//	Session to be notified of any changes
  2931 	TInt r=fs.Connect();	//	Session to be notified of any changes
  2931 	test(r==KErrNone);
  2932 	test_KErrNone(r);
  2932 	r=fs.SetSessionPath(gSessionPath);
  2933 	r=fs.SetSessionPath(gSessionPath);
  2933 	test(r==KErrNone);
  2934 	test_KErrNone(r);
  2934 
  2935 
  2935 //	RFile::Write() to a file within the monitored directory
  2936 //	RFile::Write() to a file within the monitored directory
  2936 	test.Next(_L("RFile::Write()"));
  2937 	test.Next(_L("RFile::Write()"));
  2937 	TFileName path=_L("\\F32-TST\\NOTIFY\\NewFile.txt");
  2938 	TFileName path=_L("\\F32-TST\\NOTIFY\\NewFile.txt");
  2938 	TRequestStatus reqStat(KRequestPending);
  2939 	TRequestStatus reqStat(KRequestPending);
  2944 	TRequestStatus reqStat7(KRequestPending);
  2945 	TRequestStatus reqStat7(KRequestPending);
  2945 
  2946 
  2946 
  2947 
  2947 	RFile file;
  2948 	RFile file;
  2948 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  2949 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  2949 	test(r==KErrNone);
  2950 	test_KErrNone(r);
  2950 
  2951 
  2951 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2952 	fs.NotifyChange(ENotifyAll,reqStat,path);
  2952 	fs.NotifyChange(ENotifyFile,reqStat2,path);
  2953 	fs.NotifyChange(ENotifyFile,reqStat2,path);
  2953 	fs.NotifyChange(ENotifyWrite,reqStat3,path);
  2954 	fs.NotifyChange(ENotifyWrite,reqStat3,path);
  2954 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  2955 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  2991 	test(reqStat6==KErrCancel);
  2992 	test(reqStat6==KErrCancel);
  2992 	User::WaitForRequest(reqStat7);
  2993 	User::WaitForRequest(reqStat7);
  2993 	test(reqStat7==KErrCancel);
  2994 	test(reqStat7==KErrCancel);
  2994 
  2995 
  2995 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  2996 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  2996 	test(r==KErrNone);
  2997 	test_KErrNone(r);
  2997 
  2998 
  2998 //	RFile::SetAtt() of a file within the monitored directory
  2999 //	RFile::SetAtt() of a file within the monitored directory
  2999 	fs.NotifyChange(ENotifyAll,reqStat,path);
  3000 	fs.NotifyChange(ENotifyAll,reqStat,path);
  3000 	fs.NotifyChange(ENotifyFile,reqStat2,path);
  3001 	fs.NotifyChange(ENotifyFile,reqStat2,path);
  3001 	fs.NotifyChange(ENotifyEntry,reqStat3,path);
  3002 	fs.NotifyChange(ENotifyEntry,reqStat3,path);
  3013 	test(reqStat6==KRequestPending);
  3014 	test(reqStat6==KRequestPending);
  3014 	test(reqStat7==KRequestPending);
  3015 	test(reqStat7==KRequestPending);
  3015 
  3016 
  3016 	test.Next(_L("RFile::SetAtt()"));
  3017 	test.Next(_L("RFile::SetAtt()"));
  3017 	r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
  3018 	r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
  3018 	test(r==KErrNone);
  3019 	test_KErrNone(r);
  3019 	User::WaitForRequest(reqStat);
  3020 	User::WaitForRequest(reqStat);
  3020 	User::WaitForRequest(reqStat4);
  3021 	User::WaitForRequest(reqStat4);
  3021 	test(reqStat==KErrNone);
  3022 	test(reqStat==KErrNone);
  3022 	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
  3023 	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
  3023 	test(reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
  3024 	test(reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
  3029 	test(reqStat==KRequestPending);
  3030 	test(reqStat==KRequestPending);
  3030 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  3031 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  3031 	User::WaitForRequest(reqStat4);
  3032 	User::WaitForRequest(reqStat4);
  3032 	test(reqStat4==KErrArgument);
  3033 	test(reqStat4==KErrArgument);
  3033 	r=file.SetAtt(KEntryAttNormal,KEntryAttSystem);
  3034 	r=file.SetAtt(KEntryAttNormal,KEntryAttSystem);
  3034 	test(r==KErrNone);
  3035 	test_KErrNone(r);
  3035 	test(reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
  3036 	test(reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
  3036 	fs.NotifyChangeCancel();	//	Cancel outstanding notification request
  3037 	fs.NotifyChangeCancel();	//	Cancel outstanding notification request
  3037 
  3038 
  3038 	User::WaitForRequest(reqStat);
  3039 	User::WaitForRequest(reqStat);
  3039 	test(reqStat==KErrCancel);
  3040 	test(reqStat==KErrCancel);
  3057 	test(reqStat4==KRequestPending);
  3058 	test(reqStat4==KRequestPending);
  3058 
  3059 
  3059 //	RFile::SetSize() of a file within the monitored directory
  3060 //	RFile::SetSize() of a file within the monitored directory
  3060 	test.Next(_L("RFile::SetSize()"));
  3061 	test.Next(_L("RFile::SetSize()"));
  3061 	r=file.SetSize(256);
  3062 	r=file.SetSize(256);
  3062 	test(r==KErrNone);
  3063 	test_KErrNone(r);
  3063 	User::WaitForRequest(reqStat);
  3064 	User::WaitForRequest(reqStat);
  3064 	User::WaitForRequest(reqStat4);
  3065 	User::WaitForRequest(reqStat4);
  3065 	test(reqStat==KErrNone);
  3066 	test(reqStat==KErrNone);
  3066 	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
  3067 	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
  3067 	test(reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
  3068 	test(reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
  3071 	test(reqStat==KRequestPending);
  3072 	test(reqStat==KRequestPending);
  3072 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  3073 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  3073 	User::WaitForRequest(reqStat4);
  3074 	User::WaitForRequest(reqStat4);
  3074 	test(reqStat4==KErrArgument);
  3075 	test(reqStat4==KErrArgument);
  3075 	r=file.SetSize(200);
  3076 	r=file.SetSize(200);
  3076 	test(r==KErrNone);
  3077 	test_KErrNone(r);
  3077 	User::After(1000000);
  3078 	User::After(1000000);
  3078 	test(reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
  3079 	test(reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
  3079 
  3080 
  3080 	file.Close();
  3081 	file.Close();
  3081 	fs.NotifyChangeCancel();			//	Cancels all outstanding notification requests
  3082 	fs.NotifyChangeCancel();			//	Cancels all outstanding notification requests
  3101 	test(reqStat3==KRequestPending);
  3102 	test(reqStat3==KRequestPending);
  3102 	test(reqStat4==KRequestPending);
  3103 	test(reqStat4==KRequestPending);
  3103 
  3104 
  3104 	TFileName fileName;
  3105 	TFileName fileName;
  3105 	r=file.Temp(TheFs,path,fileName,EFileWrite);
  3106 	r=file.Temp(TheFs,path,fileName,EFileWrite);
  3106 	test(r==KErrNone);
  3107 	test_KErrNone(r);
  3107 	User::WaitForRequest(reqStat);
  3108 	User::WaitForRequest(reqStat);
  3108 	test(reqStat==KErrNone);
  3109 	test(reqStat==KErrNone);
  3109 	test(reqStat2==KRequestPending);
  3110 	test(reqStat2==KRequestPending);
  3110 	test(reqStat3==KRequestPending);	//	Monitoring ENotifyEntry
  3111 	test(reqStat3==KRequestPending);	//	Monitoring ENotifyEntry
  3111 	test(reqStat4==KRequestPending);	//	Monitoring ENotifyAttributes
  3112 	test(reqStat4==KRequestPending);	//	Monitoring ENotifyAttributes
  3121 
  3122 
  3122 	fs.NotifyChange(ENotifyFile,reqStat,path);
  3123 	fs.NotifyChange(ENotifyFile,reqStat,path);
  3123 	fs.NotifyChange(ENotifyDisk,reqStat2,path);
  3124 	fs.NotifyChange(ENotifyDisk,reqStat2,path);
  3124 	fs.NotifyChange(ENotifyWrite,reqStat3,path);
  3125 	fs.NotifyChange(ENotifyWrite,reqStat3,path);
  3125 	r=file.Temp(TheFs,path,fileName,EFileWrite);
  3126 	r=file.Temp(TheFs,path,fileName,EFileWrite);
  3126 	test(r==KErrNone);
  3127 	test_KErrNone(r);
  3127 	test(reqStat==KRequestPending);		//	Monitoring ENotifyFile
  3128 	test(reqStat==KRequestPending);		//	Monitoring ENotifyFile
  3128 	test(reqStat2==KRequestPending);	//	Monitoring ENotifyDisk
  3129 	test(reqStat2==KRequestPending);	//	Monitoring ENotifyDisk
  3129 	test(reqStat3==KRequestPending);	//	Monitoring ENotifyWrite
  3130 	test(reqStat3==KRequestPending);	//	Monitoring ENotifyWrite
  3130 	file.Close();
  3131 	file.Close();
  3131 
  3132 
  3152 	test(reqStat4==KRequestPending);
  3153 	test(reqStat4==KRequestPending);
  3153 
  3154 
  3154 	TTime now;
  3155 	TTime now;
  3155 	now.HomeTime();
  3156 	now.HomeTime();
  3156 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  3157 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  3157 	test(r==KErrNone);
  3158 	test_KErrNone(r);
  3158 	test(reqStat==KRequestPending);
  3159 	test(reqStat==KRequestPending);
  3159 	file.SetModified(now);
  3160 	file.SetModified(now);
  3160 	file.Close();
  3161 	file.Close();
  3161 	User::WaitForRequest(reqStat);
  3162 	User::WaitForRequest(reqStat);
  3162 	test(reqStat==KErrNone);
  3163 	test(reqStat==KErrNone);
  3186 
  3187 
  3187 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),entry);
  3188 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),entry);
  3188 	test(reqStat==KRequestPending);
  3189 	test(reqStat==KRequestPending);
  3189 	now.HomeTime();
  3190 	now.HomeTime();
  3190 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),now,KEntryAttHidden,KEntryAttNormal);
  3191 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),now,KEntryAttHidden,KEntryAttNormal);
  3191 	test(r==KErrNone);
  3192 	test_KErrNone(r);
  3192 	User::WaitForRequest(reqStat);
  3193 	User::WaitForRequest(reqStat);
  3193 	User::WaitForRequest(reqStat3);
  3194 	User::WaitForRequest(reqStat3);
  3194 	test(reqStat==KErrNone);
  3195 	test(reqStat==KErrNone);
  3195 	test(reqStat2==KRequestPending);
  3196 	test(reqStat2==KRequestPending);
  3196 	test(reqStat3==KErrNone);
  3197 	test(reqStat3==KErrNone);
  3213 	test(reqStat2==KRequestPending);
  3214 	test(reqStat2==KRequestPending);
  3214 	test(reqStat3==KRequestPending);
  3215 	test(reqStat3==KRequestPending);
  3215 	test(reqStat4==KRequestPending);
  3216 	test(reqStat4==KRequestPending);
  3216 
  3217 
  3217 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  3218 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
  3218 	test(r==KErrNone);
  3219 	test_KErrNone(r);
  3219 	test(reqStat==KRequestPending);
  3220 	test(reqStat==KRequestPending);
  3220 	now.HomeTime();
  3221 	now.HomeTime();
  3221 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  3222 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
  3222 	file.Close();
  3223 	file.Close();
  3223 	User::WaitForRequest(reqStat);
  3224 	User::WaitForRequest(reqStat);
  3246 	test(reqStat3==KRequestPending);
  3247 	test(reqStat3==KRequestPending);
  3247 	test(reqStat4==KRequestPending);
  3248 	test(reqStat4==KRequestPending);
  3248 	User::After(KNotifyChangeAfter);
  3249 	User::After(KNotifyChangeAfter);
  3249 
  3250 
  3250 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  3251 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
  3251 	test(r==KErrNone);
  3252 	test_KErrNone(r);
  3252 	User::WaitForRequest(reqStat);
  3253 	User::WaitForRequest(reqStat);
  3253 	test(reqStat==KErrNone);
  3254 	test(reqStat==KErrNone);
  3254 	test(reqStat2==KRequestPending);
  3255 	test(reqStat2==KRequestPending);
  3255 	test(reqStat3==KRequestPending);
  3256 	test(reqStat3==KRequestPending);
  3256 	test(reqStat4==KRequestPending);
  3257 	test(reqStat4==KRequestPending);
  3276 	test(reqStat2==KRequestPending);
  3277 	test(reqStat2==KRequestPending);
  3277 	test(reqStat3==KRequestPending);
  3278 	test(reqStat3==KRequestPending);
  3278 	test(reqStat4==KRequestPending);
  3279 	test(reqStat4==KRequestPending);
  3279 
  3280 
  3280 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  3281 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  3281 	test(r==KErrNone);
  3282 	test_KErrNone(r);
  3282 	User::WaitForRequest(reqStat);
  3283 	User::WaitForRequest(reqStat);
  3283 	User::WaitForRequest(reqStat2);
  3284 	User::WaitForRequest(reqStat2);
  3284 	User::WaitForRequest(reqStat3);
  3285 	User::WaitForRequest(reqStat3);
  3285 	test(reqStat==KErrNone);
  3286 	test(reqStat==KErrNone);
  3286 	test(reqStat2==KErrNone);
  3287 	test(reqStat2==KErrNone);
  3296 	test(reqStat==KRequestPending);
  3297 	test(reqStat==KRequestPending);
  3297 	test(reqStat2==KRequestPending);
  3298 	test(reqStat2==KRequestPending);
  3298 	test(reqStat3==KRequestPending);
  3299 	test(reqStat3==KRequestPending);
  3299 
  3300 
  3300 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  3301 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
  3301 	test(r==KErrNone);
  3302 	test_KErrNone(r);
  3302 	User::WaitForRequest(reqStat);
  3303 	User::WaitForRequest(reqStat);
  3303 	User::WaitForRequest(reqStat2);
  3304 	User::WaitForRequest(reqStat2);
  3304 	test(reqStat==KErrNone);
  3305 	test(reqStat==KErrNone);
  3305 	test(reqStat2==KErrNone);
  3306 	test(reqStat2==KErrNone);
  3306 	test(reqStat3==KRequestPending);
  3307 	test(reqStat3==KRequestPending);
  3323 	test(reqStat2==KRequestPending);
  3324 	test(reqStat2==KRequestPending);
  3324 	test(reqStat3==KRequestPending);
  3325 	test(reqStat3==KRequestPending);
  3325 	test(reqStat4==KRequestPending);
  3326 	test(reqStat4==KRequestPending);
  3326 
  3327 
  3327 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
  3328 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
  3328 	test(r==KErrNone);
  3329 	test_KErrNone(r);
  3329 	User::WaitForRequest(reqStat);
  3330 	User::WaitForRequest(reqStat);
  3330 	User::WaitForRequest(reqStat2);
  3331 	User::WaitForRequest(reqStat2);
  3331 	User::WaitForRequest(reqStat4);
  3332 	User::WaitForRequest(reqStat4);
  3332 	test(reqStat==KErrNone);
  3333 	test(reqStat==KErrNone);
  3333 	test(reqStat2==KErrNone);
  3334 	test(reqStat2==KErrNone);
  3346 	test(reqStat2==KRequestPending);
  3347 	test(reqStat2==KRequestPending);
  3347 	test(reqStat3==KRequestPending);
  3348 	test(reqStat3==KRequestPending);
  3348 	test(reqStat4==KRequestPending);
  3349 	test(reqStat4==KRequestPending);
  3349 
  3350 
  3350 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"),EFileRead|EFileWrite);
  3351 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"),EFileRead|EFileWrite);
  3351 	test(r==KErrNone);
  3352 	test_KErrNone(r);
  3352 	User::WaitForRequest(reqStat);
  3353 	User::WaitForRequest(reqStat);
  3353 	User::WaitForRequest(reqStat2);
  3354 	User::WaitForRequest(reqStat2);
  3354 	test(reqStat==KErrNone);
  3355 	test(reqStat==KErrNone);
  3355 	test(reqStat2==KErrNone);
  3356 	test(reqStat2==KErrNone);
  3356 	test(reqStat3==KRequestPending);
  3357 	test(reqStat3==KRequestPending);
  3374 	test(reqStat2==KRequestPending);
  3375 	test(reqStat2==KRequestPending);
  3375 	test(reqStat3==KRequestPending);
  3376 	test(reqStat3==KRequestPending);
  3376 	test(reqStat4==KRequestPending);
  3377 	test(reqStat4==KRequestPending);
  3377 
  3378 
  3378 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
  3379 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
  3379 	test(r==KErrNone);
  3380 	test_KErrNone(r);
  3380 	User::WaitForRequest(reqStat);
  3381 	User::WaitForRequest(reqStat);
  3381 	User::WaitForRequest(reqStat2);
  3382 	User::WaitForRequest(reqStat2);
  3382 	User::WaitForRequest(reqStat4);
  3383 	User::WaitForRequest(reqStat4);
  3383 	test(reqStat==KErrNone);
  3384 	test(reqStat==KErrNone);
  3384 	test(reqStat2==KErrNone);
  3385 	test(reqStat2==KErrNone);
  3397 	test(reqStat2==KRequestPending);
  3398 	test(reqStat2==KRequestPending);
  3398 	test(reqStat3==KRequestPending);
  3399 	test(reqStat3==KRequestPending);
  3399 	test(reqStat4==KRequestPending);
  3400 	test(reqStat4==KRequestPending);
  3400 
  3401 
  3401 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"));
  3402 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"));
  3402 	test(r==KErrNone);
  3403 	test_KErrNone(r);
  3403 	User::WaitForRequest(reqStat);
  3404 	User::WaitForRequest(reqStat);
  3404 	User::WaitForRequest(reqStat2);
  3405 	User::WaitForRequest(reqStat2);
  3405 	User::WaitForRequest(reqStat4);
  3406 	User::WaitForRequest(reqStat4);
  3406 	test(reqStat==KErrNone);
  3407 	test(reqStat==KErrNone);
  3407 	test(reqStat2==KErrNone);
  3408 	test(reqStat2==KErrNone);
  3422 	test(reqStat2==KRequestPending);
  3423 	test(reqStat2==KRequestPending);
  3423 	test(reqStat3==KRequestPending);
  3424 	test(reqStat3==KRequestPending);
  3424 	test(reqStat4==KRequestPending);
  3425 	test(reqStat4==KRequestPending);
  3425 
  3426 
  3426 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
  3427 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
  3427 	test(r==KErrNone);
  3428 	test_KErrNone(r);
  3428 	User::WaitForRequest(reqStat);
  3429 	User::WaitForRequest(reqStat);
  3429 	User::WaitForRequest(reqStat2);
  3430 	User::WaitForRequest(reqStat2);
  3430 	User::WaitForRequest(reqStat3);
  3431 	User::WaitForRequest(reqStat3);
  3431 	test(reqStat==KErrNone);
  3432 	test(reqStat==KErrNone);
  3432 	test(reqStat2==KErrNone);
  3433 	test(reqStat2==KErrNone);
  3454 	test(reqStat3==KRequestPending);
  3455 	test(reqStat3==KRequestPending);
  3455 	User::WaitForRequest(reqStat4);
  3456 	User::WaitForRequest(reqStat4);
  3456 	test(reqStat4==KErrArgument);
  3457 	test(reqStat4==KErrArgument);
  3457 
  3458 
  3458 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
  3459 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
  3459 	test(r==KErrNone);
  3460 	test_KErrNone(r);
  3460 	User::WaitForRequest(reqStat);
  3461 	User::WaitForRequest(reqStat);
  3461 	User::WaitForRequest(reqStat2);
  3462 	User::WaitForRequest(reqStat2);
  3462 	User::WaitForRequest(reqStat3);
  3463 	User::WaitForRequest(reqStat3);
  3463 	test(reqStat==KErrNone);
  3464 	test(reqStat==KErrNone);
  3464 	test(reqStat2==KErrNone);
  3465 	test(reqStat2==KErrNone);
  3486 
  3487 
  3487 	TInt driveNum=CurrentDrive();
  3488 	TInt driveNum=CurrentDrive();
  3488 	TVolumeInfo volInfo;
  3489 	TVolumeInfo volInfo;
  3489 	TFileName currentVolName;
  3490 	TFileName currentVolName;
  3490 	r=TheFs.Volume(volInfo,driveNum);
  3491 	r=TheFs.Volume(volInfo,driveNum);
  3491 	test(r==KErrNone);
  3492 	test_KErrNone(r);
  3492 	test(reqStat==KRequestPending);
  3493 	test(reqStat==KRequestPending);
  3493 	currentVolName=volInfo.iName;
  3494 	currentVolName=volInfo.iName;
  3494 
  3495 
  3495 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  3496 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
  3496 	if (r==KErrNone)
  3497 	if (r==KErrNone)
  3514 		test(reqStat==KRequestPending);
  3515 		test(reqStat==KRequestPending);
  3515 		test(reqStat2==KRequestPending);
  3516 		test(reqStat2==KRequestPending);
  3516 		test(reqStat7==KRequestPending);
  3517 		test(reqStat7==KRequestPending);
  3517 
  3518 
  3518 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  3519 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
  3519 		test(r==KErrNone);
  3520 		test_KErrNone(r);
  3520 
  3521 
  3521 		User::WaitForRequest(reqStat);
  3522 		User::WaitForRequest(reqStat);
  3522 		User::WaitForRequest(reqStat2);
  3523 		User::WaitForRequest(reqStat2);
  3523 		User::WaitForRequest(reqStat7);
  3524 		User::WaitForRequest(reqStat7);
  3524 
  3525 
  3529 		test(reqStat5==KRequestPending);
  3530 		test(reqStat5==KRequestPending);
  3530 		test(reqStat6==KRequestPending);
  3531 		test(reqStat6==KRequestPending);
  3531 		test(reqStat7==KErrNone);
  3532 		test(reqStat7==KErrNone);
  3532 
  3533 
  3533 		r=TheFs.Volume(volInfo,driveNum);
  3534 		r=TheFs.Volume(volInfo,driveNum);
  3534 		test(r==KErrNone);
  3535 		test_KErrNone(r);
  3535 		test(volInfo.iName==currentVolName);
  3536 		test(volInfo.iName==currentVolName);
  3536 
  3537 
  3537 		fs.NotifyChangeCancel();
  3538 		fs.NotifyChangeCancel();
  3538 
  3539 
  3539 		User::WaitForRequest(reqStat3);
  3540 		User::WaitForRequest(reqStat3);
  3574 	test(reqStat2==KRequestPending);
  3575 	test(reqStat2==KRequestPending);
  3575 	test(reqStat3==KRequestPending);
  3576 	test(reqStat3==KRequestPending);
  3576 	test(reqStat4==KRequestPending);
  3577 	test(reqStat4==KRequestPending);
  3577 
  3578 
  3578 	r=file.Rename(_L("\\F32-TST\\NOTIFY\\OldFile.abc"));
  3579 	r=file.Rename(_L("\\F32-TST\\NOTIFY\\OldFile.abc"));
  3579 	test(r==KErrNone||r==KErrAlreadyExists);
  3580 	test_Value(r, r == KErrNone||r==KErrAlreadyExists);
  3580 	User::WaitForRequest(reqStat);
  3581 	User::WaitForRequest(reqStat);
  3581 	User::WaitForRequest(reqStat2);
  3582 	User::WaitForRequest(reqStat2);
  3582 	User::WaitForRequest(reqStat3);
  3583 	User::WaitForRequest(reqStat3);
  3583 	test(reqStat==KErrNone);
  3584 	test(reqStat==KErrNone);
  3584 	test(reqStat2==KErrNone);
  3585 	test(reqStat2==KErrNone);
  3590 	test(reqStat4==KErrCancel);
  3591 	test(reqStat4==KErrCancel);
  3591 
  3592 
  3592 	path=_L("\\F32-TST\\NOTIFY\\OldFile.abc");
  3593 	path=_L("\\F32-TST\\NOTIFY\\OldFile.abc");
  3593 
  3594 
  3594 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\OldFile.abc"),EFileShareExclusive|EFileWrite);
  3595 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\OldFile.abc"),EFileShareExclusive|EFileWrite);
  3595 	test(r==KErrNone);
  3596 	test_KErrNone(r);
  3596 	fs.NotifyChange(ENotifyAll,reqStat,path);
  3597 	fs.NotifyChange(ENotifyAll,reqStat,path);
  3597 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
  3598 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
  3598 	fs.NotifyChange(ENotifyFile,reqStat3,path);
  3599 	fs.NotifyChange(ENotifyFile,reqStat3,path);
  3599 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  3600 	fs.NotifyChange(ENotifyDir,reqStat4,path);
  3600 
  3601 
  3603 	test(reqStat3==KRequestPending);
  3604 	test(reqStat3==KRequestPending);
  3604 	User::WaitForRequest(reqStat4);
  3605 	User::WaitForRequest(reqStat4);
  3605 	test(reqStat4==KErrArgument);
  3606 	test(reqStat4==KErrArgument);
  3606 
  3607 
  3607 	r=file.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"));
  3608 	r=file.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"));
  3608 	test(r==KErrNone);
  3609 	test_KErrNone(r);
  3609 	User::WaitForRequest(reqStat);
  3610 	User::WaitForRequest(reqStat);
  3610 	User::WaitForRequest(reqStat2);
  3611 	User::WaitForRequest(reqStat2);
  3611 	User::WaitForRequest(reqStat3);
  3612 	User::WaitForRequest(reqStat3);
  3612 	test(reqStat==KErrNone);
  3613 	test(reqStat==KErrNone);
  3613 	test(reqStat2==KErrNone);
  3614 	test(reqStat2==KErrNone);
  3627 	test(reqStat2==KRequestPending);
  3628 	test(reqStat2==KRequestPending);
  3628 	test(reqStat3==KRequestPending);
  3629 	test(reqStat3==KRequestPending);
  3629 	test(reqStat4==KRequestPending);
  3630 	test(reqStat4==KRequestPending);
  3630 
  3631 
  3631 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"),_L("\\F32-TST\\NOTIFY\\NewerFile.cat"));
  3632 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"),_L("\\F32-TST\\NOTIFY\\NewerFile.cat"));
  3632 	test(r==KErrNone);
  3633 	test_KErrNone(r);
  3633 	User::WaitForRequest(reqStat);
  3634 	User::WaitForRequest(reqStat);
  3634 	User::WaitForRequest(reqStat2);
  3635 	User::WaitForRequest(reqStat2);
  3635 	User::WaitForRequest(reqStat3);
  3636 	User::WaitForRequest(reqStat3);
  3636 	test(reqStat==KErrNone);
  3637 	test(reqStat==KErrNone);
  3637 	test(reqStat2==KErrNone);
  3638 	test(reqStat2==KErrNone);
  3656 	test(reqStat3==KRequestPending);
  3657 	test(reqStat3==KRequestPending);
  3657 	User::WaitForRequest(reqStat4);
  3658 	User::WaitForRequest(reqStat4);
  3658 	test(reqStat4==KErrArgument);
  3659 	test(reqStat4==KErrArgument);
  3659 
  3660 
  3660 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewerFile.cat"),_L("\\F32-TST\\NOTIFY\\Original.dog"));
  3661 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewerFile.cat"),_L("\\F32-TST\\NOTIFY\\Original.dog"));
  3661 	test(r==KErrNone);
  3662 	test_KErrNone(r);
  3662 	User::WaitForRequest(reqStat);
  3663 	User::WaitForRequest(reqStat);
  3663 	User::WaitForRequest(reqStat2);
  3664 	User::WaitForRequest(reqStat2);
  3664 	User::WaitForRequest(reqStat3);
  3665 	User::WaitForRequest(reqStat3);
  3665 	test(reqStat==KErrNone);
  3666 	test(reqStat==KErrNone);
  3666 	test(reqStat2==KErrNone);
  3667 	test(reqStat2==KErrNone);
  3676 	test(reqStat2==KRequestPending);
  3677 	test(reqStat2==KRequestPending);
  3677 	test(reqStat3==KRequestPending);
  3678 	test(reqStat3==KRequestPending);
  3678 	test(reqStat4==KRequestPending);
  3679 	test(reqStat4==KRequestPending);
  3679 
  3680 
  3680 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\"),_L("\\F32-TST\\NOTIFY_TEMP\\"));
  3681 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\"),_L("\\F32-TST\\NOTIFY_TEMP\\"));
  3681 	test(r==KErrNone);
  3682 	test_KErrNone(r);
  3682 	User::WaitForRequest(reqStat);
  3683 	User::WaitForRequest(reqStat);
  3683 	User::WaitForRequest(reqStat2);
  3684 	User::WaitForRequest(reqStat2);
  3684 	User::WaitForRequest(reqStat3);
  3685 	User::WaitForRequest(reqStat3);
  3685 	User::WaitForRequest(reqStat4);
  3686 	User::WaitForRequest(reqStat4);
  3686 	test(reqStat==KErrNone);
  3687 	test(reqStat==KErrNone);
  3700 	test(reqStat3==KRequestPending);
  3701 	test(reqStat3==KRequestPending);
  3701 	User::WaitForRequest(reqStat4);
  3702 	User::WaitForRequest(reqStat4);
  3702 	test(reqStat4==KErrArgument);
  3703 	test(reqStat4==KErrArgument);
  3703 
  3704 
  3704 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_TEMP\\"),_L("\\F32-TST\\NOTIFY\\"));
  3705 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_TEMP\\"),_L("\\F32-TST\\NOTIFY\\"));
  3705 	test(r==KErrNone);
  3706 	test_KErrNone(r);
  3706 	User::WaitForRequest(reqStat);
  3707 	User::WaitForRequest(reqStat);
  3707 	User::WaitForRequest(reqStat2);
  3708 	User::WaitForRequest(reqStat2);
  3708 	User::WaitForRequest(reqStat3);
  3709 	User::WaitForRequest(reqStat3);
  3709 	test(reqStat==KErrNone);			//	Modified a directory above the level at which we
  3710 	test(reqStat==KErrNone);			//	Modified a directory above the level at which we
  3710 	test(reqStat2==KErrNone);			//	are monitoring for changes - we must be notified
  3711 	test(reqStat2==KErrNone);			//	are monitoring for changes - we must be notified
  3735 	test(reqStat==KRequestPending);
  3736 	test(reqStat==KRequestPending);
  3736 	test(reqStat2==KRequestPending);
  3737 	test(reqStat2==KRequestPending);
  3737 	test(reqStat3==KRequestPending);
  3738 	test(reqStat3==KRequestPending);
  3738 
  3739 
  3739 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Original.dog"));
  3740 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Original.dog"));
  3740 	test(r==KErrNone);
  3741 	test_KErrNone(r);
  3741 	User::WaitForRequest(reqStat);
  3742 	User::WaitForRequest(reqStat);
  3742 	User::WaitForRequest(reqStat2);
  3743 	User::WaitForRequest(reqStat2);
  3743 	User::WaitForRequest(reqStat3);
  3744 	User::WaitForRequest(reqStat3);
  3744 	test(reqStat==KErrNone);
  3745 	test(reqStat==KErrNone);
  3745 	test(reqStat2==KErrNone);
  3746 	test(reqStat2==KErrNone);
  3753 	test(reqStat==KRequestPending);
  3754 	test(reqStat==KRequestPending);
  3754 	test(reqStat2==KRequestPending);
  3755 	test(reqStat2==KRequestPending);
  3755 	test(reqStat3==KRequestPending);
  3756 	test(reqStat3==KRequestPending);
  3756 
  3757 
  3757 	r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TEST\\"));
  3758 	r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TEST\\"));
  3758 	test(r==KErrNone);
  3759 	test_KErrNone(r);
  3759 	User::WaitForRequest(reqStat);
  3760 	User::WaitForRequest(reqStat);
  3760 	User::WaitForRequest(reqStat2);
  3761 	User::WaitForRequest(reqStat2);
  3761 	User::WaitForRequest(reqStat3);
  3762 	User::WaitForRequest(reqStat3);
  3762 	test(reqStat==KErrNone);			//	Modified a directory above the level at which we
  3763 	test(reqStat==KErrNone);			//	Modified a directory above the level at which we
  3763 	test(reqStat2==KErrNone);			//	are monitoring for changes but we receive notification
  3764 	test(reqStat2==KErrNone);			//	are monitoring for changes but we receive notification
  3791 	test(reqStat==KRequestPending);
  3792 	test(reqStat==KRequestPending);
  3792 	test(reqStat2==KRequestPending);
  3793 	test(reqStat2==KRequestPending);
  3793 	test(reqStat3==KRequestPending);
  3794 	test(reqStat3==KRequestPending);
  3794 
  3795 
  3795 	r=TheFs.Rename(_L("\\F32-TEST\\NOTIFY\\"),_L("\\F32-TEST\\NOTIFY_CHANGED\\"));
  3796 	r=TheFs.Rename(_L("\\F32-TEST\\NOTIFY\\"),_L("\\F32-TEST\\NOTIFY_CHANGED\\"));
  3796 	test(r==KErrNone);
  3797 	test_KErrNone(r);
  3797 
  3798 
  3798 	User::WaitForRequest(reqStat);
  3799 	User::WaitForRequest(reqStat);
  3799 	User::WaitForRequest(reqStat2);
  3800 	User::WaitForRequest(reqStat2);
  3800 	User::WaitForRequest(reqStat3);
  3801 	User::WaitForRequest(reqStat3);
  3801 
  3802 
  3815 	test(reqStat2==KRequestPending);
  3816 	test(reqStat2==KRequestPending);
  3816 	test(reqStat3==KRequestPending);
  3817 	test(reqStat3==KRequestPending);
  3817 	test(reqStat4==KRequestPending);
  3818 	test(reqStat4==KRequestPending);
  3818 
  3819 
  3819 	r=TheFs.Rename(_L("\\F32-TEST\\"),_L("\\F32-TST\\"));
  3820 	r=TheFs.Rename(_L("\\F32-TEST\\"),_L("\\F32-TST\\"));
  3820 	test(r==KErrNone);
  3821 	test_KErrNone(r);
  3821 
  3822 
  3822 	User::WaitForRequest(reqStat);
  3823 	User::WaitForRequest(reqStat);
  3823 	User::WaitForRequest(reqStat2);
  3824 	User::WaitForRequest(reqStat2);
  3824 	User::WaitForRequest(reqStat3);
  3825 	User::WaitForRequest(reqStat3);
  3825 
  3826 
  3842 	test(reqStat2==KRequestPending);
  3843 	test(reqStat2==KRequestPending);
  3843 	test(reqStat3==KRequestPending);
  3844 	test(reqStat3==KRequestPending);
  3844 	test(reqStat4==KRequestPending);
  3845 	test(reqStat4==KRequestPending);
  3845 
  3846 
  3846 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_CHANGED\\"),_L("\\F32-TST\\NOTIFY\\"));
  3847 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_CHANGED\\"),_L("\\F32-TST\\NOTIFY\\"));
  3847 	test(r==KErrNone);
  3848 	test_KErrNone(r);
  3848 
  3849 
  3849 	User::WaitForRequest(reqStat);
  3850 	User::WaitForRequest(reqStat);
  3850 	User::WaitForRequest(reqStat2);
  3851 	User::WaitForRequest(reqStat2);
  3851 	User::WaitForRequest(reqStat3);
  3852 	User::WaitForRequest(reqStat3);
  3852 
  3853 
  3872 	test(reqStat2==KRequestPending);
  3873 	test(reqStat2==KRequestPending);
  3873 	test(reqStat3==KRequestPending);
  3874 	test(reqStat3==KRequestPending);
  3874 	test(reqStat4==KRequestPending);
  3875 	test(reqStat4==KRequestPending);
  3875 
  3876 
  3876 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
  3877 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
  3877 	test(r==KErrNone);
  3878 	test_KErrNone(r);
  3878 	User::WaitForRequest(reqStat);
  3879 	User::WaitForRequest(reqStat);
  3879 	User::WaitForRequest(reqStat2);
  3880 	User::WaitForRequest(reqStat2);
  3880 	User::WaitForRequest(reqStat3);
  3881 	User::WaitForRequest(reqStat3);
  3881 	test(reqStat==KErrNone);
  3882 	test(reqStat==KErrNone);
  3882 	test(reqStat2==KErrNone);
  3883 	test(reqStat2==KErrNone);
  3899 	test(reqStat4==KRequestPending);
  3900 	test(reqStat4==KRequestPending);
  3900 
  3901 
  3901 	TTime nowTime;
  3902 	TTime nowTime;
  3902 	nowTime.HomeTime();
  3903 	nowTime.HomeTime();
  3903 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
  3904 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
  3904 	test(r==KErrNone);
  3905 	test_KErrNone(r);
  3905 	test(reqStat==KRequestPending);
  3906 	test(reqStat==KRequestPending);
  3906 	file.SetModified(now);
  3907 	file.SetModified(now);
  3907 	file.Close();
  3908 	file.Close();
  3908 	User::WaitForRequest(reqStat);
  3909 	User::WaitForRequest(reqStat);
  3909 	User::WaitForRequest(reqStat2);
  3910 	User::WaitForRequest(reqStat2);
  3926 	test(reqStat2==KRequestPending);
  3927 	test(reqStat2==KRequestPending);
  3927 	test(reqStat3==KRequestPending);
  3928 	test(reqStat3==KRequestPending);
  3928 	test(reqStat4==KRequestPending);
  3929 	test(reqStat4==KRequestPending);
  3929 
  3930 
  3930 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
  3931 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
  3931 	test(r==KErrNone);
  3932 	test_KErrNone(r);
  3932 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  3933 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
  3933 	file.Close();
  3934 	file.Close();
  3934 	User::WaitForRequest(reqStat);
  3935 	User::WaitForRequest(reqStat);
  3935 	User::WaitForRequest(reqStat3);
  3936 	User::WaitForRequest(reqStat3);
  3936 	User::WaitForRequest(reqStat4);
  3937 	User::WaitForRequest(reqStat4);
  3953 	test(reqStat2==KRequestPending);
  3954 	test(reqStat2==KRequestPending);
  3954 	test(reqStat3==KRequestPending);
  3955 	test(reqStat3==KRequestPending);
  3955 	test(reqStat4==KRequestPending);
  3956 	test(reqStat4==KRequestPending);
  3956 
  3957 
  3957 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Munchkin.msg"));
  3958 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Munchkin.msg"));
  3958 	test(r==KErrNone);
  3959 	test_KErrNone(r);
  3959 	User::WaitForRequest(reqStat);
  3960 	User::WaitForRequest(reqStat);
  3960 	User::WaitForRequest(reqStat2);
  3961 	User::WaitForRequest(reqStat2);
  3961 	User::WaitForRequest(reqStat3);
  3962 	User::WaitForRequest(reqStat3);
  3962 	test(reqStat==KErrNone);
  3963 	test(reqStat==KErrNone);
  3963 	test(reqStat2==KErrNone);
  3964 	test(reqStat2==KErrNone);
  3981 	test.Next(b);
  3982 	test.Next(b);
  3982 	TRequestStatus reqStat=0;
  3983 	TRequestStatus reqStat=0;
  3983 
  3984 
  3984 	RFs fs;
  3985 	RFs fs;
  3985 	TInt r=fs.Connect();
  3986 	TInt r=fs.Connect();
  3986 	test(r==KErrNone);
  3987 	test_KErrNone(r);
  3987 
  3988 
  3988 	TDriveInfo driveInfo;
  3989 	TDriveInfo driveInfo;
  3989 	TInt driveNum = EDriveC + SocketToDrive[gSocketNumber];
  3990 	TInt driveNum = EDriveC + SocketToDrive[gSocketNumber];
  3990 
  3991 
  3991 	// verify TDriveInfo.iType == EMediaHardDisk
  3992 	// verify TDriveInfo.iType == EMediaHardDisk
  3992 	r = fs.Drive(driveInfo, driveNum);
  3993 	r = fs.Drive(driveInfo, driveNum);
  3993 	test (r == KErrNone);
  3994 	test_KErrNone(r);
  3994 	test.Printf(_L("iType = %d\n"), driveInfo.iType);
  3995 	test.Printf(_L("iType = %d\n"), driveInfo.iType);
  3995 	test(driveInfo.iType == EMediaHardDisk);
  3996 	test(driveInfo.iType == EMediaHardDisk);
  3996 
  3997 
  3997 
  3998 
  3998 	// ask the user to eject the media
  3999 	// ask the user to eject the media
  4005 	test(reqInt==KErrNone);
  4006 	test(reqInt==KErrNone);
  4006 	User::WaitForRequest(reqStat);
  4007 	User::WaitForRequest(reqStat);
  4007 
  4008 
  4008 	// verify TDriveInfo.iType == EMediaNotPresent
  4009 	// verify TDriveInfo.iType == EMediaNotPresent
  4009 	r = fs.Drive(driveInfo, driveNum);
  4010 	r = fs.Drive(driveInfo, driveNum);
  4010 	test (r == KErrNone);
  4011 	test_KErrNone(r);
  4011 	test.Printf(_L("iType = %d\n"), driveInfo.iType);
  4012 	test.Printf(_L("iType = %d\n"), driveInfo.iType);
  4012 	test(driveInfo.iType == EMediaNotPresent);
  4013 	test(driveInfo.iType == EMediaNotPresent);
  4013 
  4014 
  4014 
  4015 
  4015 	// ask the user to re-insert the media
  4016 	// ask the user to re-insert the media
  4022 	test(reqInt==KErrNone);
  4023 	test(reqInt==KErrNone);
  4023 	User::WaitForRequest(reqStat);
  4024 	User::WaitForRequest(reqStat);
  4024 
  4025 
  4025 	// verify TDriveInfo.iType == EMediaHardDisk
  4026 	// verify TDriveInfo.iType == EMediaHardDisk
  4026 	r = fs.Drive(driveInfo, driveNum);
  4027 	r = fs.Drive(driveInfo, driveNum);
  4027 	test (r == KErrNone);
  4028 	test_KErrNone(r);
  4028 	test.Printf(_L("iType = %d\n"), driveInfo.iType);
  4029 	test.Printf(_L("iType = %d\n"), driveInfo.iType);
  4029 	test(driveInfo.iType == EMediaHardDisk);
  4030 	test(driveInfo.iType == EMediaHardDisk);
  4030 
  4031 
  4031 	fs.Close();
  4032 	fs.Close();
  4032 	}
  4033 	}
  4056 	MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
  4057 	MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
  4057 
  4058 
  4058 	test.Next(_L("Test original behaviour of asynchronous read API"));
  4059 	test.Next(_L("Test original behaviour of asynchronous read API"));
  4059 	RFile reader;
  4060 	RFile reader;
  4060 	TInt r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileShareAny);
  4061 	TInt r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileShareAny);
  4061 	test(r==KErrNone);
  4062 	test_KErrNone(r);
  4062 	TBuf8<596> readBuf;
  4063 	TBuf8<596> readBuf;
  4063 	reader.Read(0, readBuf, 100, readStat1);
  4064 	reader.Read(0, readBuf, 100, readStat1);
  4064 	User::WaitForRequest(readStat1);
  4065 	User::WaitForRequest(readStat1);
  4065 	test(readStat1==KErrNone);
  4066 	test(readStat1==KErrNone);
  4066 	test(readBuf.Length()==0);
  4067 	test(readBuf.Length()==0);
  4067 	reader.Close();
  4068 	reader.Close();
  4068 
  4069 
  4069 	test.Next(_L("Test asynchronous read fails in EFileShareExclusive mode"));
  4070 	test.Next(_L("Test asynchronous read fails in EFileShareExclusive mode"));
  4070 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive);
  4071 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive);
  4071 	test(r==KErrArgument);
  4072 	test_Value(r, r == KErrArgument);
  4072 
  4073 
  4073 	test.Next(_L("Test asynchronous read fails in EFileShareReadersOnly mode"));
  4074 	test.Next(_L("Test asynchronous read fails in EFileShareReadersOnly mode"));
  4074 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly);
  4075 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly);
  4075 	test(r==KErrArgument);
  4076 	test_Value(r, r == KErrArgument);
  4076 
  4077 
  4077 	test.Next(_L("Test asynchronous read is cancelled when file is closed"));
  4078 	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);
  4079 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
  4079 	test(r==KErrNone);
  4080 	test_KErrNone(r);
  4080 	reader.Read(0, readBuf, 100, readStat1);
  4081 	reader.Read(0, readBuf, 100, readStat1);
  4081 	test(readStat1==KRequestPending);
  4082 	test(readStat1==KRequestPending);
  4082 	reader.Close();
  4083 	reader.Close();
  4083 	User::WaitForRequest(readStat1);
  4084 	User::WaitForRequest(readStat1);
  4084 	test(readStat1==KErrCancel);
  4085 	test(readStat1==KErrCancel);
  4085 
  4086 
  4086 	test.Next(_L("Test asynchronous read can be cancelled"));
  4087 	test.Next(_L("Test asynchronous read can be cancelled"));
  4087 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
  4088 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
  4088 	test(r==KErrNone);
  4089 	test_KErrNone(r);
  4089 	reader.Read(0, readBuf, 100, readStat1);
  4090 	reader.Read(0, readBuf, 100, readStat1);
  4090 	test(readStat1==KRequestPending);
  4091 	test(readStat1==KRequestPending);
  4091 	reader.ReadCancel(readStat1);
  4092 	reader.ReadCancel(readStat1);
  4092 	User::WaitForRequest(readStat1);
  4093 	User::WaitForRequest(readStat1);
  4093 	test(readStat1==KErrCancel);
  4094 	test(readStat1==KErrCancel);
  4096 	// DEF105438: File server thread safety issues
  4097 	// DEF105438: File server thread safety issues
  4097 	// Up the priority of this thread so that we can cancel the request before the drive thread
  4098 	// 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...)
  4099 	// runs (to test whether cancelling still works...)
  4099 	test.Next(_L("Test asynchronous read is cancelled when running at high priority"));
  4100 	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);
  4101 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
  4101 	test(r==KErrNone);
  4102 	test_KErrNone(r);
  4102 	RThread	thisThread;
  4103 	RThread	thisThread;
  4103 	thisThread.SetPriority(EPriorityRealTime);
  4104 	thisThread.SetPriority(EPriorityRealTime);
  4104 	reader.Read(0, readBuf, 100, readStat1);
  4105 	reader.Read(0, readBuf, 100, readStat1);
  4105 	test(readStat1==KRequestPending);
  4106 	test(readStat1==KRequestPending);
  4106 	reader.ReadCancel(readStat1);
  4107 	reader.ReadCancel(readStat1);
  4110 	reader.Close();
  4111 	reader.Close();
  4111 	thisThread.SetPriority(EPriorityNormal);
  4112 	thisThread.SetPriority(EPriorityNormal);
  4112 
  4113 
  4113 	test.Next(_L("Test asynchronous read is notified due to RFile::SetSize()"));
  4114 	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);
  4115 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
  4115 	test(r==KErrNone);
  4116 	test_KErrNone(r);
  4116 	reader.Read(0, readBuf, 100, readStat1);
  4117 	reader.Read(0, readBuf, 100, readStat1);
  4117 	test(readStat1==KRequestPending);
  4118 	test(readStat1==KRequestPending);
  4118 	r = reader.SetSize(100);
  4119 	r = reader.SetSize(100);
  4119 	test(r==KErrNone);
  4120 	test_KErrNone(r);
  4120 	User::WaitForRequest(readStat1);
  4121 	User::WaitForRequest(readStat1);
  4121 	test(readStat1==KErrNone);
  4122 	test(readStat1==KErrNone);
  4122 	test(readBuf.Length() == 100);
  4123 	test(readBuf.Length() == 100);
  4123 	r=reader.SetSize(0);
  4124 	r=reader.SetSize(0);
  4124 	test(r==KErrNone);
  4125 	test_KErrNone(r);
  4125 	reader.Close();
  4126 	reader.Close();
  4126 
  4127 
  4127 	test.Next(_L("Test asynchronous read is notified due to RFile::Write()"));
  4128 	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);
  4129 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
  4129 	test(r==KErrNone);
  4130 	test_KErrNone(r);
  4130 	reader.Read(0, readBuf, 26, readStat1);
  4131 	reader.Read(0, readBuf, 26, readStat1);
  4131 	test(readStat1==KRequestPending);
  4132 	test(readStat1==KRequestPending);
  4132 	RFile writer;
  4133 	RFile writer;
  4133 	r=writer.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny);
  4134 	r=writer.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny);
  4134 	writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
  4135 	writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
  4138 	reader.Close();
  4139 	reader.Close();
  4139 	writer.Close();
  4140 	writer.Close();
  4140 
  4141 
  4141 	test.Next(_L("Test multiple asynchronous readers notified from separate thread"));
  4142 	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);
  4143 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
  4143 	test(r==KErrNone);
  4144 	test_KErrNone(r);
  4144 	r=reader.SetSize(0);
  4145 	r=reader.SetSize(0);
  4145 	test(r==KErrNone);
  4146 	test_KErrNone(r);
  4146 	const TInt KReadLen = 26;
  4147 	const TInt KReadLen = 26;
  4147 	test.Printf(_L(">Read%d[%d]\n"), 0, KReadLen);
  4148 	test.Printf(_L(">Read%d[%d]\n"), 0, KReadLen);
  4148 	reader.Read(0, readBuf, KReadLen, readStat1);
  4149 	reader.Read(0, readBuf, KReadLen, readStat1);
  4149 	TBuf8<596> readBuf2;
  4150 	TBuf8<596> readBuf2;
  4150 	test.Printf(_L(">Read%d[%d]\n"), 1, KReadLen);
  4151 	test.Printf(_L(">Read%d[%d]\n"), 1, KReadLen);
  4152 	test(readStat1==KRequestPending);
  4153 	test(readStat1==KRequestPending);
  4153 	test(readStat2==KRequestPending);
  4154 	test(readStat2==KRequestPending);
  4154 
  4155 
  4155 	RThread thread;
  4156 	RThread thread;
  4156 	r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest12);
  4157 	r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest12);
  4157 	test(r==KErrNone);
  4158 	test_KErrNone(r);
  4158 	thread.Logon(thrdStat);
  4159 	thread.Logon(thrdStat);
  4159 	thread.Resume();
  4160 	thread.Resume();
  4160 	thread.Close();
  4161 	thread.Close();
  4161 
  4162 
  4162 	RTimer timer;
  4163 	RTimer timer;
  4225     TFileName   fileName(KTestPath);
  4226     TFileName   fileName(KTestPath);
  4226 
  4227 
  4227     fileName.Append(_L("TestFile.tst"));
  4228     fileName.Append(_L("TestFile.tst"));
  4228 
  4229 
  4229     nRes=file.Replace(TheFs, fileName, EFileWrite|EFileRead);
  4230     nRes=file.Replace(TheFs, fileName, EFileWrite|EFileRead);
  4230     test(nRes == KErrNone || nRes ==KErrAlreadyExists);
  4231     test_Value(nRes, nRes == KErrNone || nRes ==KErrAlreadyExists);
  4231     file.Close();
  4232     file.Close();
  4232 
  4233 
  4233     //-- check that the notifier worked
  4234     //-- check that the notifier worked
  4234     User::WaitForRequest(reqStatNotify1);
  4235     User::WaitForRequest(reqStatNotify1);
  4235     test(reqStatNotify1.Int() == KErrNone);
  4236     test(reqStatNotify1.Int() == KErrNone);
  4285 
  4286 
  4286 		//Not all the drives are used at present
  4287 		//Not all the drives are used at present
  4287 		if (r == KErrNotSupported)
  4288 		if (r == KErrNotSupported)
  4288 			continue;
  4289 			continue;
  4289 
  4290 
  4290 		test(r==KErrNone);
  4291 		test_KErrNone(r);
  4291 		TInt sockNum = 0;
  4292 		TInt sockNum = 0;
  4292 		if (d.IsRemovable(sockNum)>0)
  4293 		if (d.IsRemovable(sockNum)>0)
  4293 			{
  4294 			{
  4294 			if (mask & (1<<sockNum))
  4295 			if (mask & (1<<sockNum))
  4295 				{
  4296 				{