kerneltest/f32test/server/t_notifier.cpp
changeset 109 b3a1d9898418
parent 31 56f325a607ea
child 257 3e88ff8f41d5
child 299 b5a01337d018
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
    13 // Description:
    13 // Description:
    14 // f32test\server\t_notifier.cpp
    14 // f32test\server\t_notifier.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"
   162 // We should receive an EMediaChange notification even though we did not register for it 
   163 // We should receive an EMediaChange notification even though we did not register for it 
   163 void TestMediaCardNotificationWhenNotRegisteredForIt()
   164 void TestMediaCardNotificationWhenNotRegisteredForIt()
   164 	{
   165 	{
   165 	RFs fs;
   166 	RFs fs;
   166 	TInt r = fs.Connect();
   167 	TInt r = fs.Connect();
   167 	test(r==KErrNone);
   168 	test_KErrNone(r);
   168 	
   169 	
   169 	CFsNotify* notify = NULL;
   170 	CFsNotify* notify = NULL;
   170 	TRAP(r,notify= CFsNotify::NewL(fs,KMinNotificationBufferSize));
   171 	TRAP(r,notify= CFsNotify::NewL(fs,KMinNotificationBufferSize));
   171 	
   172 	
   172 	TBuf<40> path;
   173 	TBuf<40> path;
   175 	
   176 	
   176 	TBuf<20> filename;
   177 	TBuf<20> filename;
   177 	filename.Append(_L("media.change1"));
   178 	filename.Append(_L("media.change1"));
   178 	
   179 	
   179 	r = notify->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   180 	r = notify->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   180 	test(r==KErrNone);
   181 	test_KErrNone(r);
   181 	
   182 	
   182 	TRequestStatus status;
   183 	TRequestStatus status;
   183 	r = notify->RequestNotifications(status);
   184 	r = notify->RequestNotifications(status);
   184 	test(r==KErrNone);
   185 	test_KErrNone(r);
   185 	
   186 	
   186 	test.Printf(_L("*****************************************************************\n"));
   187 	test.Printf(_L("*****************************************************************\n"));
   187 	test.Printf(_L("Waiting 10 seconds.\n"));
   188 	test.Printf(_L("Waiting 10 seconds.\n"));
   188 	test.Printf(_L("This is a MANUAL test, it requires the removal of the media card.\n"));
   189 	test.Printf(_L("This is a MANUAL test, it requires the removal of the media card.\n"));
   189 	test.Printf(_L("PLEASE REMOVE THE MEDIA CARD. (DriveNumber %d)\n"),globalDriveNum);
   190 	test.Printf(_L("PLEASE REMOVE THE MEDIA CARD. (DriveNumber %d)\n"),globalDriveNum);
   190 	test.Printf(_L("Or press Ctrl + F5 on the emulator.\n"));
   191 	test.Printf(_L("Or press Ctrl + F5 on the emulator.\n"));
   191 	test.Printf(_L("*****************************************************************\n"));
   192 	test.Printf(_L("*****************************************************************\n"));
   192 	RTimer timer1;
   193 	RTimer timer1;
   193 	r = timer1.CreateLocal();
   194 	r = timer1.CreateLocal();
   194 	test(r == KErrNone);
   195 	test_KErrNone(r);
   195 	TRequestStatus timeout;
   196 	TRequestStatus timeout;
   196 	TTimeIntervalMicroSeconds32 time = 10000000;
   197 	TTimeIntervalMicroSeconds32 time = 10000000;
   197 	timer1.After(timeout,time);
   198 	timer1.After(timeout,time);
   198 	User::WaitForRequest(timeout,status);
   199 	User::WaitForRequest(timeout,status);
   199 	test(status.Int() != KRequestPending);
   200 	test(status.Int() != KRequestPending);
   207 	TBuf<2> drive;
   208 	TBuf<2> drive;
   208 	drive.Append((TChar)gDriveToTest);
   209 	drive.Append((TChar)gDriveToTest);
   209 	drive.Append(_L(":"));
   210 	drive.Append(_L(":"));
   210 	TPtrC drivePtr;
   211 	TPtrC drivePtr;
   211 	r = notification->Path(drivePtr);
   212 	r = notification->Path(drivePtr);
   212 	test(r==KErrNone);
   213 	test_KErrNone(r);
   213 	r = drivePtr.Compare(drive);
   214 	r = drivePtr.Compare(drive);
   214 	test(r==0);
   215 	test_Value(r, r == 0);
   215 	
   216 	
   216 	test.Printf(_L("*****************************************************************\n"));
   217 	test.Printf(_L("*****************************************************************\n"));
   217 	test.Printf(_L("Waiting 10 seconds.\n"));
   218 	test.Printf(_L("Waiting 10 seconds.\n"));
   218 	test.Printf(_L("This is a MANUAL test, it requires the insertion of the media card.\n"));
   219 	test.Printf(_L("This is a MANUAL test, it requires the insertion of the media card.\n"));
   219 	test.Printf(_L("PLEASE INSERT THE MEDIA CARD. (DriveNumber %d)\n"),globalDriveNum);
   220 	test.Printf(_L("PLEASE INSERT THE MEDIA CARD. (DriveNumber %d)\n"),globalDriveNum);
   224 	if(notification == NULL)
   225 	if(notification == NULL)
   225 		{
   226 		{
   226 		notify->RequestNotifications(status);
   227 		notify->RequestNotifications(status);
   227 		RTimer timer2;
   228 		RTimer timer2;
   228 		r = timer2.CreateLocal();
   229 		r = timer2.CreateLocal();
   229 		test(r == KErrNone);
   230 		test_KErrNone(r);
   230 		TRequestStatus timeout2;
   231 		TRequestStatus timeout2;
   231 		timer2.After(timeout2,time);
   232 		timer2.After(timeout2,time);
   232 		User::WaitForRequest(timeout2,status);
   233 		User::WaitForRequest(timeout2,status);
   233 		test(status.Int() != KRequestPending);
   234 		test(status.Int() != KRequestPending);
   234 		notification = notify->NextNotification();
   235 		notification = notify->NextNotification();
   247 // and then checks if the second one still works
   248 // and then checks if the second one still works
   248 TInt TestClientRemovalL()
   249 TInt TestClientRemovalL()
   249 	{
   250 	{
   250 	RFs fs;
   251 	RFs fs;
   251 	TInt r = fs.Connect();
   252 	TInt r = fs.Connect();
   252 	test(r==KErrNone);
   253 	test_KErrNone(r);
   253 	
   254 	
   254 	CFsNotify* notify1 = NULL;
   255 	CFsNotify* notify1 = NULL;
   255 	CFsNotify* notify2 = NULL;
   256 	CFsNotify* notify2 = NULL;
   256 	TRAP(r,notify1= CFsNotify::NewL(fs,KMinNotificationBufferSize);
   257 	TRAP(r,notify1= CFsNotify::NewL(fs,KMinNotificationBufferSize);
   257 		   notify2= CFsNotify::NewL(fs,KMinNotificationBufferSize);
   258 		   notify2= CFsNotify::NewL(fs,KMinNotificationBufferSize);
   258 		);
   259 		);
   259 	if(r!=KErrNone)
   260 	if(r!=KErrNone)
   260 		{
   261 		{
   261 		delete notify1;
   262 		delete notify1;
   262 		delete notify2;
   263 		delete notify2;
   263 		test(r==KErrNone);
   264 		test_KErrNone(r);
   264 		}
   265 		}
   265 	
   266 	
   266 	TBuf<40> path;
   267 	TBuf<40> path;
   267 	path.Append((TChar)gDriveToTest);
   268 	path.Append((TChar)gDriveToTest);
   268 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
   269 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
   273 	TBuf<40> fullname;
   274 	TBuf<40> fullname;
   274 	fullname.Append(path);
   275 	fullname.Append(path);
   275 	fullname.Append(filename);
   276 	fullname.Append(filename);
   276 	
   277 	
   277 	r = notify1->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   278 	r = notify1->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   278 	test(r==KErrNone);
   279 	test_KErrNone(r);
   279 	r = notify2->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   280 	r = notify2->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   280 	test(r==KErrNone);
   281 	test_KErrNone(r);
   281 	
   282 	
   282 	delete notify1; //Delete notify1 and ensure we still get notification on notify2
   283 	delete notify1; //Delete notify1 and ensure we still get notification on notify2
   283 	
   284 	
   284 	TRequestStatus status;
   285 	TRequestStatus status;
   285 	r = notify2->RequestNotifications(status);
   286 	r = notify2->RequestNotifications(status);
   286 	test(r==KErrNone);
   287 	test_KErrNone(r);
   287 	
   288 	
   288 	RFile file;
   289 	RFile file;
   289 	file.Replace(fs,fullname,EFileWrite); //Replace produces Create notification
   290 	file.Replace(fs,fullname,EFileWrite); //Replace produces Create notification
   290 	file.Close();
   291 	file.Close();
   291 	
   292 	
   292 	RTimer tim;
   293 	RTimer tim;
   293 	r = tim.CreateLocal();
   294 	r = tim.CreateLocal();
   294 	test(r==KErrNone);
   295 	test_KErrNone(r);
   295 	
   296 	
   296 	TRequestStatus timStatus;
   297 	TRequestStatus timStatus;
   297 	TTimeIntervalMicroSeconds32 time = 10000000; //10 seconds
   298 	TTimeIntervalMicroSeconds32 time = 10000000; //10 seconds
   298 	tim.After(timStatus,time);
   299 	tim.After(timStatus,time);
   299 	
   300 	
   300 	User::WaitForRequest(status,timStatus);
   301 	User::WaitForRequest(status,timStatus);
   301 	test(status!=KRequestPending);
   302 	test(status!=KRequestPending);
   302 	
   303 	
   303 	r = fs.Delete(fullname);
   304 	r = fs.Delete(fullname);
   304 	test(r==KErrNone);
   305 	test_KErrNone(r);
   305 	
   306 	
   306 	delete notify2;
   307 	delete notify2;
   307 	tim.Close();
   308 	tim.Close();
   308 	fs.Close();
   309 	fs.Close();
   309 	return KErrNone;
   310 	return KErrNone;
   322 	fs.Connect();
   323 	fs.Connect();
   323 	
   324 	
   324 	CFsNotify* notify = NULL;
   325 	CFsNotify* notify = NULL;
   325 	
   326 	
   326 	TRAPD(r,notify = CFsNotify::NewL(fs,KMinNotificationBufferSize););
   327 	TRAPD(r,notify = CFsNotify::NewL(fs,KMinNotificationBufferSize););
   327 	test(r==KErrNone);
   328 	test_KErrNone(r);
   328 	test(notify!=NULL);
   329 	test(notify!=NULL);
   329 	
   330 	
   330 	TBuf<40> path;
   331 	TBuf<40> path;
   331 	path.Append((TChar)gDriveToTest);
   332 	path.Append((TChar)gDriveToTest);
   332 	path.Append(_L(":\\"));
   333 	path.Append(_L(":\\"));
   333 	
   334 	
   334 	TBuf<15> filename;
   335 	TBuf<15> filename;
   335 	filename.Append(_L("*"));
   336 	filename.Append(_L("*"));
   336 	
   337 	
   337 	r = notify->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   338 	r = notify->AddNotification((TUint)TFsNotification::ECreate,path,filename);
   338 	test(r==KErrNone);
   339 	test_KErrNone(r);
   339 	
   340 	
   340 	TRequestStatus status;
   341 	TRequestStatus status;
   341 	r = notify->RequestNotifications(status);
   342 	r = notify->RequestNotifications(status);
   342 	test(r==KErrNone);
   343 	test_KErrNone(r);
   343 	
   344 	
   344 	RFile file;
   345 	RFile file;
   345 	TBuf<40> filePath;
   346 	TBuf<40> filePath;
   346 	filePath.Append((TChar)gDriveToTest);
   347 	filePath.Append((TChar)gDriveToTest);
   347 	filePath.Append(_L(":\\file.root"));
   348 	filePath.Append(_L(":\\file.root"));
   348 	r = file.Replace(fs,filePath,EFileRead);
   349 	r = file.Replace(fs,filePath,EFileRead);
   349 	test(r==KErrNone);
   350 	test_KErrNone(r);
   350 	file.Close();
   351 	file.Close();
   351 	
   352 	
   352 	TRequestStatus s2;
   353 	TRequestStatus s2;
   353 	RTimer tim;
   354 	RTimer tim;
   354 	test(tim.CreateLocal()==KErrNone);
   355 	test(tim.CreateLocal()==KErrNone);
  1324 		    safe_test(multipleTestDoer,r,__LINE__,pkgDoer.iLineCall);
  1325 		    safe_test(multipleTestDoer,r,__LINE__,pkgDoer.iLineCall);
  1325 		    file.Close();
  1326 		    file.Close();
  1326 		    
  1327 		    
  1327 		    CFileMan* cfman = NULL;
  1328 		    CFileMan* cfman = NULL;
  1328 		    TRAP(r, cfman = CFileMan::NewL(fs);)
  1329 		    TRAP(r, cfman = CFileMan::NewL(fs);)
  1329 		    test(r == KErrNone);
  1330 		    test_KErrNone(r);
  1330             test(cfman != NULL);
  1331             test(cfman != NULL);
  1331             TBuf<40> unmonitored_path;
  1332             TBuf<40> unmonitored_path;
  1332             unmonitored_path.Append(gDriveToTest);
  1333             unmonitored_path.Append(gDriveToTest);
  1333             unmonitored_path.Append(_L(":\\F32-TST\\"));
  1334             unmonitored_path.Append(_L(":\\F32-TST\\"));
  1334             unmonitored_path.Append(pkgDoer.iString);
  1335             unmonitored_path.Append(pkgDoer.iString);
  1394 	{
  1395 	{
  1395 	RProcess process;
  1396 	RProcess process;
  1396 	TUidType uid;
  1397 	TUidType uid;
  1397 	TPtrC command((TText*)&gDriveToTest,1);
  1398 	TPtrC command((TText*)&gDriveToTest,1);
  1398 	TInt r = process.Create(aProcessName,command,uid);
  1399 	TInt r = process.Create(aProcessName,command,uid);
  1399 	test(r==KErrNone);
  1400 	test_KErrNone(r);
  1400 	process.Resume();
  1401 	process.Resume();
  1401 	TRequestStatus s1;
  1402 	TRequestStatus s1;
  1402 	TRequestStatus s2;
  1403 	TRequestStatus s2;
  1403 	RTimer tim;
  1404 	RTimer tim;
  1404 	r = tim.CreateLocal();
  1405 	r = tim.CreateLocal();
  1405 	test(r==KErrNone);
  1406 	test_KErrNone(r);
  1406 	TTimeIntervalMicroSeconds32 delay = 5000000; //5 seconds
  1407 	TTimeIntervalMicroSeconds32 delay = 5000000; //5 seconds
  1407 	tim.After(s1,delay);
  1408 	tim.After(s1,delay);
  1408 	process.Logon(s2);
  1409 	process.Logon(s2);
  1409 	User::WaitForRequest(s1,s2);
  1410 	User::WaitForRequest(s1,s2);
  1410 	test(s2.Int()!=KRequestPending);
  1411 	test(s2.Int()!=KRequestPending);
  1956 	User::LeaveIfError(package.iBarrier.CreateLocal(0));
  1957 	User::LeaveIfError(package.iBarrier.CreateLocal(0));
  1957 	RThread watcher;
  1958 	RThread watcher;
  1958 	RThread doer;
  1959 	RThread doer;
  1959 	
  1960 	
  1960 	TInt r = watcher.Create(_L("TestTwoNotificationsWatcherThread"),MultipleNotificationsTFWatcher,KDefaultStackSize,KMinHeapSize,KMaxHeapSize,&package);
  1961 	TInt r = watcher.Create(_L("TestTwoNotificationsWatcherThread"),MultipleNotificationsTFWatcher,KDefaultStackSize,KMinHeapSize,KMaxHeapSize,&package);
  1961 	test(r==KErrNone);
  1962 	test_KErrNone(r);
  1962 	r = doer.Create(_L("TestTwoNotificationsDoerThread"),TwoNotificationsTFDoer,KDefaultStackSize,KMinHeapSize,KMaxHeapSize,&package);
  1963 	r = doer.Create(_L("TestTwoNotificationsDoerThread"),TwoNotificationsTFDoer,KDefaultStackSize,KMinHeapSize,KMaxHeapSize,&package);
  1963 	test(r==KErrNone);
  1964 	test_KErrNone(r);
  1964 	test.Next(_L("TestTwoNotifications - Resume Watcher"));
  1965 	test.Next(_L("TestTwoNotifications - Resume Watcher"));
  1965 	watcher.Resume();
  1966 	watcher.Resume();
  1966 	test.Next(_L("TestTwoNotifications - Wait for Watcher to be ready"));
  1967 	test.Next(_L("TestTwoNotifications - Wait for Watcher to be ready"));
  1967 	package.iBarrier.Wait(); //Wait till Watcher has requested notification
  1968 	package.iBarrier.Wait(); //Wait till Watcher has requested notification
  1968 	test.Next(_L("TestTwoNotifications - Resume Doer"));
  1969 	test.Next(_L("TestTwoNotifications - Resume Doer"));
  2620 	User::LeaveIfError(package.iBarrier2.CreateLocal(0));
  2621 	User::LeaveIfError(package.iBarrier2.CreateLocal(0));
  2621 	RThread watcher;
  2622 	RThread watcher;
  2622 	RThread doer;
  2623 	RThread doer;
  2623 
  2624 
  2624 	TInt r = watcher.Create(_L("TestCancelNotification-WatcherThread"),TestCancelNotificationWatcher,KDefaultStackSize*2,KMinHeapSize,KMaxHeapSize,&package);
  2625 	TInt r = watcher.Create(_L("TestCancelNotification-WatcherThread"),TestCancelNotificationWatcher,KDefaultStackSize*2,KMinHeapSize,KMaxHeapSize,&package);
  2625 	test(r == KErrNone);
  2626 	test_KErrNone(r);
  2626 	r = doer.Create(_L("TestCancelNotification-DoerThread"),SimpleSingleNotificationTFDoer,KDefaultStackSize*2,KMinHeapSize,KMaxHeapSize,&package);
  2627 	r = doer.Create(_L("TestCancelNotification-DoerThread"),SimpleSingleNotificationTFDoer,KDefaultStackSize*2,KMinHeapSize,KMaxHeapSize,&package);
  2627 	test(r == KErrNone);
  2628 	test_KErrNone(r);
  2628 	test.Printf(_L("TestCancelNotificationL - Watcher.Resume()"));
  2629 	test.Printf(_L("TestCancelNotificationL - Watcher.Resume()"));
  2629 	watcher.Resume();
  2630 	watcher.Resume();
  2630 	test.Printf(_L("TestCancelNotificationL - Waiting on package.iBarrier.Wait()"));
  2631 	test.Printf(_L("TestCancelNotificationL - Waiting on package.iBarrier.Wait()"));
  2631 	package.iBarrier.Wait();	//W1 - Wait until Watcher has created CFsNotify
  2632 	package.iBarrier.Wait();	//W1 - Wait until Watcher has created CFsNotify
  2632 	test.Printf(_L("TestCancelNotificationL -Doer Resume"));
  2633 	test.Printf(_L("TestCancelNotificationL -Doer Resume"));
  2643 	test.Next(_L("TestCancelNotification - Wait for watcher thread death"));
  2644 	test.Next(_L("TestCancelNotification - Wait for watcher thread death"));
  2644 	watcher.Logon(status);
  2645 	watcher.Logon(status);
  2645 	
  2646 	
  2646 	RTimer tim;
  2647 	RTimer tim;
  2647 	r = tim.CreateLocal();
  2648 	r = tim.CreateLocal();
  2648 	test(r==KErrNone);
  2649 	test_KErrNone(r);
  2649 	
  2650 	
  2650 	TRequestStatus timStatus;
  2651 	TRequestStatus timStatus;
  2651 	TTimeIntervalMicroSeconds32 time = 10000000; //10 seconds
  2652 	TTimeIntervalMicroSeconds32 time = 10000000; //10 seconds
  2652 	tim.After(timStatus,time);
  2653 	tim.After(timStatus,time);
  2653 	
  2654 	
  2727 			TBuf<20> filename;
  2728 			TBuf<20> filename;
  2728 			filename.Append(_L("session.close"));
  2729 			filename.Append(_L("session.close"));
  2729 			
  2730 			
  2730 			RDebug::Printf("TestSessionCloseTF - Case 2 - Add Notification\n");
  2731 			RDebug::Printf("TestSessionCloseTF - Case 2 - Add Notification\n");
  2731 			r = notify->AddNotification((TUint)TFsNotification::ECreate,path,filename);
  2732 			r = notify->AddNotification((TUint)TFsNotification::ECreate,path,filename);
  2732 			test(r==KErrNone);
  2733 			test_KErrNone(r);
  2733 			
  2734 			
  2734 			RDebug::Printf("TestSessionCloseTF - Case 2 - Fs.Close\n");
  2735 			RDebug::Printf("TestSessionCloseTF - Case 2 - Fs.Close\n");
  2735 			fs.Close();
  2736 			fs.Close();
  2736 
  2737 
  2737 			CleanupStack::PushL(notify);
  2738 			CleanupStack::PushL(notify);
  2777 	TRequestStatus status;
  2778 	TRequestStatus status;
  2778 	thread.Logon(status);
  2779 	thread.Logon(status);
  2779 	User::WaitForRequest(status);
  2780 	User::WaitForRequest(status);
  2780 	test.Printf(_L("Kern-Exec 0 is EXPECTED\n"));
  2781 	test.Printf(_L("Kern-Exec 0 is EXPECTED\n"));
  2781 	TInt err = thread.ExitReason();
  2782 	TInt err = thread.ExitReason();
  2782 	test(err == KErrNone);
  2783 	test_KErrNone(err);
  2783 	TExitType et = thread.ExitType();
  2784 	TExitType et = thread.ExitType();
  2784 	test(et == EExitPanic);
  2785 	test(et == EExitPanic);
  2785 	CLOSE_AND_WAIT(thread);
  2786 	CLOSE_AND_WAIT(thread);
  2786 	sem.Close();
  2787 	sem.Close();
  2787 	}
  2788 	}
  2857 	//80*7 = 560.
  2858 	//80*7 = 560.
  2858 	// -4 means we should get 6 notifications
  2859 	// -4 means we should get 6 notifications
  2859 	//Except the first one will still be in the buffer
  2860 	//Except the first one will still be in the buffer
  2860 	// (as we've not called RequestNotification yet) so we'll only actually get 5.
  2861 	// (as we've not called RequestNotification yet) so we'll only actually get 5.
  2861 	TRAPD(r, notify = CFsNotify::NewL(fs,(80*7)-4));
  2862 	TRAPD(r, notify = CFsNotify::NewL(fs,(80*7)-4));
  2862 	test(r == KErrNone);
  2863 	test_KErrNone(r);
  2863 	User::LeaveIfNull(notify);
  2864 	User::LeaveIfNull(notify);
  2864 	notify->AddNotification(TFsNotification::EFileChange,path,filename);
  2865 	notify->AddNotification(TFsNotification::EFileChange,path,filename);
  2865 	notify->RequestNotifications(status);
  2866 	notify->RequestNotifications(status);
  2866 	
  2867 	
  2867 	//Signal that we are ready for doer to start (W1)
  2868 	//Signal that we are ready for doer to start (W1)
  2939 	 * The watcher's last notification should be an overflow
  2940 	 * The watcher's last notification should be an overflow
  2940 	 */
  2941 	 */
  2941 	test.Next(_L("TestOverflow"));
  2942 	test.Next(_L("TestOverflow"));
  2942 	RFs fs;
  2943 	RFs fs;
  2943 	TInt r = fs.Connect();
  2944 	TInt r = fs.Connect();
  2944 	test(r == KErrNone);
  2945 	test_KErrNone(r);
  2945 	_LIT(KFileName,"over.flow");
  2946 	_LIT(KFileName,"over.flow");
  2946 	SThreadPackage doerPkg;
  2947 	SThreadPackage doerPkg;
  2947 	doerPkg.iFileName = KFileName;
  2948 	doerPkg.iFileName = KFileName;
  2948 	
  2949 	
  2949 	SThreadPackage watcher1Pkg;
  2950 	SThreadPackage watcher1Pkg;
  2981 	// (W3)
  2982 	// (W3)
  2982 	watcher1Pkg.iBarrier.Signal();
  2983 	watcher1Pkg.iBarrier.Signal();
  2983 	
  2984 	
  2984 	RTimer tim;
  2985 	RTimer tim;
  2985 	r = tim.CreateLocal();
  2986 	r = tim.CreateLocal();
  2986 	test(r==KErrNone);
  2987 	test_KErrNone(r);
  2987 	TRequestStatus timStatus;
  2988 	TRequestStatus timStatus;
  2988 	
  2989 	
  2989 	test.Next(_L("TestOverflow - Wait for watcher1 thread death"));
  2990 	test.Next(_L("TestOverflow - Wait for watcher1 thread death"));
  2990 	TTimeIntervalMicroSeconds32 interval = 10000000; //10 seconds
  2991 	TTimeIntervalMicroSeconds32 interval = 10000000; //10 seconds
  2991 	tim.After(timStatus,interval);
  2992 	tim.After(timStatus,interval);
  3058 
  3059 
  3059 TInt HandlePostOverflow(SThreadPackage& aPackage, CFsNotify* aNotify)
  3060 TInt HandlePostOverflow(SThreadPackage& aPackage, CFsNotify* aNotify)
  3060     {
  3061     {
  3061     TRequestStatus status;
  3062     TRequestStatus status;
  3062     TInt r = aNotify->RequestNotifications(status);
  3063     TInt r = aNotify->RequestNotifications(status);
  3063     test(r == KErrNone);
  3064     test_KErrNone(r);
  3064     //Signal that overflow has been found (W4)
  3065     //Signal that overflow has been found (W4)
  3065     aPackage.iBarrier.Signal();
  3066     aPackage.iBarrier.Signal();
  3066     
  3067     
  3067     User::WaitForRequest(status);
  3068     User::WaitForRequest(status);
  3068     
  3069     
  3084             }
  3085             }
  3085         notification = aNotify->NextNotification();
  3086         notification = aNotify->NextNotification();
  3086         if(notification == NULL)
  3087         if(notification == NULL)
  3087             {
  3088             {
  3088             r = aNotify->RequestNotifications(status);
  3089             r = aNotify->RequestNotifications(status);
  3089             test(r == KErrNone);
  3090             test_KErrNone(r);
  3090             User::WaitForRequest(status);
  3091             User::WaitForRequest(status);
  3091             notification = aNotify->NextNotification();
  3092             notification = aNotify->NextNotification();
  3092             }
  3093             }
  3093         test(notification != NULL);
  3094         test(notification != NULL);
  3094         count++;
  3095         count++;
  3125     //80*7 = 560.
  3126     //80*7 = 560.
  3126     // -4 means we should get 6 notifications
  3127     // -4 means we should get 6 notifications
  3127     //Except the first one will still be in the buffer
  3128     //Except the first one will still be in the buffer
  3128     // (as we've not called RequestNotification yet) so we'll only actually get 5.
  3129     // (as we've not called RequestNotification yet) so we'll only actually get 5.
  3129     TRAPD(r, notify = CFsNotify::NewL(fs,(80*7)-4));
  3130     TRAPD(r, notify = CFsNotify::NewL(fs,(80*7)-4));
  3130     test(r == KErrNone);
  3131     test_KErrNone(r);
  3131     User::LeaveIfNull(notify);
  3132     User::LeaveIfNull(notify);
  3132     notify->AddNotification(TFsNotification::EFileChange,path,filename);
  3133     notify->AddNotification(TFsNotification::EFileChange,path,filename);
  3133     notify->RequestNotifications(status);
  3134     notify->RequestNotifications(status);
  3134     
  3135     
  3135     //Signal that we are ready for doer to start (W1)
  3136     //Signal that we are ready for doer to start (W1)
  3194 TInt TestPostOverflowNotifications()
  3195 TInt TestPostOverflowNotifications()
  3195     {
  3196     {
  3196     test.Next(_L("TestPostOverflowNotifications"));
  3197     test.Next(_L("TestPostOverflowNotifications"));
  3197     RFs fs;
  3198     RFs fs;
  3198     TInt r = fs.Connect();
  3199     TInt r = fs.Connect();
  3199     test(r == KErrNone);
  3200     test_KErrNone(r);
  3200     _LIT(KFileName,"post.over");
  3201     _LIT(KFileName,"post.over");
  3201     SThreadPackage doerPkg;
  3202     SThreadPackage doerPkg;
  3202     doerPkg.iFileName = KFileName;
  3203     doerPkg.iFileName = KFileName;
  3203     
  3204     
  3204     SThreadPackage watcher1Pkg;
  3205     SThreadPackage watcher1Pkg;
  3249     path.Append((TChar)gDriveToTest);
  3250     path.Append((TChar)gDriveToTest);
  3250     path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3251     path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3251     path.Append(watcher1Pkg.iFileName);
  3252     path.Append(watcher1Pkg.iFileName);
  3252     RFile file;
  3253     RFile file;
  3253     r = file.Open(fs,path,EFileWrite);
  3254     r = file.Open(fs,path,EFileWrite);
  3254     test(r==KErrNone);
  3255     test_KErrNone(r);
  3255     
  3256     
  3256     r = file.SetSize(1);
  3257     r = file.SetSize(1);
  3257     test(r==KErrNone);
  3258     test_KErrNone(r);
  3258     r = file.SetSize(2);
  3259     r = file.SetSize(2);
  3259     test(r==KErrNone);
  3260     test_KErrNone(r);
  3260     r = file.SetSize(3);
  3261     r = file.SetSize(3);
  3261     test(r==KErrNone);
  3262     test_KErrNone(r);
  3262     file.Close();
  3263     file.Close();
  3263     
  3264     
  3264     watcher1Pkg.iBarrier.Signal(); // Signal post operations complete (Sx)
  3265     watcher1Pkg.iBarrier.Signal(); // Signal post operations complete (Sx)
  3265     
  3266     
  3266     RTimer tim;
  3267     RTimer tim;
  3267     r = tim.CreateLocal();
  3268     r = tim.CreateLocal();
  3268     test(r==KErrNone);
  3269     test_KErrNone(r);
  3269     TRequestStatus timStatus;
  3270     TRequestStatus timStatus;
  3270     
  3271     
  3271     test.Next(_L("TestOverflow - Wait for watcher1 thread death"));
  3272     test.Next(_L("TestOverflow - Wait for watcher1 thread death"));
  3272     TTimeIntervalMicroSeconds32 interval = 10000000; //10 seconds
  3273     TTimeIntervalMicroSeconds32 interval = 10000000; //10 seconds
  3273     tim.After(timStatus,interval);
  3274     tim.After(timStatus,interval);
  3305 void TestNonDriveFilters()
  3306 void TestNonDriveFilters()
  3306 	{
  3307 	{
  3307 	test.Next(_L("TestNonDriveFilters"));
  3308 	test.Next(_L("TestNonDriveFilters"));
  3308 	RFs fs;
  3309 	RFs fs;
  3309 	TInt r = fs.Connect();
  3310 	TInt r = fs.Connect();
  3310 	test(r==KErrNone);
  3311 	test_KErrNone(r);
  3311 	
  3312 	
  3312 	TDriveList drives;
  3313 	TDriveList drives;
  3313 	r = fs.DriveList(drives);
  3314 	r = fs.DriveList(drives);
  3314 	test(r==KErrNone);
  3315 	test_KErrNone(r);
  3315 	
  3316 	
  3316 	CFsNotify* notify = NULL;
  3317 	CFsNotify* notify = NULL;
  3317 	TRAP(r,notify= CFsNotify::NewL(fs,KMinNotificationBufferSize));
  3318 	TRAP(r,notify= CFsNotify::NewL(fs,KMinNotificationBufferSize));
  3318 	
  3319 	
  3319 	TBuf<20> testfile;
  3320 	TBuf<20> testfile;
  3320 	testfile.Append(_L("test.file"));
  3321 	testfile.Append(_L("test.file"));
  3321 	
  3322 	
  3322 	r = notify->AddNotification((TUint)TFsNotification::ECreate,_L(""),testfile);
  3323 	r = notify->AddNotification((TUint)TFsNotification::ECreate,_L(""),testfile);
  3323 	test(r==KErrNone);
  3324 	test_KErrNone(r);
  3324 	
  3325 	
  3325 	TRequestStatus status;
  3326 	TRequestStatus status;
  3326 	r = notify->RequestNotifications(status);
  3327 	r = notify->RequestNotifications(status);
  3327 	test(r==KErrNone);
  3328 	test_KErrNone(r);
  3328 	
  3329 	
  3329 	TBuf<40> path;
  3330 	TBuf<40> path;
  3330 	path.Append((TChar)gDriveToTest);
  3331 	path.Append((TChar)gDriveToTest);
  3331 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3332 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3332 	
  3333 	
  3334 	fullname.Append(path);
  3335 	fullname.Append(path);
  3335 	fullname.Append(testfile);
  3336 	fullname.Append(testfile);
  3336 	
  3337 	
  3337 	RFile file;
  3338 	RFile file;
  3338 	r = fs.MkDirAll(path);
  3339 	r = fs.MkDirAll(path);
  3339 	test(r==KErrNone || r==KErrAlreadyExists);
  3340 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
  3340 	r = file.Replace(fs,fullname,EFileWrite);
  3341 	r = file.Replace(fs,fullname,EFileWrite);
  3341 	test(r==KErrNone);
  3342 	test_KErrNone(r);
  3342 	file.Close();
  3343 	file.Close();
  3343 	
  3344 	
  3344 	fs.Delete(fullname);
  3345 	fs.Delete(fullname);
  3345 	
  3346 	
  3346 	TChar testDrive = (TChar)gDriveToTest;
  3347 	TChar testDrive = (TChar)gDriveToTest;
  3360 			break;
  3361 			break;
  3361 			}
  3362 			}
  3362 		}
  3363 		}
  3363 	
  3364 	
  3364 	r = fs.MkDirAll(fullname);
  3365 	r = fs.MkDirAll(fullname);
  3365 	test(r==KErrNone || r==KErrAlreadyExists);
  3366 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
  3366 	r = file.Replace(fs,fullname,EFileWrite);
  3367 	r = file.Replace(fs,fullname,EFileWrite);
  3367 	test(r==KErrNone);
  3368 	test_KErrNone(r);
  3368 	file.Close();
  3369 	file.Close();
  3369 	
  3370 	
  3370 	RTimer timer1;
  3371 	RTimer timer1;
  3371 	r = timer1.CreateLocal();
  3372 	r = timer1.CreateLocal();
  3372 	test(r == KErrNone);
  3373 	test_KErrNone(r);
  3373 	TRequestStatus timeout;
  3374 	TRequestStatus timeout;
  3374 	TTimeIntervalMicroSeconds32 time = 10000000;    //10 seconds
  3375 	TTimeIntervalMicroSeconds32 time = 10000000;    //10 seconds
  3375 	timer1.After(timeout,time);
  3376 	timer1.After(timeout,time);
  3376 	User::WaitForRequest(timeout,status);
  3377 	User::WaitForRequest(timeout,status);
  3377 	test(status.Int() != KRequestPending);
  3378 	test(status.Int() != KRequestPending);
  3380 
  3381 
  3381 	const TFsNotification* notification = notify->NextNotification();
  3382 	const TFsNotification* notification = notify->NextNotification();
  3382 	test(notification != NULL);
  3383 	test(notification != NULL);
  3383 	TPtrC _path;
  3384 	TPtrC _path;
  3384 	r = notification->Path(_path);
  3385 	r = notification->Path(_path);
  3385 	test(r==KErrNone);
  3386 	test_KErrNone(r);
  3386 	TChar driveletter = _path[0];
  3387 	TChar driveletter = _path[0];
  3387 	driveletter.UpperCase();
  3388 	driveletter.UpperCase();
  3388 	test(driveletter ==  (TChar)gDriveToTest);
  3389 	test(driveletter ==  (TChar)gDriveToTest);
  3389 	
  3390 	
  3390 	if(notification = notify->NextNotification(), notification==NULL)
  3391 	if(notification = notify->NextNotification(), notification==NULL)
  3391 		{
  3392 		{
  3392 		TRequestStatus status2;
  3393 		TRequestStatus status2;
  3393 		r = notify->RequestNotifications(status2);
  3394 		r = notify->RequestNotifications(status2);
  3394 		test(r==KErrNone);
  3395 		test_KErrNone(r);
  3395 		
  3396 		
  3396 		RTimer timer2;
  3397 		RTimer timer2;
  3397 		r = timer2.CreateLocal();
  3398 		r = timer2.CreateLocal();
  3398 		test(r == KErrNone);
  3399 		test_KErrNone(r);
  3399 		TRequestStatus timeout2;
  3400 		TRequestStatus timeout2;
  3400 		TTimeIntervalMicroSeconds32 time2 = 10000000;    //10 seconds
  3401 		TTimeIntervalMicroSeconds32 time2 = 10000000;    //10 seconds
  3401 		timer2.After(timeout2,time2);
  3402 		timer2.After(timeout2,time2);
  3402 		User::WaitForRequest(timeout2,status2);
  3403 		User::WaitForRequest(timeout2,status2);
  3403 		test(status2.Int() != KRequestPending);
  3404 		test(status2.Int() != KRequestPending);
  3406 		
  3407 		
  3407 		notification = notify->NextNotification();
  3408 		notification = notify->NextNotification();
  3408 		}
  3409 		}
  3409 	test(notification != NULL);
  3410 	test(notification != NULL);
  3410 	r = notification->Path(_path);
  3411 	r = notification->Path(_path);
  3411 	test(r==KErrNone);
  3412 	test_KErrNone(r);
  3412 	driveletter = _path[0];
  3413 	driveletter = _path[0];
  3413 	driveletter.UpperCase();
  3414 	driveletter.UpperCase();
  3414 	test(driveletter == (TChar)'C');	
  3415 	test(driveletter == (TChar)'C');	
  3415 	
  3416 	
  3416 	delete notify;
  3417 	delete notify;
  3421 // We receive no notifications for files changed under the directory
  3422 // We receive no notifications for files changed under the directory
  3422 void NegativeTestDirStar()
  3423 void NegativeTestDirStar()
  3423 	{
  3424 	{
  3424 	RFs fs;
  3425 	RFs fs;
  3425 	TInt r = fs.Connect();
  3426 	TInt r = fs.Connect();
  3426 	test(r==KErrNone);
  3427 	test_KErrNone(r);
  3427 	
  3428 	
  3428 	CFsNotify* notify = NULL;
  3429 	CFsNotify* notify = NULL;
  3429 	TRAP(r,notify= CFsNotify::NewL(fs,KMinNotificationBufferSize));
  3430 	TRAP(r,notify= CFsNotify::NewL(fs,KMinNotificationBufferSize));
  3430 	
  3431 	
  3431 	TBuf<40> path;
  3432 	TBuf<40> path;
  3432 	path.Append((TChar)gDriveToTest);
  3433 	path.Append((TChar)gDriveToTest);
  3433 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3434 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3434 	r = fs.MkDirAll(path);
  3435 	r = fs.MkDirAll(path);
  3435 	test(r == KErrNone || r == KErrAlreadyExists);
  3436 	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
  3436 	
  3437 	
  3437 	r = notify->AddNotification((TUint)TFsNotification::ECreate,path,_L(""));
  3438 	r = notify->AddNotification((TUint)TFsNotification::ECreate,path,_L(""));
  3438 	test(r==KErrNone);
  3439 	test_KErrNone(r);
  3439 	
  3440 	
  3440 	TRequestStatus status;
  3441 	TRequestStatus status;
  3441 	r = notify->RequestNotifications(status);
  3442 	r = notify->RequestNotifications(status);
  3442 	test(r==KErrNone);
  3443 	test_KErrNone(r);
  3443 	
  3444 	
  3444 	TBuf<40> filename;
  3445 	TBuf<40> filename;
  3445 	filename.Append((TChar)gDriveToTest);
  3446 	filename.Append((TChar)gDriveToTest);
  3446 	filename.Append(_L(":\\F32-TST\\T_NOTIFIER\\dir.star"));
  3447 	filename.Append(_L(":\\F32-TST\\T_NOTIFIER\\dir.star"));
  3447 	
  3448 	
  3448 	RFile file;
  3449 	RFile file;
  3449 	r = file.Replace(fs,filename,EFileWrite);
  3450 	r = file.Replace(fs,filename,EFileWrite);
  3450 	test(r==KErrNone);
  3451 	test_KErrNone(r);
  3451 	file.Close();
  3452 	file.Close();
  3452 	
  3453 	
  3453 	RTimer timer1;
  3454 	RTimer timer1;
  3454 	r = timer1.CreateLocal();
  3455 	r = timer1.CreateLocal();
  3455 	test(r == KErrNone);
  3456 	test_KErrNone(r);
  3456 	TRequestStatus timeout;
  3457 	TRequestStatus timeout;
  3457 	TTimeIntervalMicroSeconds32 time = 2000000;    //2 seconds
  3458 	TTimeIntervalMicroSeconds32 time = 2000000;    //2 seconds
  3458 	timer1.After(timeout,time);
  3459 	timer1.After(timeout,time);
  3459 	User::WaitForRequest(timeout,status);
  3460 	User::WaitForRequest(timeout,status);
  3460 	test(status.Int() == KRequestPending);
  3461 	test(status.Int() == KRequestPending);
  3477 	//1
  3478 	//1
  3478 	test.Printf(_L("NegativeTests() A\n"));
  3479 	test.Printf(_L("NegativeTests() A\n"));
  3479 	RFs fs;
  3480 	RFs fs;
  3480 	CFsNotify* notify = NULL;
  3481 	CFsNotify* notify = NULL;
  3481 	TInt r = fs.Connect();
  3482 	TInt r = fs.Connect();
  3482 	test(r == KErrNone);
  3483 	test_KErrNone(r);
  3483 	TRAP(r,notify = CFsNotify::NewL(fs,0));
  3484 	TRAP(r,notify = CFsNotify::NewL(fs,0));
  3484 	test(notify != NULL);
  3485 	test(notify != NULL);
  3485 	delete notify;
  3486 	delete notify;
  3486 	notify = NULL;
  3487 	notify = NULL;
  3487 	
  3488 	
  3492 	delete notify;
  3493 	delete notify;
  3493 	notify = NULL;
  3494 	notify = NULL;
  3494 
  3495 
  3495 	test.Printf(_L("NegativeTests() C\n"));
  3496 	test.Printf(_L("NegativeTests() C\n"));
  3496 	TRAP(r,notify = CFsNotify::NewL(fs,KMaxTInt));
  3497 	TRAP(r,notify = CFsNotify::NewL(fs,KMaxTInt));
  3497 	test(r==KErrArgument);
  3498 	test_Value(r, r == KErrArgument);
  3498 	test(notify==NULL);
  3499 	test(notify==NULL);
  3499 	
  3500 	
  3500 	//3
  3501 	//3
  3501 	test.Printf(_L("NegativeTests() D\n"));
  3502 	test.Printf(_L("NegativeTests() D\n"));
  3502 	TBuf<40> path;
  3503 	TBuf<40> path;
  3503 	path.Append((TChar)gDriveToTest);
  3504 	path.Append((TChar)gDriveToTest);
  3504 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3505 	path.Append(_L(":\\F32-TST\\T_NOTIFIER\\"));
  3505 	TBuf<20> filename;
  3506 	TBuf<20> filename;
  3506 	filename.Append(_L("file.txt"));
  3507 	filename.Append(_L("file.txt"));
  3507 	TRAP(r,notify = CFsNotify::NewL(fs,KMinNotificationBufferSize));
  3508 	TRAP(r,notify = CFsNotify::NewL(fs,KMinNotificationBufferSize));
  3508 	test(r==KErrNone);
  3509 	test_KErrNone(r);
  3509 	test(notify!=NULL);
  3510 	test(notify!=NULL);
  3510 	r = notify->AddNotification(0,path,filename);
  3511 	r = notify->AddNotification(0,path,filename);
  3511 	test(r == KErrArgument);
  3512 	test_Value(r, r == KErrArgument);
  3512 	
  3513 	
  3513 	test.Printf(_L("NegativeTests() E\n"));
  3514 	test.Printf(_L("NegativeTests() E\n"));
  3514 	r = notify->AddNotification((TUint)0x8000,path,filename); //invalid value
  3515 	r = notify->AddNotification((TUint)0x8000,path,filename); //invalid value
  3515 	test(r == KErrArgument);
  3516 	test_Value(r, r == KErrArgument);
  3516 	
  3517 	
  3517 	test.Printf(_L("NegativeTests() F\n"));
  3518 	test.Printf(_L("NegativeTests() F\n"));
  3518 	TBuf<40> invalidPath;
  3519 	TBuf<40> invalidPath;
  3519 	invalidPath.Append(_L("1:\\*"));
  3520 	invalidPath.Append(_L("1:\\*"));
  3520 	r = notify->AddNotification((TUint)TFsNotification::ECreate,invalidPath,filename);
  3521 	r = notify->AddNotification((TUint)TFsNotification::ECreate,invalidPath,filename);
  3521 	test(r == KErrNotFound || r == KErrPathNotFound);
  3522 	test_Value(r, r == KErrNotFound || r == KErrPathNotFound);
  3522 	
  3523 	
  3523 	//4
  3524 	//4
  3524 	test.Printf(_L("NegativeTests() G\n"));
  3525 	test.Printf(_L("NegativeTests() G\n"));
  3525 	TRequestStatus wrongStatus;
  3526 	TRequestStatus wrongStatus;
  3526 	wrongStatus = KRequestPending;
  3527 	wrongStatus = KRequestPending;
  3527 	r = notify->RequestNotifications(wrongStatus);
  3528 	r = notify->RequestNotifications(wrongStatus);
  3528 	test(r == KErrInUse);
  3529 	test_Value(r, r == KErrInUse);
  3529 	
  3530 	
  3530 	test.Printf(_L("NegativeTests() H\n"));
  3531 	test.Printf(_L("NegativeTests() H\n"));
  3531 	TRequestStatus status;
  3532 	TRequestStatus status;
  3532 	r = notify->RequestNotifications(status);
  3533 	r = notify->RequestNotifications(status);
  3533 	test(r==KErrNone);
  3534 	test_KErrNone(r);
  3534 	r = notify->CancelNotifications(wrongStatus);
  3535 	r = notify->CancelNotifications(wrongStatus);
  3535 	test(r == KErrInUse);
  3536 	test_Value(r, r == KErrInUse);
  3536 	
  3537 	
  3537 	delete notify;
  3538 	delete notify;
  3538 	notify = NULL;
  3539 	notify = NULL;
  3539 	fs.Close();
  3540 	fs.Close();
  3540 	}
  3541 	}
  3591  * the framework doesn't notify about them
  3592  * the framework doesn't notify about them
  3592  */
  3593  */
  3593 TInt TestNotificationsWithFServPlugins()
  3594 TInt TestNotificationsWithFServPlugins()
  3594 	{
  3595 	{
  3595 	TInt r = TheFs.AddPlugin(KNotifyPluginFileName);
  3596 	TInt r = TheFs.AddPlugin(KNotifyPluginFileName);
  3596 	test(r==KErrNone || r==KErrAlreadyExists);
  3597 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
  3597 	r = TheFs.MountPlugin(KNotifyPluginName,(TUint)gDriveToTest.GetUpperCase() - 65);
  3598 	r = TheFs.MountPlugin(KNotifyPluginName,(TUint)gDriveToTest.GetUpperCase() - 65);
  3598 	if (r == KErrNotSupported)
  3599 	if (r == KErrNotSupported)
  3599 		{
  3600 		{
  3600 		test.Printf(_L("Plugins are not supported on pagable drives.\nSkipping test.\n"));
  3601 		test.Printf(_L("Plugins are not supported on pagable drives.\nSkipping test.\n"));
  3601 		safe_test(test,r,__LINE__,(TText*)Expand("t_notifier.cpp"));
  3602 		safe_test(test,r,__LINE__,(TText*)Expand("t_notifier.cpp"));
  3651 	test.Next(_L("CFsNotify Creation and Delete Tests"));
  3652 	test.Next(_L("CFsNotify Creation and Delete Tests"));
  3652 	//Creates and Deletes 1 CFsNotify
  3653 	//Creates and Deletes 1 CFsNotify
  3653 	__UHEAP_MARK;
  3654 	__UHEAP_MARK;
  3654 	r = TestNewDeleteCFsNotify(1);
  3655 	r = TestNewDeleteCFsNotify(1);
  3655 	__UHEAP_MARKEND;
  3656 	__UHEAP_MARKEND;
  3656 	test(r==KErrNone);	
  3657 	test_KErrNone(r);	
  3657 	//Creates and Deletes 50 CFsNotifys
  3658 	//Creates and Deletes 50 CFsNotifys
  3658 	__UHEAP_MARK;
  3659 	__UHEAP_MARK;
  3659 	r = TestNewDeleteCFsNotify(50);
  3660 	r = TestNewDeleteCFsNotify(50);
  3660 	__UHEAP_MARKEND;
  3661 	__UHEAP_MARKEND;
  3661 	test(r==KErrNone);
  3662 	test_KErrNone(r);
  3662 	test.Printf(_L("------- End of User Heap Tests ---------------------------------------\n"));
  3663 	test.Printf(_L("------- End of User Heap Tests ---------------------------------------\n"));
  3663 	//
  3664 	//
  3664 	// 2.	Add notification for creating a file
  3665 	// 2.	Add notification for creating a file
  3665 	//		Create that file
  3666 	//		Create that file
  3666 	//
  3667 	//
  3667 	PrintLine();
  3668 	PrintLine();
  3668 	__UHEAP_MARK;
  3669 	__UHEAP_MARK;
  3669 	r = SimpleCreateTestL();
  3670 	r = SimpleCreateTestL();
  3670 	__UHEAP_MARKEND;
  3671 	__UHEAP_MARKEND;
  3671 	test(r==KErrNone);
  3672 	test_KErrNone(r);
  3672 	test.Printf(_L("------- End of CFsNotify Creation and Delete Tests -------------------\n"));
  3673 	test.Printf(_L("------- End of CFsNotify Creation and Delete Tests -------------------\n"));
  3673 	//
  3674 	//
  3674 	// 3.	Add notification at the root of a drive
  3675 	// 3.	Add notification at the root of a drive
  3675 	//		Create a file in that drive
  3676 	//		Create a file in that drive
  3676 	//
  3677 	//
  3692 	//
  3693 	//
  3693 	PrintLine();
  3694 	PrintLine();
  3694 	__UHEAP_MARK;
  3695 	__UHEAP_MARK;
  3695 	r = TestTwoDoersL();
  3696 	r = TestTwoDoersL();
  3696 	__UHEAP_MARKEND;
  3697 	__UHEAP_MARKEND;
  3697 	test(r==KErrNone);
  3698 	test_KErrNone(r);
  3698 	test.Printf(_L("------- End of TwoDoers Test -----------------------------------------\n"));
  3699 	test.Printf(_L("------- End of TwoDoers Test -----------------------------------------\n"));
  3699 	//
  3700 	//
  3700 	// 6.	Create 2 file server sessions
  3701 	// 6.	Create 2 file server sessions
  3701 	//		Add a notification on each session for the same specific file creation
  3702 	//		Add a notification on each session for the same specific file creation
  3702 	//		Create that file
  3703 	//		Create that file
  3703 	//
  3704 	//
  3704 	PrintLine();
  3705 	PrintLine();
  3705 	__UHEAP_MARK;
  3706 	__UHEAP_MARK;
  3706 	r = TestTwoWatchersL();
  3707 	r = TestTwoWatchersL();
  3707 	__UHEAP_MARKEND;
  3708 	__UHEAP_MARKEND;
  3708 	test(r==KErrNone);
  3709 	test_KErrNone(r);
  3709 	test.Printf(_L("------- End of TwoWatchers Test --------------------------------------\n"));
  3710 	test.Printf(_L("------- End of TwoWatchers Test --------------------------------------\n"));
  3710 	//
  3711 	//
  3711 	// 7.	Create 2 file server sessions and 2 clients
  3712 	// 7.	Create 2 file server sessions and 2 clients
  3712 	//		Add a notification on each session for different file creations
  3713 	//		Add a notification on each session for different file creations
  3713 	//		Clients create a file each
  3714 	//		Clients create a file each
  3714 	//
  3715 	//
  3715 	PrintLine();
  3716 	PrintLine();
  3716 	__UHEAP_MARK;
  3717 	__UHEAP_MARK;
  3717 	r = TestTwoWatchersTwoDoersL();
  3718 	r = TestTwoWatchersTwoDoersL();
  3718 	__UHEAP_MARKEND;
  3719 	__UHEAP_MARKEND;
  3719 	test(r==KErrNone);
  3720 	test_KErrNone(r);
  3720 	test.Printf(_L("------- End of TwoWatchersTwoDoers Test ------------------------------\n"));
  3721 	test.Printf(_L("------- End of TwoWatchersTwoDoers Test ------------------------------\n"));
  3721 	//
  3722 	//
  3722 	// 8.	Add notification for a specific file creation
  3723 	// 8.	Add notification for a specific file creation
  3723 	//		Cancel the notification request
  3724 	//		Cancel the notification request
  3724 	//		Create that file
  3725 	//		Create that file
  3725 	//
  3726 	//
  3726 	PrintLine();
  3727 	PrintLine();
  3727 	__UHEAP_MARK;
  3728 	__UHEAP_MARK;
  3728 	r =  TestCancelNotificationL();
  3729 	r =  TestCancelNotificationL();
  3729 	__UHEAP_MARKEND;
  3730 	__UHEAP_MARKEND;
  3730 	test(r==KErrNone);
  3731 	test_KErrNone(r);
  3731 	test.Printf(_L("------- End of CancelNotification Test -------------------------------\n"));
  3732 	test.Printf(_L("------- End of CancelNotification Test -------------------------------\n"));
  3732 	//
  3733 	//
  3733 	// 9.	Create 2 file server sessions
  3734 	// 9.	Create 2 file server sessions
  3734 	//		Add a notification on each session for the same specific file creation
  3735 	//		Add a notification on each session for the same specific file creation
  3735 	//		Delete the first notification
  3736 	//		Delete the first notification
  3738 	PrintLine();
  3739 	PrintLine();
  3739 	test.Next(_L("TestClientRemoval"));
  3740 	test.Next(_L("TestClientRemoval"));
  3740 	__UHEAP_MARK;
  3741 	__UHEAP_MARK;
  3741 	r = TestClientRemovalL();
  3742 	r = TestClientRemovalL();
  3742 	__UHEAP_MARKEND;
  3743 	__UHEAP_MARKEND;
  3743 	test(r==KErrNone);
  3744 	test_KErrNone(r);
  3744 	test.Printf(_L("------- End of TestClientRemoval Test --------------------------------\n"));
  3745 	test.Printf(_L("------- End of TestClientRemoval Test --------------------------------\n"));
  3745 	//
  3746 	//
  3746 	// 10.	Create a CFsNotify object
  3747 	// 10.	Create a CFsNotify object
  3747 	//		Close the session before closing the subsession
  3748 	//		Close the session before closing the subsession
  3748 	//		Add notification and request notifications
  3749 	//		Add notification and request notifications
  3775 	//
  3776 	//
  3776 	PrintLine();
  3777 	PrintLine();
  3777 	test.Next(_L("EFileCreate Tests"));
  3778 	test.Next(_L("EFileCreate Tests"));
  3778 	_LIT(KFilename3,"file.create");
  3779 	_LIT(KFilename3,"file.create");
  3779 	r = TestMultipleNotificationsL(_L(""),KFilename3,5,5,t_notification::EFileCreate,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3780 	r = TestMultipleNotificationsL(_L(""),KFilename3,5,5,t_notification::EFileCreate,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3780 	test(r==KErrNone);
  3781 	test_KErrNone(r);
  3781 	test.Printf(_L("------- End of EFileCreate Tests -------------------------------------\n"));
  3782 	test.Printf(_L("------- End of EFileCreate Tests -------------------------------------\n"));
  3782 	//
  3783 	//
  3783 	// RFs::MkDir
  3784 	// RFs::MkDir
  3784 	// 2.  Add notification for a specific directory creation 
  3785 	// 2.  Add notification for a specific directory creation 
  3785 	//     Create that directory
  3786 	//     Create that directory
  3786 	//
  3787 	//
  3787 	PrintLine();
  3788 	PrintLine();
  3788 	test.Next(_L("EFsMkDir Test"));
  3789 	test.Next(_L("EFsMkDir Test"));
  3789 	_LIT(KDirName1,"dirCreate\\");
  3790 	_LIT(KDirName1,"dirCreate\\");
  3790 	r = TestMultipleNotificationsL(KDirName1,_L(""),1,1,t_notification::EFsMkDir,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3791 	r = TestMultipleNotificationsL(KDirName1,_L(""),1,1,t_notification::EFsMkDir,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3791 	test(r==KErrNone);
  3792 	test_KErrNone(r);
  3792 	test.Printf(_L("------- End of EFsMkDir Test -----------------------------------------\n"));
  3793 	test.Printf(_L("------- End of EFsMkDir Test -----------------------------------------\n"));
  3793 	//
  3794 	//
  3794 	// RFile::Replace
  3795 	// RFile::Replace
  3795 	// 3.  Add notification for a specific file creation
  3796 	// 3.  Add notification for a specific file creation
  3796 	//     Replace that file
  3797 	//     Replace that file
  3797 	//
  3798 	//
  3798 	PrintLine();
  3799 	PrintLine();
  3799 	test.Next(_L("EFileReplace Test"));
  3800 	test.Next(_L("EFileReplace Test"));
  3800 	r = TestMultipleNotificationsL(_L(""),KFilename3,1,1,t_notification::EFileReplace,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3801 	r = TestMultipleNotificationsL(_L(""),KFilename3,1,1,t_notification::EFileReplace,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3801 	test(r==KErrNone);
  3802 	test_KErrNone(r);
  3802 	test.Printf(_L("------- End of EFileReplace Test -------------------------------------\n"));
  3803 	test.Printf(_L("------- End of EFileReplace Test -------------------------------------\n"));
  3803 	//
  3804 	//
  3804 	// 4.  Add notification for a specific file creation
  3805 	// 4.  Add notification for a specific file creation
  3805 	//     Remove that notification
  3806 	//     Remove that notification
  3806 	//     Create that file
  3807 	//     Create that file
  3807 	//
  3808 	//
  3808 	PrintLine();
  3809 	PrintLine();
  3809 	__UHEAP_MARK;
  3810 	__UHEAP_MARK;
  3810 	r =  TestAddRemoveNotificationL();
  3811 	r =  TestAddRemoveNotificationL();
  3811 	__UHEAP_MARKEND;
  3812 	__UHEAP_MARKEND;
  3812 	test(r==KErrNone);
  3813 	test_KErrNone(r);
  3813 	test.Printf(_L("------- End of Add and Remove Notification Test ----------------------\n"));
  3814 	test.Printf(_L("------- End of Add and Remove Notification Test ----------------------\n"));
  3814 	//
  3815 	//
  3815 	// Wildcard Create Tests
  3816 	// Wildcard Create Tests
  3816 	// 5.  Add notification for file creation using wildcard name
  3817 	// 5.  Add notification for file creation using wildcard name
  3817 	//     Add notification for file/directory wildcard including subdirectories 
  3818 	//     Add notification for file/directory wildcard including subdirectories 
  3821 	test.Next(_L("Wildcard Create Tests"));
  3822 	test.Next(_L("Wildcard Create Tests"));
  3822 	//
  3823 	//
  3823 	// Wildcard Name
  3824 	// Wildcard Name
  3824 	_LIT(KWildcardName1,"*");
  3825 	_LIT(KWildcardName1,"*");
  3825 	r = TestMultipleNotificationsL(_L(""),KWildcardName1,1,1,t_notification::EFileCreate,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3826 	r = TestMultipleNotificationsL(_L(""),KWildcardName1,1,1,t_notification::EFileCreate,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3826 	test(r==KErrNone);
  3827 	test_KErrNone(r);
  3827 	r = TestMultipleNotificationsL(KWildcardName1,KWildcardName1,1,1,t_notification::EFileCreate_subs,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3828 	r = TestMultipleNotificationsL(KWildcardName1,KWildcardName1,1,1,t_notification::EFileCreate_subs,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3828 	test(r==KErrNone);
  3829 	test_KErrNone(r);
  3829 	r = TestMultipleNotificationsL(KWildcardName1,KWildcardName1,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3830 	r = TestMultipleNotificationsL(KWildcardName1,KWildcardName1,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3830 	test(r==KErrNone);
  3831 	test_KErrNone(r);
  3831 	//
  3832 	//
  3832 	// Wildcard including Subdirectories
  3833 	// Wildcard including Subdirectories
  3833 	_LIT(KWildcardName2,"*\\");
  3834 	_LIT(KWildcardName2,"*\\");
  3834 	r = TestMultipleNotificationsL(KWildcardName2,KWildcardName1,1,1,t_notification::EFileCreate,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3835 	r = TestMultipleNotificationsL(KWildcardName2,KWildcardName1,1,1,t_notification::EFileCreate,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3835 	test(r==KErrNone);
  3836 	test_KErrNone(r);
  3836 	r = TestMultipleNotificationsL(KWildcardName2,KWildcardName1,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3837 	r = TestMultipleNotificationsL(KWildcardName2,KWildcardName1,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3837 	test(r==KErrNone);
  3838 	test_KErrNone(r);
  3838 	_LIT(KDirName2,"SubDir\\");
  3839 	_LIT(KDirName2,"SubDir\\");
  3839 	_LIT(KWildcardName3,"?");
  3840 	_LIT(KWildcardName3,"?");
  3840 	r = TestMultipleNotificationsL(KDirName2,KWildcardName3,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3841 	r = TestMultipleNotificationsL(KDirName2,KWildcardName3,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3841 	test(r==KErrNone);
  3842 	test_KErrNone(r);
  3842 	//
  3843 	//
  3843 	// Wildcard Type
  3844 	// Wildcard Type
  3844 	_LIT(KWildcardName4,"*.*");
  3845 	_LIT(KWildcardName4,"*.*");
  3845 	r = TestMultipleNotificationsL(_L(""),KWildcardName4,1,1,t_notification::EFileCreate_txt_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3846 	r = TestMultipleNotificationsL(_L(""),KWildcardName4,1,1,t_notification::EFileCreate_txt_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3846 	test(r==KErrNone);
  3847 	test_KErrNone(r);
  3847 	r = TestMultipleNotificationsL(_L(""),KWildcardName4,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3848 	r = TestMultipleNotificationsL(_L(""),KWildcardName4,1,1,t_notification::EFileCreate_subs_nowatch,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3848 	test(r==KErrNone);
  3849 	test_KErrNone(r);
  3849 	//
  3850 	//
  3850 	// 6.  Add notification for file creation for a specific type
  3851 	// 6.  Add notification for file creation for a specific type
  3851 	//     Create file with that type
  3852 	//     Create file with that type
  3852 	//     Create file with different type
  3853 	//     Create file with different type
  3853 	//
  3854 	//
  3854 	_LIT(KWildcardName5,"*.txt");
  3855 	_LIT(KWildcardName5,"*.txt");
  3855 	r = TestMultipleNotificationsL(_L(""),KWildcardName5,1,1,t_notification::EFileCreate_txt,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3856 	r = TestMultipleNotificationsL(_L(""),KWildcardName5,1,1,t_notification::EFileCreate_txt,TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3856 	test(r==KErrNone);
  3857 	test_KErrNone(r);
  3857 	test.Printf(_L("------- End of Wildcard Create Tests ---------------------------------\n"));
  3858 	test.Printf(_L("------- End of Wildcard Create Tests ---------------------------------\n"));
  3858 	
  3859 	
  3859 	
  3860 	
  3860 	//=============================================================================
  3861 	//=============================================================================
  3861 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2445
  3862 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2445
  3873 	//
  3874 	//
  3874 	PrintLine();
  3875 	PrintLine();
  3875 	test.Next(_L("Attribute Tests"));
  3876 	test.Next(_L("Attribute Tests"));
  3876 	_LIT(KFilename4,"file.setatts");
  3877 	_LIT(KFilename4,"file.setatts");
  3877 	r = TestMultipleNotificationsL(_L(""),KFilename4,1,1,t_notification::EFileSetAtt,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3878 	r = TestMultipleNotificationsL(_L(""),KFilename4,1,1,t_notification::EFileSetAtt,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3878 	test(r==KErrNone);
  3879 	test_KErrNone(r);
  3879 	r = TestMultipleNotificationsL(_L(""),KFilename4,1,1,t_notification::EFileSet,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3880 	r = TestMultipleNotificationsL(_L(""),KFilename4,1,1,t_notification::EFileSet,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3880 	test(r==KErrNone);
  3881 	test_KErrNone(r);
  3881 	r = TestMultipleNotificationsL(_L(""),KFilename4,1,1,t_notification::EFsSetEntry,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3882 	r = TestMultipleNotificationsL(_L(""),KFilename4,1,1,t_notification::EFsSetEntry,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3882 	test(r==KErrNone);
  3883 	test_KErrNone(r);
  3883 	//
  3884 	//
  3884 	// Wildcard Attribute Test including subdirectories
  3885 	// Wildcard Attribute Test including subdirectories
  3885 	// 2.  Add notification for file attribute change using wildcard name
  3886 	// 2.  Add notification for file attribute change using wildcard name
  3886 	//     Create number of files that match the notification
  3887 	//     Create number of files that match the notification
  3887 	//     Change attributes of some files
  3888 	//     Change attributes of some files
  3888 	//
  3889 	//
  3889 	r = TestMultipleNotificationsL(KWildcardName2,_L("*"),3,3,t_notification::EFileSetAtt_subs,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3890 	r = TestMultipleNotificationsL(KWildcardName2,_L("*"),3,3,t_notification::EFileSetAtt_subs,TFsNotification::EAttribute,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3890 	test(r==KErrNone);
  3891 	test_KErrNone(r);
  3891 	test.Printf(_L("------- End of Attribute Tests ---------------------------------------\n"));
  3892 	test.Printf(_L("------- End of Attribute Tests ---------------------------------------\n"));
  3892 	
  3893 	
  3893 	
  3894 	
  3894 	//=============================================================================
  3895 	//=============================================================================
  3895 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2446
  3896 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2446
  3907 	// 
  3908 	// 
  3908 	PrintLine();
  3909 	PrintLine();
  3909 	test.Next(_L("Rename Tests"));
  3910 	test.Next(_L("Rename Tests"));
  3910 	_LIT(KFilename5,"file.rename");
  3911 	_LIT(KFilename5,"file.rename");
  3911 	r = TestMultipleNotificationsL(_L(""),KFilename5,1,1,t_notification::EFsReplace,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3912 	r = TestMultipleNotificationsL(_L(""),KFilename5,1,1,t_notification::EFsReplace,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3912 	test(r==KErrNone);
  3913 	test_KErrNone(r);
  3913 	r = TestMultipleNotificationsL(_L(""),KFilename5,1,1,t_notification::EFsRename,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3914 	r = TestMultipleNotificationsL(_L(""),KFilename5,1,1,t_notification::EFsRename,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3914 	test(r==KErrNone);
  3915 	test_KErrNone(r);
  3915 	r = TestMultipleNotificationsL(_L(""),KFilename5,1,1,t_notification::EFileRename,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3916 	r = TestMultipleNotificationsL(_L(""),KFilename5,1,1,t_notification::EFileRename,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3916 	test(r==KErrNone);
  3917 	test_KErrNone(r);
  3917 	//
  3918 	//
  3918 	// 2.  Add notification for a specific directory rename
  3919 	// 2.  Add notification for a specific directory rename
  3919 	//     Rename that directory
  3920 	//     Rename that directory
  3920 	//
  3921 	//
  3921 	_LIT(KDirName3,"dirRename\\");
  3922 	_LIT(KDirName3,"dirRename\\");
  3922 	r = TestMultipleNotificationsL(KDirName3,_L(""),1,1,t_notification::EFsRename_dir,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3923 	r = TestMultipleNotificationsL(KDirName3,_L(""),1,1,t_notification::EFsRename_dir,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3923 	test(r==KErrNone);
  3924 	test_KErrNone(r);
  3924 	//
  3925 	//
  3925 	// 3.  Add notification for file rename using wildcard name
  3926 	// 3.  Add notification for file rename using wildcard name
  3926 	//     Create file that match the notification
  3927 	//     Create file that match the notification
  3927 	//     Repeatedly rename the file
  3928 	//     Repeatedly rename the file
  3928 	//
  3929 	//
  3929 	r = TestMultipleNotificationsL(_L(""),KWildcardName1,3,3,t_notification::EFileRename_wild,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3930 	r = TestMultipleNotificationsL(_L(""),KWildcardName1,3,3,t_notification::EFileRename_wild,TFsNotification::ERename,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3930 	test(r==KErrNone);
  3931 	test_KErrNone(r);
  3931 	test.Printf(_L("------- End of Rename Tests ------------------------------------------\n"));
  3932 	test.Printf(_L("------- End of Rename Tests ------------------------------------------\n"));
  3932 	
  3933 	
  3933 	
  3934 	
  3934 	//=============================================================================
  3935 	//=============================================================================
  3935 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2447
  3936 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2447
  3947 	//
  3948 	//
  3948 	PrintLine();
  3949 	PrintLine();
  3949 	test.Next(_L("EFsDelete Test"));
  3950 	test.Next(_L("EFsDelete Test"));
  3950 	_LIT(KFilename6,"file.delete");
  3951 	_LIT(KFilename6,"file.delete");
  3951 	r = TestMultipleNotificationsL(_L(""),KFilename6,1,1,t_notification::EFsDelete,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3952 	r = TestMultipleNotificationsL(_L(""),KFilename6,1,1,t_notification::EFsDelete,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3952 	test(r==KErrNone);	
  3953 	test_KErrNone(r);	
  3953 	//
  3954 	//
  3954 	// RFs::RmDir
  3955 	// RFs::RmDir
  3955 	// 2.  Add notification for a specific directory delete
  3956 	// 2.  Add notification for a specific directory delete
  3956 	//     Delete that directory
  3957 	//     Delete that directory
  3957 	//
  3958 	//
  3958 	PrintLine();
  3959 	PrintLine();
  3959 	test.Next(_L("EFsRmDir Tests"));
  3960 	test.Next(_L("EFsRmDir Tests"));
  3960 	_LIT(KDirName4,"dirRemove\\");
  3961 	_LIT(KDirName4,"dirRemove\\");
  3961 	r = TestMultipleNotificationsL(KDirName4,_L(""),1,1,t_notification::EFsRmDir,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3962 	r = TestMultipleNotificationsL(KDirName4,_L(""),1,1,t_notification::EFsRmDir,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3962 	test(r==KErrNone);
  3963 	test_KErrNone(r);
  3963     //
  3964     //
  3964     // This test should not receive any notifications because a non-empty directory cannot be removed
  3965     // This test should not receive any notifications because a non-empty directory cannot be removed
  3965     // 3.  Add notification for specific directory delete
  3966     // 3.  Add notification for specific directory delete
  3966     //     Create files inside that directory
  3967     //     Create files inside that directory
  3967     //     Delete the directory
  3968     //     Delete the directory
  3968     //
  3969     //
  3969     _LIT(KDirName5,"dirRmNonEmp\\");
  3970     _LIT(KDirName5,"dirRmNonEmp\\");
  3970     r = TestMultipleNotificationsL(KDirName5,_L(""),1,1,t_notification::EFsRmDir_nonEmpty,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3971     r = TestMultipleNotificationsL(KDirName5,_L(""),1,1,t_notification::EFsRmDir_nonEmpty,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)ETrue,__LINE__);
  3971     test(r==KErrNone);	
  3972     test_KErrNone(r);	
  3972     //
  3973     //
  3973     // Wildcard Name ("*")
  3974     // Wildcard Name ("*")
  3974     // 4.  Add notification for directory delete using wildcard name
  3975     // 4.  Add notification for directory delete using wildcard name
  3975     //     Create directory that match the notification
  3976     //     Create directory that match the notification
  3976 	//	   Delete that directory
  3977 	//	   Delete that directory
  3977     //
  3978     //
  3978     r = TestMultipleNotificationsL(KWildcardName1,_L(""),1,1,t_notification::EFsRmDir_wild,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3979     r = TestMultipleNotificationsL(KWildcardName1,_L(""),1,1,t_notification::EFsRmDir_wild,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3979     test(r==KErrNone);	
  3980     test_KErrNone(r);	
  3980     //
  3981     //
  3981     // Wildcard Type ("*.txt")
  3982     // Wildcard Type ("*.txt")
  3982     // Creates files with different types and should only receive notifications from "*.txt" file deletions
  3983     // Creates files with different types and should only receive notifications from "*.txt" file deletions
  3983     // 5.  Add notification for file deletes using wildcard type
  3984     // 5.  Add notification for file deletes using wildcard type
  3984     //     Create number of files that match the notification
  3985     //     Create number of files that match the notification
  3985     //     Delete those files
  3986     //     Delete those files
  3986     //
  3987     //
  3987     r = TestMultipleNotificationsL(_L(""),KWildcardName4,3,3,t_notification::EFsDelete,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3988     r = TestMultipleNotificationsL(_L(""),KWildcardName4,3,3,t_notification::EFsDelete,TFsNotification::EDelete,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  3988     test(r==KErrNone);
  3989     test_KErrNone(r);
  3989     test.Printf(_L("------- End of Delete Tests ------------------------------------------\n"));
  3990     test.Printf(_L("------- End of Delete Tests ------------------------------------------\n"));
  3990 	
  3991 	
  3991 	
  3992 	
  3992 	//======================================================================
  3993 	//======================================================================
  3993 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2448
  3994 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2448
  4011 	test.Next(_L("EFileWrite Tests"));
  4012 	test.Next(_L("EFileWrite Tests"));
  4012 	_LIT(KFilename7,"file.write");
  4013 	_LIT(KFilename7,"file.write");
  4013 	__UHEAP_MARK;
  4014 	__UHEAP_MARK;
  4014 	r = TestMultipleNotificationsL(_L(""),KFilename7,7,7,t_notification::EFileWrite,TFsNotification::EFileChange,3*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4015 	r = TestMultipleNotificationsL(_L(""),KFilename7,7,7,t_notification::EFileWrite,TFsNotification::EFileChange,3*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4015 	__UHEAP_MARKEND;
  4016 	__UHEAP_MARKEND;
  4016 	test(r==KErrNone);
  4017 	test_KErrNone(r);
  4017 	//
  4018 	//
  4018 	// 2.  Add notification for a specific file change
  4019 	// 2.  Add notification for a specific file change
  4019 	//     Write to the specified file a number of times without changing its size
  4020 	//     Write to the specified file a number of times without changing its size
  4020 	//
  4021 	//
  4021 	// Four letters are written to a file, then the first letter in the file is replaced aIterations times
  4022 	// Four letters are written to a file, then the first letter in the file is replaced aIterations times
  4022 	//     aMaxNotifications = 1 + aIterations
  4023 	//     aMaxNotifications = 1 + aIterations
  4023 	//
  4024 	//
  4024 	r = TestMultipleNotificationsL(_L(""),KFilename7,3,4,t_notification::EFileWrite_samesize,TFsNotification::EFileChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4025 	r = TestMultipleNotificationsL(_L(""),KFilename7,3,4,t_notification::EFileWrite_samesize,TFsNotification::EFileChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4025 	test(r==KErrNone);
  4026 	test_KErrNone(r);
  4026 	test.Printf(_L("------- End of EFileWrite Tests --------------------------------------\n"));
  4027 	test.Printf(_L("------- End of EFileWrite Tests --------------------------------------\n"));
  4027 	//
  4028 	//
  4028 	// 3.  Add notification for a specific file change
  4029 	// 3.  Add notification for a specific file change
  4029 	//     Write to that file asynchronously
  4030 	//     Write to that file asynchronously
  4030 	//
  4031 	//
  4032 	test.Next(_L("EFileWrite_async Tests"));
  4033 	test.Next(_L("EFileWrite_async Tests"));
  4033 	_LIT(KFilename8,"async.write");
  4034 	_LIT(KFilename8,"async.write");
  4034 	__UHEAP_MARK;
  4035 	__UHEAP_MARK;
  4035 	r = TestMultipleNotificationsL(_L(""),KFilename8,4,4,t_notification::EFileWrite_async,TFsNotification::EFileChange,2*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4036 	r = TestMultipleNotificationsL(_L(""),KFilename8,4,4,t_notification::EFileWrite_async,TFsNotification::EFileChange,2*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4036 	__UHEAP_MARKEND;
  4037 	__UHEAP_MARKEND;
  4037 	test(r==KErrNone);
  4038 	test_KErrNone(r);
  4038 	test.Printf(_L("------- End of EFileWrite_async Tests --------------------------------\n"));	
  4039 	test.Printf(_L("------- End of EFileWrite_async Tests --------------------------------\n"));	
  4039 	//
  4040 	//
  4040 	// File Set Size
  4041 	// File Set Size
  4041 	// 4.  Add notification for a specific file change
  4042 	// 4.  Add notification for a specific file change
  4042 	//     Both increase and decrease the file sizes a number of times
  4043 	//     Both increase and decrease the file sizes a number of times
  4046 	//
  4047 	//
  4047 	PrintLine();
  4048 	PrintLine();
  4048 	test.Next(_L("EFileSetSize Tests"));
  4049 	test.Next(_L("EFileSetSize Tests"));
  4049 	_LIT(KFilename9,"file.setsize");
  4050 	_LIT(KFilename9,"file.setsize");
  4050 	r = TestMultipleNotificationsL(_L(""),KFilename9,5,9,t_notification::EFileSetSize,TFsNotification::EFileChange,3*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4051 	r = TestMultipleNotificationsL(_L(""),KFilename9,5,9,t_notification::EFileSetSize,TFsNotification::EFileChange,3*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4051 	test(r==KErrNone);
  4052 	test_KErrNone(r);
  4052 	test.Printf(_L("------- End of EFileSetSize Tests ------------------------------------\n"));
  4053 	test.Printf(_L("------- End of EFileSetSize Tests ------------------------------------\n"));
  4053 
  4054 
  4054 
  4055 
  4055 	//
  4056 	//
  4056     PrintLine();
  4057     PrintLine();
  4057 	test.Next(_L("CFileMan Tests"));
  4058 	test.Next(_L("CFileMan Tests"));
  4058 	_LIT(KFilenameCFMan,"cf1le.man");
  4059 	_LIT(KFilenameCFMan,"cf1le.man");
  4059 	TUint notificationTypes = (TUint)TFsNotification::ECreate|TFsNotification::EFileChange|TFsNotification::EAttribute|TFsNotification::EDelete|TFsNotification::ERename;
  4060 	TUint notificationTypes = (TUint)TFsNotification::ECreate|TFsNotification::EFileChange|TFsNotification::EAttribute|TFsNotification::EDelete|TFsNotification::ERename;
  4060 	r = TestMultipleNotificationsL(_L(""),KFilenameCFMan,1,5,t_notification::ECFileManMove,notificationTypes,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4061 	r = TestMultipleNotificationsL(_L(""),KFilenameCFMan,1,5,t_notification::ECFileManMove,notificationTypes,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4061 	test(r==KErrNone);
  4062 	test_KErrNone(r);
  4062 	test.Printf(_L("------- End of CFileMan Tests -------------------------------------\n"));
  4063 	test.Printf(_L("------- End of CFileMan Tests -------------------------------------\n"));
  4063 	
  4064 	
  4064 	
  4065 	
  4065 	//========================================================================================
  4066 	//========================================================================================
  4066 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2449
  4067 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2449
  4079 	//
  4080 	//
  4080 	PrintLine();
  4081 	PrintLine();
  4081 	test.Next(_L("Mount Tests"));
  4082 	test.Next(_L("Mount Tests"));
  4082 	TFullName filesystemName;
  4083 	TFullName filesystemName;
  4083 	r = TheFs.FileSystemName(filesystemName,globalDriveNum);
  4084 	r = TheFs.FileSystemName(filesystemName,globalDriveNum);
  4084 	test(r==KErrNone);
  4085 	test_KErrNone(r);
  4085 	r = TestMultipleNotificationsL(filesystemName,1,1,t_notification::EDismount,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4086 	r = TestMultipleNotificationsL(filesystemName,1,1,t_notification::EDismount,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4086 	test(r==KErrNone);
  4087 	test_KErrNone(r);
  4087 	//
  4088 	//
  4088 	// RFs::MountFileSystem
  4089 	// RFs::MountFileSystem
  4089 	// 2.  Add notification for media change
  4090 	// 2.  Add notification for media change
  4090 	//     Mount the file system
  4091 	//     Mount the file system
  4091 	//
  4092 	//
  4092 	r = TestMultipleNotificationsL(filesystemName,1,1,t_notification::EMount,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4093 	r = TestMultipleNotificationsL(filesystemName,1,1,t_notification::EMount,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4093 	test(r==KErrNone);
  4094 	test_KErrNone(r);
  4094 	//
  4095 	//
  4095 	// Repeatedly mount and dismount the file system
  4096 	// Repeatedly mount and dismount the file system
  4096 	// 3.  Add notification for media change
  4097 	// 3.  Add notification for media change
  4097 	//     Repeatedly dismount and mount the file system
  4098 	//     Repeatedly dismount and mount the file system
  4098 	//
  4099 	//
  4099 	// The file system is dismounted and mounted aIterations times
  4100 	// The file system is dismounted and mounted aIterations times
  4100 	//     aMaxNotifications = 2*aIterations
  4101 	//     aMaxNotifications = 2*aIterations
  4101 	//
  4102 	//
  4102 	r = TestMultipleNotificationsL(filesystemName,5,10,t_notification::EMountDismount,TFsNotification::EMediaChange,3*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4103 	r = TestMultipleNotificationsL(filesystemName,5,10,t_notification::EMountDismount,TFsNotification::EMediaChange,3*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4103 	test(r==KErrNone);
  4104 	test_KErrNone(r);
  4104 	//
  4105 	//
  4105 	// RFs::MountFileSystemAndScan
  4106 	// RFs::MountFileSystemAndScan
  4106 	// 4.  Add notification for media change
  4107 	// 4.  Add notification for media change
  4107 	//     Mount and scan the file system
  4108 	//     Mount and scan the file system
  4108 	//
  4109 	//
  4109 	// The file system is dismounted and mounted aIterations times
  4110 	// The file system is dismounted and mounted aIterations times
  4110 	//     aMaxNotifications = 2*aIterations
  4111 	//     aMaxNotifications = 2*aIterations
  4111 	//
  4112 	//
  4112 //#ifndef __WINS__
  4113 //#ifndef __WINS__
  4113 //    r = TestMultipleNotificationsL(filesystemName,1,2,t_notification::EMountScan,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4114 //    r = TestMultipleNotificationsL(filesystemName,1,2,t_notification::EMountScan,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4114 //    test(r==KErrNone);
  4115 //    test_KErrNone(r);
  4115 //#endif
  4116 //#endif
  4116 	test.Printf(_L("------- End of Mount Tests -------------------------------------------\n"));
  4117 	test.Printf(_L("------- End of Mount Tests -------------------------------------------\n"));
  4117 	TDriveInfo drvInfo;
  4118 	TDriveInfo drvInfo;
  4118 	TInt driveNum;
  4119 	TInt driveNum;
  4119 	TheFs.CharToDrive(gDriveToTest,driveNum);
  4120 	TheFs.CharToDrive(gDriveToTest,driveNum);
  4120 	r = TheFs.Drive(drvInfo,driveNum);
  4121 	r = TheFs.Drive(drvInfo,driveNum);
  4121 	test (r == KErrNone);
  4122 	test_KErrNone(r);
  4122 	TPtrC driveDes((TText*)&gDriveToTest,1);
  4123 	TPtrC driveDes((TText*)&gDriveToTest,1);
  4123 	//
  4124 	//
  4124 	// Manual Tests - Will only run on removable drives
  4125 	// Manual Tests - Will only run on removable drives
  4125 	//
  4126 	//
  4126 /*	if(drvInfo.iDriveAtt & KDriveAttRemovable)
  4127 /*	if(drvInfo.iDriveAtt & KDriveAttRemovable)
  4130 		//    Remove media card manually
  4131 		//    Remove media card manually
  4131 		//
  4132 		//
  4132 		PrintLine();
  4133 		PrintLine();
  4133 		test.Next(_L("Media Card Removal/Insertion Tests"));
  4134 		test.Next(_L("Media Card Removal/Insertion Tests"));
  4134 		r = TestMultipleNotificationsL(driveDes,1,1,t_notification::EMediaCardRemoval,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4135 		r = TestMultipleNotificationsL(driveDes,1,1,t_notification::EMediaCardRemoval,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4135 		test(r==KErrNone);
  4136 		test_KErrNone(r);
  4136 		//
  4137 		//
  4137 		// 6. Add notification for media change
  4138 		// 6. Add notification for media change
  4138 		//    Insert media card manually
  4139 		//    Insert media card manually
  4139 		//
  4140 		//
  4140 		r = TestMultipleNotificationsL(driveDes,1,1,t_notification::EMediaCardInsertion,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4141 		r = TestMultipleNotificationsL(driveDes,1,1,t_notification::EMediaCardInsertion,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4141 		test(r==KErrNone);
  4142 		test_KErrNone(r);
  4142 		test.Printf(_L("------- End of Media Card Removal/Insertion Tests --------------------\n"));
  4143 		test.Printf(_L("------- End of Media Card Removal/Insertion Tests --------------------\n"));
  4143 		//
  4144 		//
  4144 		// We should receive an EMediaChange notification even though we did not register for it
  4145 		// We should receive an EMediaChange notification even though we did not register for it
  4145 		// 7. Do not add notification for media change
  4146 		// 7. Do not add notification for media change
  4146 		//    Remove and insert media card manually
  4147 		//    Remove and insert media card manually
  4159 #endif
  4160 #endif
  4160         {
  4161         {
  4161         PrintLine();
  4162         PrintLine();
  4162         test.Next(_L("RRawDisk::Write Tests"));
  4163         test.Next(_L("RRawDisk::Write Tests"));
  4163         r = TestMultipleNotificationsL(driveDes,1,1,t_notification::ERawDiskWrite,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4164         r = TestMultipleNotificationsL(driveDes,1,1,t_notification::ERawDiskWrite,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4164         test(r==KErrNone);
  4165         test_KErrNone(r);
  4165         test.Printf(_L("------- End of RRawDisk::Write Test ------------------------------  \n"));
  4166         test.Printf(_L("------- End of RRawDisk::Write Test ------------------------------  \n"));
  4166         }	
  4167         }	
  4167 	
  4168 	
  4168 	
  4169 	
  4169 	//===============================================================================
  4170 	//===============================================================================
  4184     //      Change the drive name
  4185     //      Change the drive name
  4185 	//
  4186 	//
  4186 	PrintLine();
  4187 	PrintLine();
  4187 	test.Next(_L("DriveName Test"));
  4188 	test.Next(_L("DriveName Test"));
  4188 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::ESetDriveName,TFsNotification::EDriveName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4189 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::ESetDriveName,TFsNotification::EDriveName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4189 	test(r==KErrNone);
  4190 	test_KErrNone(r);
  4190 	//
  4191 	//
  4191 	// 2.  Add notification for a specific drive name change
  4192 	// 2.  Add notification for a specific drive name change
  4192 	//     Repeatedly rename the drive
  4193 	//     Repeatedly rename the drive
  4193 	//
  4194 	//
  4194 	r = TestMultipleNotificationsL(driveDes,3,6,t_notification::ESetDriveName,TFsNotification::EDriveName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4195 	r = TestMultipleNotificationsL(driveDes,3,6,t_notification::ESetDriveName,TFsNotification::EDriveName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4195 	test(r==KErrNone);
  4196 	test_KErrNone(r);
  4196 	test.Printf(_L("------- End of DriveName Test ----------------------------------------\n"));
  4197 	test.Printf(_L("------- End of DriveName Test ----------------------------------------\n"));
  4197 	
  4198 	
  4198 	
  4199 	
  4199 	//================================================================================
  4200 	//================================================================================
  4200 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2451
  4201 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2451
  4216 	//
  4217 	//
  4217 	// 1.  Add notification for a specific volume name change
  4218 	// 1.  Add notification for a specific volume name change
  4218 	//     Change the volume name
  4219 	//     Change the volume name
  4219 	//
  4220 	//
  4220 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::ESetVolumeLabel,TFsNotification::EVolumeName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4221 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::ESetVolumeLabel,TFsNotification::EVolumeName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4221 	test(r==KErrNone);
  4222 	test_KErrNone(r);
  4222 	//
  4223 	//
  4223 	// 2.  Add notification for a specific volume name change
  4224 	// 2.  Add notification for a specific volume name change
  4224 	//     Repeatedly rename the volume
  4225 	//     Repeatedly rename the volume
  4225 	//
  4226 	//
  4226 	r = TestMultipleNotificationsL(driveDes,3,6,t_notification::ESetVolumeLabel,TFsNotification::EVolumeName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4227 	r = TestMultipleNotificationsL(driveDes,3,6,t_notification::ESetVolumeLabel,TFsNotification::EVolumeName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4227 	test(r==KErrNone);
  4228 	test_KErrNone(r);
  4228 	test.Printf(_L("------- End of VolumeName Test ---------------------------------------\n"));
  4229 	test.Printf(_L("------- End of VolumeName Test ---------------------------------------\n"));
  4229 #endif
  4230 #endif
  4230 		
  4231 		
  4231 	
  4232 	
  4232     //=============================================================================
  4233     //=============================================================================
  4248 	// EAllOps1: A file is created and deleted aIterations times
  4249 	// EAllOps1: A file is created and deleted aIterations times
  4249 	// 		aMaxNotification = 2*aIterations
  4250 	// 		aMaxNotification = 2*aIterations
  4250 	//
  4251 	//
  4251 	_LIT(KFilename10,"file.allops");
  4252 	_LIT(KFilename10,"file.allops");
  4252 	r = TestMultipleNotificationsL(_L(""),KFilename10,4,8,t_notification::EAllOps1,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4253 	r = TestMultipleNotificationsL(_L(""),KFilename10,4,8,t_notification::EAllOps1,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4253 	test(r==KErrNone);
  4254 	test_KErrNone(r);
  4254 	//
  4255 	//
  4255 	// 2.	Add notification for all operations
  4256 	// 2.	Add notification for all operations
  4256 	//		Create a file
  4257 	//		Create a file
  4257 	//		Write to the file
  4258 	//		Write to the file
  4258 	//		Delete the file
  4259 	//		Delete the file
  4259 	//
  4260 	//
  4260 	// EAllOps2: A file is created, written to aIterations times and then deleted
  4261 	// EAllOps2: A file is created, written to aIterations times and then deleted
  4261 	// 		aMaxNotification = 2 + aIterations (See File Write Tests)
  4262 	// 		aMaxNotification = 2 + aIterations (See File Write Tests)
  4262 	//
  4263 	//
  4263 	r = TestMultipleNotificationsL(_L(""),KFilename10,4,6,t_notification::EAllOps2,(TUint)TFsNotification::EAllOps,2*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4264 	r = TestMultipleNotificationsL(_L(""),KFilename10,4,6,t_notification::EAllOps2,(TUint)TFsNotification::EAllOps,2*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4264 	test(r==KErrNone);
  4265 	test_KErrNone(r);
  4265 	//
  4266 	//
  4266 	// 3.	Add notification for all operations
  4267 	// 3.	Add notification for all operations
  4267 	//		Create a file
  4268 	//		Create a file
  4268 	//		Change the file size
  4269 	//		Change the file size
  4269 	//		Delete the file
  4270 	//		Delete the file
  4271 	// EAllOps3: A file is created, its size is increased size aIterations times, decreased (aIterations - 1) times
  4272 	// EAllOps3: A file is created, its size is increased size aIterations times, decreased (aIterations - 1) times
  4272 	// 			 and then deleted
  4273 	// 			 and then deleted
  4273 	//     aMaxNotifications = 1 + 2*aIterations
  4274 	//     aMaxNotifications = 1 + 2*aIterations
  4274 	//
  4275 	//
  4275 	r = TestMultipleNotificationsL(_L(""),KFilename10,4,9,t_notification::EAllOps3,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize*2,(TBool)EFalse,__LINE__);
  4276 	r = TestMultipleNotificationsL(_L(""),KFilename10,4,9,t_notification::EAllOps3,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize*2,(TBool)EFalse,__LINE__);
  4276 	test(r==KErrNone);
  4277 	test_KErrNone(r);
  4277 	//
  4278 	//
  4278 	// 4.	Add notification for all operations
  4279 	// 4.	Add notification for all operations
  4279 	//		Create a file
  4280 	//		Create a file
  4280 	//		Change the file attribute
  4281 	//		Change the file attribute
  4281 	//		Delete the file
  4282 	//		Delete the file
  4282 	//
  4283 	//
  4283 	// EAllOps4: A file is created, its attribute is changed and the file is deleted
  4284 	// EAllOps4: A file is created, its attribute is changed and the file is deleted
  4284 	// 		aMaxNotification = 3
  4285 	// 		aMaxNotification = 3
  4285 	//
  4286 	//
  4286 	r = TestMultipleNotificationsL(_L(""),KFilename10,1,3,t_notification::EAllOps4,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4287 	r = TestMultipleNotificationsL(_L(""),KFilename10,1,3,t_notification::EAllOps4,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4287 	test(r==KErrNone);
  4288 	test_KErrNone(r);
  4288 	//
  4289 	//
  4289 	// 5.	Add notification for all operations
  4290 	// 5.	Add notification for all operations
  4290 	//		Create a file
  4291 	//		Create a file
  4291 	//		Rename the file
  4292 	//		Rename the file
  4292 	//
  4293 	//
  4293 	// EAllOps5: A file is created and renamed
  4294 	// EAllOps5: A file is created and renamed
  4294 	// 		aMaxNotification = 2
  4295 	// 		aMaxNotification = 2
  4295 	//
  4296 	//
  4296 	r = TestMultipleNotificationsL(_L(""),KFilename10,1,2,t_notification::EAllOps5,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4297 	r = TestMultipleNotificationsL(_L(""),KFilename10,1,2,t_notification::EAllOps5,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4297 	test(r==KErrNone);
  4298 	test_KErrNone(r);
  4298 	//
  4299 	//
  4299 	// 6.	Add notification for all operations
  4300 	// 6.	Add notification for all operations
  4300 	//		Change drive name
  4301 	//		Change drive name
  4301 	//		Change volume name
  4302 	//		Change volume name
  4302 	//
  4303 	//
  4304 	// EAllOps6: The drive and volume names are changed
  4305 	// EAllOps6: The drive and volume names are changed
  4305 	//		aMaxNotification = 2
  4306 	//		aMaxNotification = 2
  4306 	//
  4307 	//
  4307 #ifndef __WINS__
  4308 #ifndef __WINS__
  4308 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::EAllOps6,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4309 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::EAllOps6,(TUint)TFsNotification::EAllOps,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4309 	test(r==KErrNone);
  4310 	test_KErrNone(r);
  4310 #endif
  4311 #endif
  4311 	test.Printf(_L("------- End of AllOps Tests ------------------------------------------\n"));
  4312 	test.Printf(_L("------- End of AllOps Tests ------------------------------------------\n"));
  4312 	
  4313 	
  4313 	
  4314 	
  4314     //=============================================================================
  4315     //=============================================================================
  4329 	// A file is created and deleted aIterations times
  4330 	// A file is created and deleted aIterations times
  4330 	// 		aMaxNotification = 2*aIterations
  4331 	// 		aMaxNotification = 2*aIterations
  4331 	//
  4332 	//
  4332 	_LIT(KFilename11,"file.mulfil");
  4333 	_LIT(KFilename11,"file.mulfil");
  4333 	r = TestMultipleNotificationsL(_L(""),KFilename11,3,6,t_notification::EAllOps1,TFsNotification::ECreate | TFsNotification::EDelete,2*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4334 	r = TestMultipleNotificationsL(_L(""),KFilename11,3,6,t_notification::EAllOps1,TFsNotification::ECreate | TFsNotification::EDelete,2*KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4334 	test(r==KErrNone);
  4335 	test_KErrNone(r);
  4335 	//
  4336 	//
  4336 	// TFsNotification::EDelete | TFsNotification::ECreate | TFsNotification::EFileChange
  4337 	// TFsNotification::EDelete | TFsNotification::ECreate | TFsNotification::EFileChange
  4337 	// 2.	Add notification for create, file change and delete for a specific file
  4338 	// 2.	Add notification for create, file change and delete for a specific file
  4338 	//		Create a file
  4339 	//		Create a file
  4339 	//		Change the file size
  4340 	//		Change the file size
  4342 	// A file is created, its size is increased size aIterations times, decreased (aIterations - 1) times
  4343 	// A file is created, its size is increased size aIterations times, decreased (aIterations - 1) times
  4343 	// and then deleted
  4344 	// and then deleted
  4344 	//     aMaxNotifications = 1 + 2*aIterations
  4345 	//     aMaxNotifications = 1 + 2*aIterations
  4345 	//
  4346 	//
  4346 	r = TestMultipleNotificationsL(_L(""),KFilename11,4,9,t_notification::EAllOps3,TFsNotification::EDelete | TFsNotification::ECreate | TFsNotification::EFileChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4347 	r = TestMultipleNotificationsL(_L(""),KFilename11,4,9,t_notification::EAllOps3,TFsNotification::EDelete | TFsNotification::ECreate | TFsNotification::EFileChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4347 	test(r==KErrNone);
  4348 	test_KErrNone(r);
  4348 	//
  4349 	//
  4349 	// TFsNotification::EAttribute | TFsNotification::EDelete | TFsNotification::ECreate
  4350 	// TFsNotification::EAttribute | TFsNotification::EDelete | TFsNotification::ECreate
  4350 	// 3.	Add notification for create, attribute change and delete for a specific file
  4351 	// 3.	Add notification for create, attribute change and delete for a specific file
  4351 	//		Create a file
  4352 	//		Create a file
  4352 	//		Change the file attribute
  4353 	//		Change the file attribute
  4354 	//
  4355 	//
  4355 	// A file is created, its attribute is changed and the file is deleted
  4356 	// A file is created, its attribute is changed and the file is deleted
  4356 	// 		aMaxNotification = 3
  4357 	// 		aMaxNotification = 3
  4357 	//
  4358 	//
  4358 	r = TestMultipleNotificationsL(_L(""),KFilename11,1,3,t_notification::EAllOps4,TFsNotification::EAttribute | TFsNotification::EDelete | TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4359 	r = TestMultipleNotificationsL(_L(""),KFilename11,1,3,t_notification::EAllOps4,TFsNotification::EAttribute | TFsNotification::EDelete | TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4359 	test(r==KErrNone);
  4360 	test_KErrNone(r);
  4360 	//
  4361 	//
  4361 	// TFsNotification::ERename | TFsNotification::ECreate
  4362 	// TFsNotification::ERename | TFsNotification::ECreate
  4362 	// 4.	Add notification for create and rename for a specific file
  4363 	// 4.	Add notification for create and rename for a specific file
  4363 	//		Create a file
  4364 	//		Create a file
  4364 	//		Rename the file
  4365 	//		Rename the file
  4365 	//
  4366 	//
  4366 	// A file is created and renamed
  4367 	// A file is created and renamed
  4367 	// 		aMaxNotification = 2
  4368 	// 		aMaxNotification = 2
  4368 	//
  4369 	//
  4369 	r = TestMultipleNotificationsL(_L(""),KFilename11,1,2,t_notification::EAllOps5,TFsNotification::ERename | TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4370 	r = TestMultipleNotificationsL(_L(""),KFilename11,1,2,t_notification::EAllOps5,TFsNotification::ERename | TFsNotification::ECreate,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4370 	test(r==KErrNone);
  4371 	test_KErrNone(r);
  4371 	//
  4372 	//
  4372 	// TFsNotification::EVolumeName | TFsNotification::EDriveName
  4373 	// TFsNotification::EVolumeName | TFsNotification::EDriveName
  4373 	// 5.	Add notification for drive and volume name change for a specific drive
  4374 	// 5.	Add notification for drive and volume name change for a specific drive
  4374 	//		Change drive name
  4375 	//		Change drive name
  4375 	//		Change volume name
  4376 	//		Change volume name
  4378 	// The drive and volume names are changed
  4379 	// The drive and volume names are changed
  4379 	//		aMaxNotification = 2
  4380 	//		aMaxNotification = 2
  4380 	//
  4381 	//
  4381 #ifndef __WINS__
  4382 #ifndef __WINS__
  4382 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::EAllOps6,TFsNotification::EVolumeName | TFsNotification::EDriveName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4383 	r = TestMultipleNotificationsL(driveDes,1,2,t_notification::EAllOps6,TFsNotification::EVolumeName | TFsNotification::EDriveName,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4383 	test(r==KErrNone);
  4384 	test_KErrNone(r);
  4384 #endif
  4385 #endif
  4385 	test.Printf(_L("------- End of Multiple-Filter Tests ---------------------------------\n"));
  4386 	test.Printf(_L("------- End of Multiple-Filter Tests ---------------------------------\n"));
  4386 	
  4387 	
  4387 	
  4388 	
  4388 	//==============================================================================
  4389 	//==============================================================================
  4398 	// 2.	Make continuous file size changes to the file
  4399 	// 2.	Make continuous file size changes to the file
  4399 	// 3.	When overflow notification occurs, delete the notification
  4400 	// 3.	When overflow notification occurs, delete the notification
  4400 	//
  4401 	//
  4401 	PrintLine();
  4402 	PrintLine();
  4402 	r = TestOverflowL();
  4403 	r = TestOverflowL();
  4403 	test(r==KErrNone);
  4404 	test_KErrNone(r);
  4404 	
  4405 	
  4405 	//For DEF140387
  4406 	//For DEF140387
  4406 	PrintLine();
  4407 	PrintLine();
  4407 	r= TestPostOverflowNotifications();
  4408 	r= TestPostOverflowNotifications();
  4408 	test(r==KErrNone);
  4409 	test_KErrNone(r);
  4409 	test.Printf(_L("------- End of Overflow Test -----------------------------------------\n"));
  4410 	test.Printf(_L("------- End of Overflow Test -----------------------------------------\n"));
  4410 	
  4411 	
  4411 	
  4412 	
  4412 	//============================================================================
  4413 	//============================================================================
  4413 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2455
  4414 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2455
  4452     //! @SYMTestCaseDesc        Plugin Tests
  4453     //! @SYMTestCaseDesc        Plugin Tests
  4453     //! @SYMTestStatus          
  4454     //! @SYMTestStatus          
  4454 	//=============================================================================
  4455 	//=============================================================================
  4455 	PrintLine();
  4456 	PrintLine();
  4456 	r = TestNotificationsWithFServPlugins();
  4457 	r = TestNotificationsWithFServPlugins();
  4457 	test(r==KErrNone);
  4458 	test_KErrNone(r);
  4458 	test.Printf(_L("------- End of Plugin Tests ------------------------------------------\n"));
  4459 	test.Printf(_L("------- End of Plugin Tests ------------------------------------------\n"));
  4459 		
  4460 		
  4460 	
  4461 	
  4461 	//======================================================================
  4462 	//======================================================================
  4462 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2459
  4463 	//! @SYMTestCaseID			PBASE-T_NOTIFY-2459
  4479 #endif
  4480 #endif
  4480 		{
  4481 		{
  4481 		PrintLine();
  4482 		PrintLine();
  4482 		test.Next(_L("Format Tests"));
  4483 		test.Next(_L("Format Tests"));
  4483 		r = TestMultipleNotificationsL(driveDes,1,1,t_notification::EFormat,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4484 		r = TestMultipleNotificationsL(driveDes,1,1,t_notification::EFormat,TFsNotification::EMediaChange,KMinNotificationBufferSize,(TBool)EFalse,__LINE__);
  4484 		test(r==KErrNone);
  4485 		test_KErrNone(r);
  4485 		test.Printf(_L("------- End of Format Tests ------------------------------------------\n"));
  4486 		test.Printf(_L("------- End of Format Tests ------------------------------------------\n"));
  4486 		}
  4487 		}
  4487 	
  4488 	
  4488 	
  4489 	
  4489 	//======================================================================
  4490 	//======================================================================
  4501 	//	3.	A process with the specified uid
  4502 	//	3.	A process with the specified uid
  4502 	//
  4503 	//
  4503 	PrintLine();
  4504 	PrintLine();
  4504 	test.Next(_L("Test T_NOTIFIER_NOCAPS.EXE"));
  4505 	test.Next(_L("Test T_NOTIFIER_NOCAPS.EXE"));
  4505 	r = TestProcessCapabilities(_L("T_NOTIFIER_NOCAPS.EXE"));
  4506 	r = TestProcessCapabilities(_L("T_NOTIFIER_NOCAPS.EXE"));
  4506 	test(r == KErrPermissionDenied); //Failure on emulator -> Did you forget to do a wintest?
  4507 	test_Value(r, r == KErrPermissionDenied); //Failure on emulator -> Did you forget to do a wintest?
  4507 	
  4508 	
  4508 	test.Next(_L("Test T_NOTIFIER_ALLFILES.EXE"));
  4509 	test.Next(_L("Test T_NOTIFIER_ALLFILES.EXE"));
  4509 	r = TestProcessCapabilities(_L("T_NOTIFIER_ALLFILES.EXE"));
  4510 	r = TestProcessCapabilities(_L("T_NOTIFIER_ALLFILES.EXE"));
  4510 	test(r == KErrNone);
  4511 	test_KErrNone(r);
  4511 	
  4512 	
  4512 	test.Next(_L("Test T_NOTIFIER_BELONGS.EXE"));
  4513 	test.Next(_L("Test T_NOTIFIER_BELONGS.EXE"));
  4513 	r = TestProcessCapabilities(_L("T_NOTIFIER_BELONGS.EXE"));
  4514 	r = TestProcessCapabilities(_L("T_NOTIFIER_BELONGS.EXE"));
  4514 	test(r == KErrNone);
  4515 	test_KErrNone(r);
  4515 	test.Printf(_L("------- End of Data-Caging Tests -------------------------------------\n"));
  4516 	test.Printf(_L("------- End of Data-Caging Tests -------------------------------------\n"));
  4516 	
  4517 	
  4517 	
  4518 	
  4518 	test.End();
  4519 	test.End();
  4519 	test.Close();
  4520 	test.Close();