kerneltest/f32test/server/t_appins.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
    13 // Description:
    13 // Description:
    14 // f32test\server\t_appins.cpp
    14 // f32test\server\t_appins.cpp
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #define __E32TEST_EXTENSION__
       
    19 #include <f32file.h>
    18 #include <f32file.h>
    20 #include <e32test.h>
    19 #include <e32test.h>
    21 #include <hal.h>
    20 #include <hal.h>
    22 #include "t_server.h"
    21 #include "t_server.h"
    23 #include "t_chlffs.h"
    22 #include "t_chlffs.h"
    52 	{
    51 	{
    53 	TFileName path;
    52 	TFileName path;
    54 	path=_L("?:\\F32-TST\\T_APPINS\\");
    53 	path=_L("?:\\F32-TST\\T_APPINS\\");
    55 		
    54 		
    56 	TInt r=TheNotifyFs.SessionPath(gSessionPath);
    55 	TInt r=TheNotifyFs.SessionPath(gSessionPath);
    57 	test_KErrNone(r);
    56 	test(r==KErrNone);
    58 
    57 
    59 	TChar driveChar;
    58 	TChar driveChar;
    60 	r=RFs::DriveToChar(RemovableDrive,driveChar);
    59 	r=RFs::DriveToChar(RemovableDrive,driveChar);
    61 	test_KErrNone(r);
    60 	test(r==KErrNone);
    62 	
    61 	
    63 	if (gSessionPath[0]=='C')
    62 	if (gSessionPath[0]=='C')
    64 		(gSessionPath[0] == (TText)gDriveToTest)? (path[0] = (TText)driveChar):(path[0] = (TText)gDriveToTest);
    63 		(gSessionPath[0] == (TText)gDriveToTest)? (path[0] = (TText)driveChar):(path[0] = (TText)gDriveToTest);
    65 	else if (gSessionPath[0]=='Y')
    64 	else if (gSessionPath[0]=='Y')
    66 		path[0]='X';
    65 		path[0]='X';
    75 	TRequestStatus statDir(KRequestPending);
    74 	TRequestStatus statDir(KRequestPending);
    76 	TRequestStatus statWild(KRequestPending);
    75 	TRequestStatus statWild(KRequestPending);
    77 	TRequestStatus statWilder(KRequestPending);
    76 	TRequestStatus statWilder(KRequestPending);
    78 
    77 
    79 	r=TheFs.RmDir(path);
    78 	r=TheFs.RmDir(path);
    80 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
    79 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
    81 
    80 
    82 	test.Printf(_L("Notify Session Path %S\n"),&gSessionPath);
    81 	test.Printf(_L("Notify Session Path %S\n"),&gSessionPath);
    83 
    82 
    84 //	Submit notify change requests (requesting ahead)
    83 //	Submit notify change requests (requesting ahead)
    85 	test.Printf(_L("Create a directory %S\n"),&path);
    84 	test.Printf(_L("Create a directory %S\n"),&path);
    88 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
    87 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
    89 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
    88 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
    90 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
    89 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
    91 
    90 
    92 	r=TheFs.MkDir(path);	
    91 	r=TheFs.MkDir(path);	
    93 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
    92 	test((r==KErrNone)||(r==KErrAlreadyExists));
    94 	User::WaitForAnyRequest();
    93 	User::WaitForAnyRequest();
    95 	test(statEntry==KErrNone);
    94 	test(statEntry==KErrNone);
    96 	test(statFile==KErrNone);
    95 	test(statFile==KErrNone);
    97 	test(statDir==KErrNone);
    96 	test(statDir==KErrNone);
    98 	test(statWild==KErrNone);
    97 	test(statWild==KErrNone);
   111 	filePath+=_L("TestFile.app");
   110 	filePath+=_L("TestFile.app");
   112 	RFile file;
   111 	RFile file;
   113 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   112 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   114 	file.Close();
   113 	file.Close();
   115 	User::WaitForAnyRequest();
   114 	User::WaitForAnyRequest();
   116 	test_KErrNone(r);
   115 	test(r==KErrNone);
   117 	test (statEntry==KErrNone);
   116 	test (statEntry==KErrNone);
   118 	test(statFile==KErrNone);
   117 	test(statFile==KErrNone);
   119 	test(statDir==KRequestPending);
   118 	test(statDir==KRequestPending);
   120 	test(statWild==KErrNone);
   119 	test(statWild==KErrNone);
   121 	test(statWilder==KErrNone);
   120 	test(statWilder==KErrNone);
   126 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   125 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   127 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   126 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   128 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   127 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   129 	
   128 	
   130 	r=TheFs.Delete(filePath);
   129 	r=TheFs.Delete(filePath);
   131 	test_KErrNone(r);
   130 	test(r==KErrNone);
   132 	User::WaitForAnyRequest();
   131 	User::WaitForAnyRequest();
   133 	test (statEntry==KErrNone);
   132 	test (statEntry==KErrNone);
   134 	test(statFile==KErrNone);
   133 	test(statFile==KErrNone);
   135 	test(statDir==KRequestPending);
   134 	test(statDir==KRequestPending);
   136 	test(statWild==KRequestPending);
   135 	test(statWild==KRequestPending);
   142 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   141 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   143 //	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   142 //	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   144 	TheNotifyFs.NotifyChange(ENotifyFile,statWilder,_L("*:\\"));
   143 	TheNotifyFs.NotifyChange(ENotifyFile,statWilder,_L("*:\\"));
   145 
   144 
   146 	r=TheFs.RmDir(path);
   145 	r=TheFs.RmDir(path);
   147 	test_KErrNone(r);
   146 	test(r==KErrNone);
   148 	User::WaitForAnyRequest();
   147 	User::WaitForAnyRequest();
   149 	test (statEntry==KErrNone);
   148 	test (statEntry==KErrNone);
   150 	test(statFile==KRequestPending);
   149 	test(statFile==KRequestPending);
   151 	test(statDir==KErrNone);
   150 	test(statDir==KErrNone);
   152 	test(statWild==KErrNone);
   151 	test(statWild==KErrNone);
   165 	TFileName sessionPath;
   164 	TFileName sessionPath;
   166 	sessionPath=_L("?:\\F32-TST\\");
   165 	sessionPath=_L("?:\\F32-TST\\");
   167 		
   166 		
   168 	TChar driveChar;
   167 	TChar driveChar;
   169 	TInt err=RFs::DriveToChar(RemovableDrive,driveChar);
   168 	TInt err=RFs::DriveToChar(RemovableDrive,driveChar);
   170 	test_KErrNone(err);
   169 	test(err==KErrNone);
   171 
   170 
   172 	if (gSessionPath[0]=='C')
   171 	if (gSessionPath[0]=='C')
   173 		(gSessionPath[0] == (TText)gDriveToTest)? (sessionPath[0] = (TText)driveChar):(sessionPath[0] = (TText)gDriveToTest);
   172 		(gSessionPath[0] == (TText)gDriveToTest)? (sessionPath[0] = (TText)driveChar):(sessionPath[0] = (TText)gDriveToTest);
   174 	else if (gSessionPath[0]=='Y')
   173 	else if (gSessionPath[0]=='Y')
   175 		sessionPath[0]='X';
   174 		sessionPath[0]='X';
   178 	else 
   177 	else 
   179 		sessionPath[0]='C';	//invalid drive numbers shouldn't reach here, must be filtered out from t_main
   178 		sessionPath[0]='C';	//invalid drive numbers shouldn't reach here, must be filtered out from t_main
   180 		//return;
   179 		//return;
   181 	
   180 	
   182 	TInt r=TheFs.SetSessionPath(sessionPath);
   181 	TInt r=TheFs.SetSessionPath(sessionPath);
   183 	test_KErrNone(r);
   182 	test(r==KErrNone);
   184 
   183 
   185 	TFileName path;
   184 	TFileName path;
   186 	path=_L("\\F32-TST\\T_APPINS\\");	//	Takes drive implicitly from associated session path
   185 	path=_L("\\F32-TST\\T_APPINS\\");	//	Takes drive implicitly from associated session path
   187 						
   186 						
   188 	r=TheFs.RmDir(path);
   187 	r=TheFs.RmDir(path);
   189 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   188 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   190 	
   189 	
   191 	TRequestStatus statEntry(KRequestPending);
   190 	TRequestStatus statEntry(KRequestPending);
   192 	TRequestStatus statFile(KRequestPending);
   191 	TRequestStatus statFile(KRequestPending);
   193 	TRequestStatus statDir(KRequestPending);
   192 	TRequestStatus statDir(KRequestPending);
   194 	TRequestStatus statWild(KRequestPending);
   193 	TRequestStatus statWild(KRequestPending);
   205 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   204 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   206 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   205 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   207 	TheNotifyFs.NotifyChange(ENotifyAll,statWilder,_L("*:\\"));
   206 	TheNotifyFs.NotifyChange(ENotifyAll,statWilder,_L("*:\\"));
   208 
   207 
   209 	r=TheFs.MkDir(path);										//	Creates the directory on the drive
   208 	r=TheFs.MkDir(path);										//	Creates the directory on the drive
   210 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));				//	associated with TheFs session path
   209 	test((r==KErrNone)||(r==KErrAlreadyExists));				//	associated with TheFs session path
   211 	test (statEntry==KRequestPending);
   210 	test (statEntry==KRequestPending);
   212 	test(statFile==KRequestPending);
   211 	test(statFile==KRequestPending);
   213 	test(statDir==KRequestPending);	//	No notification because it's watching a different drive!
   212 	test(statDir==KRequestPending);	//	No notification because it's watching a different drive!
   214 	test(statWild==KErrNone);	//	BUG FIX TEST
   213 	test(statWild==KErrNone);	//	BUG FIX TEST
   215 	test(statWilder==KErrNone);
   214 	test(statWilder==KErrNone);
   223 	filePath=path;
   222 	filePath=path;
   224 	filePath+=_L("TestFile.app");
   223 	filePath+=_L("TestFile.app");
   225 	RFile file;
   224 	RFile file;
   226 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   225 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   227 	file.Close();
   226 	file.Close();
   228 	test_KErrNone(r);
   227 	test(r==KErrNone);
   229 
   228 
   230 	test (statEntry==KRequestPending);	//	No notification!
   229 	test (statEntry==KRequestPending);	//	No notification!
   231 	test(statFile==KRequestPending);
   230 	test(statFile==KRequestPending);
   232 	test(statDir==KRequestPending);	
   231 	test(statDir==KRequestPending);	
   233 	test(statWild==KErrNone);
   232 	test(statWild==KErrNone);
   236 //	No need to resubmit notify change requests	
   235 //	No need to resubmit notify change requests	
   237 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   236 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   238 	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   237 	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   239 
   238 
   240 	r=TheFs.Delete(filePath);
   239 	r=TheFs.Delete(filePath);
   241 	test_KErrNone(r);
   240 	test(r==KErrNone);
   242 //	Still no notification	
   241 //	Still no notification	
   243 	test (statEntry==KRequestPending);
   242 	test (statEntry==KRequestPending);
   244 	test(statFile==KRequestPending);
   243 	test(statFile==KRequestPending);
   245 	test(statDir==KRequestPending);
   244 	test(statDir==KRequestPending);
   246 	test(statWild==KErrNone);
   245 	test(statWild==KErrNone);
   249 //	No need to resubmit notify change requests	
   248 //	No need to resubmit notify change requests	
   250 	test.Next(_L("Remove the directory"));
   249 	test.Next(_L("Remove the directory"));
   251 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   250 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   252 //	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   251 //	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   253 	r=TheFs.RmDir(path);
   252 	r=TheFs.RmDir(path);
   254 	test_KErrNone(r);
   253 	test(r==KErrNone);
   255 //	Still no notification	
   254 //	Still no notification	
   256 	test (statEntry==KRequestPending);
   255 	test (statEntry==KRequestPending);
   257 	test(statFile==KRequestPending);
   256 	test(statFile==KRequestPending);
   258 	test(statDir==KRequestPending);
   257 	test(statDir==KRequestPending);
   259 	test(statWild==KErrNone);
   258 	test(statWild==KErrNone);
   270 //
   269 //
   271 	{
   270 	{
   272 	TFileName path;
   271 	TFileName path;
   273 	path=_L("\\F32-TST\\T_APPINS\\");
   272 	path=_L("\\F32-TST\\T_APPINS\\");
   274 	TInt r=TheFs.RmDir(path);
   273 	TInt r=TheFs.RmDir(path);
   275 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   274 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   276 	
   275 	
   277 	TRequestStatus statEntry(KRequestPending);
   276 	TRequestStatus statEntry(KRequestPending);
   278 	TRequestStatus statFile(KRequestPending);
   277 	TRequestStatus statFile(KRequestPending);
   279 	TRequestStatus statDir(KRequestPending);
   278 	TRequestStatus statDir(KRequestPending);
   280 	TRequestStatus statWild(KRequestPending);
   279 	TRequestStatus statWild(KRequestPending);
   282 
   281 
   283 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   282 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   284 //	Set the session path of the session	which creates the file/directory to be
   283 //	Set the session path of the session	which creates the file/directory to be
   285 //	the same as the notification session's session path
   284 //	the same as the notification session's session path
   286 	r=TheFs.SetSessionPath(gSessionPath);
   285 	r=TheFs.SetSessionPath(gSessionPath);
   287 	test_KErrNone(r);
   286 	test(r==KErrNone);
   288 
   287 
   289 //	Submit notify change requests (requesting ahead)
   288 //	Submit notify change requests (requesting ahead)
   290 	test.Printf(_L("Create a directory %S\n"),&path);
   289 	test.Printf(_L("Create a directory %S\n"),&path);
   291 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   290 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   292 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   291 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   293 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   292 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   294 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   293 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   295 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   294 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   296 
   295 
   297 	r=TheFs.MkDir(path);	
   296 	r=TheFs.MkDir(path);	
   298 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   297 	test((r==KErrNone)||(r==KErrAlreadyExists));
   299 	User::WaitForAnyRequest();
   298 	User::WaitForAnyRequest();
   300 	test (statEntry==KErrNone);
   299 	test (statEntry==KErrNone);
   301 	test(statFile==KErrNone);
   300 	test(statFile==KErrNone);
   302 	test(statDir==KErrNone);
   301 	test(statDir==KErrNone);
   303 	test(statWild==KErrNone);
   302 	test(statWild==KErrNone);
   317 	filePath+=_L("TestFile.app");
   316 	filePath+=_L("TestFile.app");
   318 	RFile file;
   317 	RFile file;
   319 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   318 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   320 	file.Close();
   319 	file.Close();
   321 	User::WaitForAnyRequest();
   320 	User::WaitForAnyRequest();
   322 	test_KErrNone(r);
   321 	test(r==KErrNone);
   323 	test (statEntry==KErrNone);
   322 	test (statEntry==KErrNone);
   324 	test(statFile==KErrNone);
   323 	test(statFile==KErrNone);
   325 	test(statDir==KRequestPending);	
   324 	test(statDir==KRequestPending);	
   326 	test(statWild==KErrNone);
   325 	test(statWild==KErrNone);
   327 	test(statWilder==KErrNone);
   326 	test(statWilder==KErrNone);
   332 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   331 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   333 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   332 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   334 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   333 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   335 
   334 
   336 	r=TheFs.Delete(filePath);
   335 	r=TheFs.Delete(filePath);
   337 	test_KErrNone(r);
   336 	test(r==KErrNone);
   338 	User::WaitForAnyRequest();
   337 	User::WaitForAnyRequest();
   339 	test (statEntry==KErrNone);
   338 	test (statEntry==KErrNone);
   340 	test(statFile==KErrNone);
   339 	test(statFile==KErrNone);
   341 	test(statDir==KRequestPending);
   340 	test(statDir==KRequestPending);
   342 	test(statWild==KErrNone);
   341 	test(statWild==KErrNone);
   348 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   347 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   349 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   348 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   350 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   349 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   351 
   350 
   352 	r=TheFs.RmDir(path);
   351 	r=TheFs.RmDir(path);
   353 	test_KErrNone(r);
   352 	test(r==KErrNone);
   354 	User::WaitForAnyRequest();
   353 	User::WaitForAnyRequest();
   355 	test (statEntry==KErrNone);
   354 	test (statEntry==KErrNone);
   356 	test(statFile==KRequestPending);
   355 	test(statFile==KRequestPending);
   357 	test(statDir==KErrNone);
   356 	test(statDir==KErrNone);
   358 	test(statWild==KErrNone);
   357 	test(statWild==KErrNone);
   373 	TFileName path;
   372 	TFileName path;
   374 	TBuf<23> pathBuf=_L("?:\\F32-TST\\T_APPINS\\");
   373 	TBuf<23> pathBuf=_L("?:\\F32-TST\\T_APPINS\\");
   375 	
   374 	
   376 	TChar driveChar;
   375 	TChar driveChar;
   377 	TInt r=RFs::DriveToChar(RemovableDrive,driveChar);
   376 	TInt r=RFs::DriveToChar(RemovableDrive,driveChar);
   378 	test_KErrNone(r);
   377 	test(r==KErrNone);
   379 	
   378 	
   380 	if (gDriveToTest =='C')
   379 	if (gDriveToTest =='C')
   381 		pathBuf[0]=driveChar;
   380 		pathBuf[0]=driveChar;
   382 	else
   381 	else
   383 		pathBuf[0] =gDriveToTest;
   382 		pathBuf[0] =gDriveToTest;
   384 	
   383 	
   385 	path = pathBuf;
   384 	path = pathBuf;
   386 	r=TheFs.RmDir(path);
   385 	r=TheFs.RmDir(path);
   387 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   386 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   388 		
   387 		
   389 	TInt result;
   388 	TInt result;
   390 	result=TheFs.MkDir(_L("C:\\SILLY\\"));
   389 	result=TheFs.MkDir(_L("C:\\SILLY\\"));
   391 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   390 	test((result==KErrNone)||(result==KErrAlreadyExists));
   392 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\"));
   391 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\"));
   393 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   392 	test((result==KErrNone)||(result==KErrAlreadyExists));
   394 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   393 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   395 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   394 	test((result==KErrNone)||(result==KErrAlreadyExists));
   396 
   395 
   397 	result=TheNotifyFs.SetSessionPath(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   396 	result=TheNotifyFs.SetSessionPath(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   398 	test_KErrNone(result);
   397 	test(result==KErrNone);
   399 	
   398 	
   400 	result=TheNotifyFs.SessionPath(gSessionPath);
   399 	result=TheNotifyFs.SessionPath(gSessionPath);
   401 	test_KErrNone(result);
   400 	test(result==KErrNone);
   402 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   401 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   403 
   402 
   404 	TRequestStatus statEntry(KRequestPending);
   403 	TRequestStatus statEntry(KRequestPending);
   405 	TRequestStatus statFile(KRequestPending);
   404 	TRequestStatus statFile(KRequestPending);
   406 	TRequestStatus statDir(KRequestPending);
   405 	TRequestStatus statDir(KRequestPending);
   410 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   409 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   411 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   410 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   412 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   411 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   413 
   412 
   414 	r=TheFs.MkDir(path);	
   413 	r=TheFs.MkDir(path);	
   415 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   414 	test((r==KErrNone)||(r==KErrAlreadyExists));
   416 	User::WaitForAnyRequest();
   415 	User::WaitForAnyRequest();
   417 	test (statEntry==KErrNone);
   416 	test (statEntry==KErrNone);
   418 	test(statFile==KErrNone);
   417 	test(statFile==KErrNone);
   419 	test(statDir==KErrNone);
   418 	test(statDir==KErrNone);
   420 
   419 
   429 	filePath+=_L("TestFile.app");
   428 	filePath+=_L("TestFile.app");
   430 	RFile file;
   429 	RFile file;
   431 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   430 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   432 	file.Close();
   431 	file.Close();
   433 	User::WaitForAnyRequest();
   432 	User::WaitForAnyRequest();
   434 	test_KErrNone(r);
   433 	test(r==KErrNone);
   435 	test (statEntry==KErrNone);
   434 	test (statEntry==KErrNone);
   436 	test(statFile==KErrNone);
   435 	test(statFile==KErrNone);
   437 	test(statDir==KRequestPending);
   436 	test(statDir==KRequestPending);
   438 
   437 
   439 //	Resubmit notify change requests	
   438 //	Resubmit notify change requests	
   440 	test.Next(_L("Remove the file from the directory"));
   439 	test.Next(_L("Remove the file from the directory"));
   441 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   440 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   442 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   441 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   443 	
   442 	
   444 	r=TheFs.Delete(filePath);
   443 	r=TheFs.Delete(filePath);
   445 	test_KErrNone(r);
   444 	test(r==KErrNone);
   446 	User::WaitForAnyRequest();
   445 	User::WaitForAnyRequest();
   447 	test (statEntry==KErrNone);
   446 	test (statEntry==KErrNone);
   448 	test(statFile==KErrNone);
   447 	test(statFile==KErrNone);
   449 	test(statDir==KRequestPending);
   448 	test(statDir==KRequestPending);
   450 
   449 
   451 //	Resubmit notify change requests	
   450 //	Resubmit notify change requests	
   452 	test.Next(_L("Remove the directory"));
   451 	test.Next(_L("Remove the directory"));
   453 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   452 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   454 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   453 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   455 	r=TheFs.RmDir(path);
   454 	r=TheFs.RmDir(path);
   456 	test_KErrNone(r);
   455 	test(r==KErrNone);
   457 	User::WaitForAnyRequest();
   456 	User::WaitForAnyRequest();
   458 	test (statEntry==KErrNone);
   457 	test (statEntry==KErrNone);
   459 	test(statFile==KRequestPending);
   458 	test(statFile==KRequestPending);
   460 	test(statDir==KErrNone);
   459 	test(statDir==KErrNone);
   461 
   460 
   462 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   461 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   463 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   462 	test((result==KErrNone)||(result==KErrAlreadyExists));
   464 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\"));
   463 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\"));
   465 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   464 	test((result==KErrNone)||(result==KErrAlreadyExists));
   466 	result=TheFs.RmDir(_L("C:\\SILLY\\"));
   465 	result=TheFs.RmDir(_L("C:\\SILLY\\"));
   467 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));	
   466 	test((result==KErrNone)||(result==KErrAlreadyExists));	
   468 	}
   467 	}
   469 
   468 
   470 #endif
   469 #endif
   471 LOCAL_C void DoTests()
   470 LOCAL_C void DoTests()
   472 //
   471 //
   497 		return;
   496 		return;
   498 		}
   497 		}
   499 
   498 
   500 	test.Start(_L("Testing filesystem"));
   499 	test.Start(_L("Testing filesystem"));
   501 	TInt r=TheNotifyFs.Connect();
   500 	TInt r=TheNotifyFs.Connect();
   502 	test_KErrNone(r);
   501 	test(r==KErrNone);
   503 	TFileName sessionPath;
   502 	TFileName sessionPath;
   504 	TInt uid;
   503 	TInt uid;
   505 	test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
   504 	test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
   506 	if(uid==HAL::EMachineUid_Cogent || uid==HAL::EMachineUid_IQ80310 || uid==HAL::EMachineUid_X86PC)
   505 	if(uid==HAL::EMachineUid_Cogent || uid==HAL::EMachineUid_IQ80310 || uid==HAL::EMachineUid_X86PC)
   507 		{
   506 		{
   510 		}
   509 		}
   511 
   510 
   512 #if !defined(__WINS__)
   511 #if !defined(__WINS__)
   513 //	MARM TESTS
   512 //	MARM TESTS
   514 	r=TheFs.MkDir(_L("C:\\F32-TST\\"));
   513 	r=TheFs.MkDir(_L("C:\\F32-TST\\"));
   515 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   514 	test((r==KErrNone)||(r==KErrAlreadyExists));
   516 
   515 
   517 	if(KErrNone == TheFs.DriveList(drvList))
   516 	if(KErrNone == TheFs.DriveList(drvList))
   518 		{
   517 		{
   519 		TInt i;
   518 		TInt i;
   520 		//should be successful, otherwise it means a system w/o any drive!!!
   519 		//should be successful, otherwise it means a system w/o any drive!!!
   542 		test.Printf(_L("No Drive found! Testing discontinued.\n"));
   541 		test.Printf(_L("No Drive found! Testing discontinued.\n"));
   543 		User::Exit(KErrNone);
   542 		User::Exit(KErrNone);
   544 		}
   543 		}
   545 	
   544 	
   546 	r=RFs::DriveToChar(RemovableDrive,driveChar);
   545 	r=RFs::DriveToChar(RemovableDrive,driveChar);
   547 	test_KErrNone(r);
   546 	test(r==KErrNone);
   548 	
   547 	
   549 	if(gDriveToTest == 'C')
   548 	if(gDriveToTest == 'C')
   550 		dirBuf[0] = (TText)driveChar;
   549 		dirBuf[0] = (TText)driveChar;
   551 	else
   550 	else
   552 		dirBuf[0] = (TText)gDriveToTest;
   551 		dirBuf[0] = (TText)gDriveToTest;
   557 		test.Printf(_L("TEST REQUIRES A CF CARD - "));
   556 		test.Printf(_L("TEST REQUIRES A CF CARD - "));
   558 		//test.Printf(_L("PUT A VALID CARD IN AND PRESS A KEY..."));
   557 		//test.Printf(_L("PUT A VALID CARD IN AND PRESS A KEY..."));
   559 		//test.Getch();
   558 		//test.Getch();
   560 		r=TheFs.MkDir(dirBuf);
   559 		r=TheFs.MkDir(dirBuf);
   561 		}
   560 		}
   562 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));	
   561 	test((r==KErrNone)||(r==KErrAlreadyExists));	
   563 		
   562 		
   564 //	Set the notification session path to the test directory on C drive
   563 //	Set the notification session path to the test directory on C drive
   565 	sessionPath=_L("C:\\F32-TST\\");
   564 	sessionPath=_L("C:\\F32-TST\\");
   566 	r=TheNotifyFs.SetSessionPath(sessionPath);
   565 	r=TheNotifyFs.SetSessionPath(sessionPath);
   567 	test_KErrNone(r);
   566 	test(r==KErrNone);
   568 //	Run tests
   567 //	Run tests
   569 	TRAP(r,DoTests());
   568 	TRAP(r,DoTests());
   570 	if (r!=KErrNone)
   569 	if (r!=KErrNone)
   571 		test.Printf(_L("Error: %d\n"),r);
   570 		test.Printf(_L("Error: %d\n"),r);
   572 	Test4();
   571 	Test4();
   578 	else
   577 	else
   579 		sessionPath[0] = (TText)gDriveToTest;
   578 		sessionPath[0] = (TText)gDriveToTest;
   580 		
   579 		
   581 
   580 
   582 	r=TheNotifyFs.SetSessionPath(sessionPath);
   581 	r=TheNotifyFs.SetSessionPath(sessionPath);
   583 	test_KErrNone(r);
   582 	test(r==KErrNone);
   584 
   583 
   585 	test_KErrNone(r);
   584 	test(r==KErrNone);
   586 	TRAP(r,DoTests());
   585 	TRAP(r,DoTests());
   587 	if (r!=KErrNone)
   586 	if (r!=KErrNone)
   588 		test.Printf(_L("Error: %d\n"),r);
   587 		test.Printf(_L("Error: %d\n"),r);
   589 	Test4();
   588 	Test4();
   590 	CheckDisk();
   589 	CheckDisk();
   591 #elif defined (__WINS__)
   590 #elif defined (__WINS__)
   592 	r=TheFs.MkDir(_L("X:\\F32-TST\\"));
   591 	r=TheFs.MkDir(_L("X:\\F32-TST\\"));
   593 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   592 	test((r==KErrNone)||(r==KErrAlreadyExists));
   594 	r=TheFs.MkDir(_L("Y:\\F32-TST\\"));
   593 	r=TheFs.MkDir(_L("Y:\\F32-TST\\"));
   595 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   594 	test((r==KErrNone)||(r==KErrAlreadyExists));
   596 //	Set session path to test directory on Y drive
   595 //	Set session path to test directory on Y drive
   597 	r=TheNotifyFs.SetSessionPath(_L("Y:\\F32-TST\\"));
   596 	r=TheNotifyFs.SetSessionPath(_L("Y:\\F32-TST\\"));
   598 	test_KErrNone(r);
   597 	test(r==KErrNone);
   599 	TRAP(r,DoTests());
   598 	TRAP(r,DoTests());
   600 	if (r!=KErrNone)
   599 	if (r!=KErrNone)
   601 		test.Printf(_L("Error: %d\n"),r);
   600 		test.Printf(_L("Error: %d\n"),r);
   602 
   601 
   603 	CheckDisk();
   602 	CheckDisk();
   604 
   603 
   605 	//we have no X drive on eka2 yet
   604 	//we have no X drive on eka2 yet
   606 //	Set session path to test directory on X drive	
   605 //	Set session path to test directory on X drive	
   607 //	r=TheNotifyFs.SetSessionPath(_L("X:\\F32-TST\\"));
   606 //	r=TheNotifyFs.SetSessionPath(_L("X:\\F32-TST\\"));
   608 //	test_KErrNone(r);
   607 //	test(r==KErrNone);
   609 //	TRAP(r,DoTests());
   608 //	TRAP(r,DoTests());
   610 
   609 
   611 	if (r!=KErrNone)
   610 	if (r!=KErrNone)
   612 		test.Printf(_L("Error: %d\n"),r);
   611 		test.Printf(_L("Error: %d\n"),r);
   613 
   612