os/kernelhwsrv/kerneltest/f32test/server/t_locate.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32test\server\t_locate.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
#define __E32TEST_EXTENSION__
sl@0
    18
#include <f32file.h>
sl@0
    19
#include <e32test.h>
sl@0
    20
#include "t_server.h"
sl@0
    21
sl@0
    22
sl@0
    23
sl@0
    24
GLDEF_D RTest test(_L("T_LOCATE"));
sl@0
    25
sl@0
    26
LOCAL_D TFileName gPath1;
sl@0
    27
LOCAL_D TFileName gPath2;
sl@0
    28
LOCAL_D TFileName gPath3;
sl@0
    29
LOCAL_D TFileName gPath4;
sl@0
    30
LOCAL_D TFileName gPath5;
sl@0
    31
sl@0
    32
sl@0
    33
LOCAL_D TFileName gRemovableDriveFile;
sl@0
    34
LOCAL_D TFileName gInternalDriveFile;
sl@0
    35
LOCAL_D TFileName gInternalDriveFile2;
sl@0
    36
sl@0
    37
sl@0
    38
LOCAL_D TChar removableDriveLetter;  
sl@0
    39
LOCAL_D TChar internalDriveLetter; 
sl@0
    40
sl@0
    41
sl@0
    42
LOCAL_D TInt removableFlag=0;
sl@0
    43
LOCAL_D TInt internalFlag=0;
sl@0
    44
sl@0
    45
sl@0
    46
sl@0
    47
LOCAL_C void Md(const TDesC& aDirName)
sl@0
    48
//
sl@0
    49
// Make a dir
sl@0
    50
//
sl@0
    51
	{
sl@0
    52
sl@0
    53
	TInt r=TheFs.MkDirAll(aDirName);
sl@0
    54
	if (r == KErrCorrupt)
sl@0
    55
		test.Printf(_L("Media corruption; previous test may have aborted; else, check hardware\n"));
sl@0
    56
	else if (r == KErrNotReady)
sl@0
    57
		test.Printf(_L("No medium present / drive not ready, previous test may have hung; else, check hardware\n"));
sl@0
    58
	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
sl@0
    59
	}
sl@0
    60
sl@0
    61
LOCAL_C void Mf(const TDesC& aFileName)
sl@0
    62
//
sl@0
    63
// Make a file
sl@0
    64
//
sl@0
    65
	{
sl@0
    66
sl@0
    67
	RFile file;
sl@0
    68
	TInt r = file.Replace(TheFs,aFileName,0);
sl@0
    69
	if (r == KErrPathNotFound)
sl@0
    70
		{
sl@0
    71
		test.Printf(_L("Mf: Path Not Found\n"));
sl@0
    72
		Md(aFileName);
sl@0
    73
		r=file.Replace(TheFs,aFileName,0);
sl@0
    74
		}
sl@0
    75
sl@0
    76
	if (r == KErrCorrupt)
sl@0
    77
		test.Printf(_L("Media corruption; previous test may have aborted; else, check hardware\n"));
sl@0
    78
	else if (r == KErrNotReady)
sl@0
    79
		test.Printf(_L("No medium present / drive not ready, previous test may have hung; else, check hardware\n"));
sl@0
    80
sl@0
    81
	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
sl@0
    82
	file.Close();
sl@0
    83
	}
sl@0
    84
sl@0
    85
LOCAL_C void MakeLocateTestDirectoryStructure()
sl@0
    86
//
sl@0
    87
// Create files for test
sl@0
    88
//
sl@0
    89
	{
sl@0
    90
	test.Next(_L("Create LOCTEST directories"));
sl@0
    91
	Md(_L("\\F32-TST\\LOCTEST\\BIN1\\"));
sl@0
    92
	Md(_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
    93
	Md(_L("\\F32-TST\\LOCTEST\\BIN3\\"));
sl@0
    94
	Md(_L("\\F32-TST\\LOCTEST\\BIN1\\BIN4\\"));
sl@0
    95
		
sl@0
    96
	
sl@0
    97
	
sl@0
    98
#if defined(_DEBUG)
sl@0
    99
	TheFs.SetErrorCondition(-47,5);
sl@0
   100
	TDriveInfo drive;
sl@0
   101
	for (TInt i=0;i<5;i++)
sl@0
   102
		{
sl@0
   103
		TInt r=TheFs.Drive(drive);
sl@0
   104
		test(r==KErrNone);
sl@0
   105
		}
sl@0
   106
	TInt r=TheFs.MkDirAll(_L("alskdjfl"));
sl@0
   107
	test(r==-47);
sl@0
   108
	r=TheFs.MkDirAll(_L("alskdjfl"));
sl@0
   109
	test(r==-47);
sl@0
   110
	TheFs.SetErrorCondition(KErrNone);
sl@0
   111
	r=TheFs.Drive(drive);
sl@0
   112
	test(r==KErrNone);
sl@0
   113
#endif
sl@0
   114
//
sl@0
   115
	test.Next(_L("Create LOCTEST files"));
sl@0
   116
	Mf(_L("\\F32-TST\\LOCTEST\\FILE1.AAA"));
sl@0
   117
	Mf(_L("\\F32-TST\\LOCTEST\\FILE2.BBB"));
sl@0
   118
	Mf(_L("\\F32-TST\\LOCTEST\\FILE3.CCC"));
sl@0
   119
	Mf(_L("\\F32-TST\\LOCTEST\\WORK.AAA"));
sl@0
   120
	Mf(_L("\\F32-TST\\LOCTEST\\HOME.CCC"));
sl@0
   121
	Mf(_L("\\F32-TST\\LOCTEST\\FILE.AAA"));
sl@0
   122
	Mf(_L("C:\\F32-TST\\LOCTEST\\BIN1\\FILE1.AAA"));
sl@0
   123
	Mf(_L("C:\\F32-TST\\LOCTEST\\BIN1\\WORK.AAA"));
sl@0
   124
	Mf(_L("C:\\F32-TST\\LOCTEST\\BIN1\\WORK.BBB"));
sl@0
   125
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\FILE1.AAA"));
sl@0
   126
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\WORK.AAA"));
sl@0
   127
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\WORK.BBB"));
sl@0
   128
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\CONFUSED.DOG"));
sl@0
   129
	Mf(_L("\\F32-TST\\LOCTEST\\BIN2\\FILE1.BBB"));
sl@0
   130
	Mf(_L("\\F32-TST\\LOCTEST\\BIN2\\WORK.BBB"));
sl@0
   131
	Mf(_L("\\F32-TST\\LOCTEST\\BIN2\\FILE2.BBB"));
sl@0
   132
	Mf(_L("\\F32-TST\\LOCTEST\\BIN2\\FILE3.BBB"));
sl@0
   133
	Mf(_L("\\F32-TST\\LOCTEST\\BIN3\\FILE3.CCC"));
sl@0
   134
	Mf(_L("\\F32-TST\\LOCTEST\\BIN3\\WORK.CCC"));
sl@0
   135
	Mf(_L("\\F32-TST\\LOCTEST\\BIN3\\PLAY.CCC"));
sl@0
   136
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\BIN4\\FILE1.AAA"));
sl@0
   137
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\BIN4\\FILE2.BBB"));
sl@0
   138
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\BIN4\\FILE3.CCC"));
sl@0
   139
	Mf(_L("\\F32-TST\\LOCTEST\\BIN1\\BIN4\\FILE4.DDD"));
sl@0
   140
	
sl@0
   141
	
sl@0
   142
	
sl@0
   143
	}
sl@0
   144
	
sl@0
   145
sl@0
   146
LOCAL_C void CreateFilesInRemovableDrive()	
sl@0
   147
	{
sl@0
   148
	
sl@0
   149
sl@0
   150
    TInt err;
sl@0
   151
    TDriveList driveList;
sl@0
   152
    TDriveInfo info;
sl@0
   153
sl@0
   154
	 err = TheFs.DriveList(driveList);
sl@0
   155
    test( err == KErrNone );
sl@0
   156
    
sl@0
   157
    for (TInt i = 0; i < KMaxDrives; i++) 
sl@0
   158
        {
sl@0
   159
        
sl@0
   160
        if (driveList[i]) 
sl@0
   161
            {
sl@0
   162
            err = TheFs.Drive(info, i);
sl@0
   163
            test( err == KErrNone ); 
sl@0
   164
                        
sl@0
   165
            if( info.iDriveAtt  & KDriveAttRemovable )  
sl@0
   166
            	{
sl@0
   167
								
sl@0
   168
				if ( ( info.iType != EMediaNotPresent) && (info.iType != EMediaUnknown) && (info.iType != EMediaCdRom) )
sl@0
   169
					{
sl@0
   170
					TheFs.DriveToChar(i,removableDriveLetter) ;
sl@0
   171
					gRemovableDriveFile.Append (removableDriveLetter);
sl@0
   172
					gRemovableDriveFile.Append (_L(":\\F32-TST\\LOCTEST\\BIN\\FINDFILE.AAA") );
sl@0
   173
sl@0
   174
					Mf(gRemovableDriveFile);
sl@0
   175
					removableFlag=1;
sl@0
   176
					break;
sl@0
   177
					}
sl@0
   178
				else 
sl@0
   179
					continue;
sl@0
   180
      				
sl@0
   181
 
sl@0
   182
            	}
sl@0
   183
           				
sl@0
   184
            
sl@0
   185
            }
sl@0
   186
    
sl@0
   187
        }
sl@0
   188
sl@0
   189
	}
sl@0
   190
	
sl@0
   191
	
sl@0
   192
sl@0
   193
LOCAL_C void CreateFilesInInternalDrive()	
sl@0
   194
	{
sl@0
   195
	
sl@0
   196
    TInt err;
sl@0
   197
    TDriveList driveList;
sl@0
   198
    TDriveInfo info;
sl@0
   199
sl@0
   200
	 err = TheFs.DriveList(driveList);
sl@0
   201
    test( err == KErrNone );
sl@0
   202
    
sl@0
   203
    for (TInt i = 0; i < KMaxDrives; i++) 
sl@0
   204
        {
sl@0
   205
        
sl@0
   206
        if (driveList[i]) 
sl@0
   207
            {
sl@0
   208
            err = TheFs.Drive(info, i);
sl@0
   209
            test( err == KErrNone ); 
sl@0
   210
                        
sl@0
   211
            if( info.iDriveAtt  & KDriveAttInternal  ) 
sl@0
   212
            	{			
sl@0
   213
				
sl@0
   214
				TheFs.DriveToChar(i,internalDriveLetter) ;
sl@0
   215
				gInternalDriveFile.Append (internalDriveLetter);
sl@0
   216
				gInternalDriveFile.Append (_L(":\\F32-TST\\LOCTEST\\BIN\\INT\\FINDINTERNALFILE.AAA") );
sl@0
   217
				
sl@0
   218
				gInternalDriveFile2.Append (internalDriveLetter);
sl@0
   219
				gInternalDriveFile2.Append (_L(":\\F32-TST\\LOCTEST\\BIN\\INT\\FINDINTERNALFILE_B.AAA") );
sl@0
   220
				
sl@0
   221
				Mf(gInternalDriveFile);
sl@0
   222
				Mf(gInternalDriveFile2);
sl@0
   223
				internalFlag=1;	
sl@0
   224
 				
sl@0
   225
            	break;
sl@0
   226
            	}
sl@0
   227
            
sl@0
   228
            }
sl@0
   229
    
sl@0
   230
        }
sl@0
   231
	
sl@0
   232
	
sl@0
   233
	}
sl@0
   234
	
sl@0
   235
sl@0
   236
sl@0
   237
sl@0
   238
LOCAL_C void DeleteRemovableDirectory()
sl@0
   239
	{	
sl@0
   240
sl@0
   241
	//Delete the directory structure we created in the removalbe drive	
sl@0
   242
	if ( removableFlag == 1 )
sl@0
   243
		{
sl@0
   244
		CFileMan* fMan=CFileMan::NewL(TheFs);
sl@0
   245
		test(fMan!=NULL);
sl@0
   246
	
sl@0
   247
		TFileName gPathRem;
sl@0
   248
		gPathRem.Append (removableDriveLetter);
sl@0
   249
		gPathRem.Append (_L(":\\F32-TST\\") );
sl@0
   250
		TInt r=fMan->RmDir(gPathRem);
sl@0
   251
		test(r==KErrNone);
sl@0
   252
	
sl@0
   253
		delete fMan;
sl@0
   254
		}
sl@0
   255
	}
sl@0
   256
sl@0
   257
LOCAL_C void DeleteInternalDirectory()
sl@0
   258
	{	
sl@0
   259
sl@0
   260
	//Delete the directory structure we created in the internal drive		
sl@0
   261
sl@0
   262
sl@0
   263
	if( internalFlag == 1 )
sl@0
   264
		{
sl@0
   265
		CFileMan* fMan=CFileMan::NewL(TheFs);
sl@0
   266
		test(fMan!=NULL);
sl@0
   267
	
sl@0
   268
		TFileName gPathInt;
sl@0
   269
		gPathInt.Append (internalDriveLetter);
sl@0
   270
		gPathInt.Append (_L(":\\F32-TST\\") );
sl@0
   271
		TInt r=fMan->RmDir(gPathInt);
sl@0
   272
		test(r==KErrNone);
sl@0
   273
	
sl@0
   274
		delete fMan;
sl@0
   275
		}
sl@0
   276
	}
sl@0
   277
sl@0
   278
	
sl@0
   279
LOCAL_C void MountRemoteFilesystem()	
sl@0
   280
	{
sl@0
   281
		
sl@0
   282
  	test.Next(_L("Mount Remote Drive simulator on Q:\n"));
sl@0
   283
	
sl@0
   284
	
sl@0
   285
	TInt r=TheFs.AddFileSystem(_L("CFAFSDLY"));
sl@0
   286
	test.Printf(_L("Add remote file system\n"));
sl@0
   287
	test.Printf(_L("AddFileSystem returned %d\n"),r);
sl@0
   288
	test (r==KErrNone || r==KErrAlreadyExists);
sl@0
   289
sl@0
   290
sl@0
   291
	r=TheFs.MountFileSystem(_L("DELAYFS"),EDriveQ);
sl@0
   292
sl@0
   293
	
sl@0
   294
	test.Printf(_L("Mount remote file system\n"));
sl@0
   295
	test.Printf(_L("MountFileSystem returned %d\n"),r);
sl@0
   296
	test(r==KErrNone || r==KErrCorrupt || r==KErrNotReady || r==KErrAlreadyExists);
sl@0
   297
sl@0
   298
	
sl@0
   299
	Mf(_L("Q:\\F32-TST\\LOCTEST\\BIN\\FINDFILE.AAA"));
sl@0
   300
sl@0
   301
	}
sl@0
   302
	
sl@0
   303
sl@0
   304
	
sl@0
   305
LOCAL_C void DisMountRemoteFilesystem()	
sl@0
   306
	{
sl@0
   307
sl@0
   308
	test.Printf(_L("Dismounting the remote Drives \n"));
sl@0
   309
 	
sl@0
   310
 	TInt r=TheFs.DismountFileSystem(_L("DELAYFS"),EDriveQ);
sl@0
   311
 	 
sl@0
   312
 	test.Printf(_L("Dismounting the Remote Drive returned %d\n"),r);
sl@0
   313
 	
sl@0
   314
 	test(r==KErrNone );
sl@0
   315
	}
sl@0
   316
sl@0
   317
sl@0
   318
	
sl@0
   319
sl@0
   320
LOCAL_C void Test1()
sl@0
   321
//
sl@0
   322
// Do simple tests
sl@0
   323
//
sl@0
   324
	{
sl@0
   325
	test.Next(_L("Test FindByPath"));
sl@0
   326
	
sl@0
   327
	TAutoClose<RFs> fs;
sl@0
   328
	TInt r=fs.iObj.Connect();
sl@0
   329
	test(r==KErrNone);
sl@0
   330
	TFindFile finder(fs.iObj);
sl@0
   331
	TPtrC path=gPath1;
sl@0
   332
	r=finder.FindByPath(_L("file1.aaa"),&path);
sl@0
   333
	test(r==KErrNone);
sl@0
   334
	TParse fileParse;
sl@0
   335
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   336
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN1\\"));
sl@0
   337
	test(fileParse.NameAndExt()==_L("file1.aaa"));
sl@0
   338
	r=finder.Find();
sl@0
   339
	test(r==KErrNotFound);
sl@0
   340
sl@0
   341
sl@0
   342
	path.Set(gPath2);
sl@0
   343
	r=finder.FindByPath(_L("file1.aaa"),&path);
sl@0
   344
	test(r==KErrNone);
sl@0
   345
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   346
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN1\\"));
sl@0
   347
	test(fileParse.NameAndExt()==_L("file1.aaa"));
sl@0
   348
	r=finder.Find();
sl@0
   349
	test(r==KErrNone);
sl@0
   350
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   351
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN1\\BIN4\\"));
sl@0
   352
	test(fileParse.NameAndExt()==_L("file1.aaa"));
sl@0
   353
	r=finder.Find();
sl@0
   354
	test(r==KErrNotFound);
sl@0
   355
//
sl@0
   356
	test.Next(_L("Test FindByDir"));
sl@0
   357
	TPtrC dir=_L("\\F32-TST\\LOCTEST\\BIN2\\");
sl@0
   358
	r=finder.FindByDir(_L("file2.bbb"),dir);
sl@0
   359
	test(r==KErrNone);
sl@0
   360
	TFileName defaultPath;
sl@0
   361
	r=TheFs.SessionPath(defaultPath);
sl@0
   362
	defaultPath.SetLength(2);
sl@0
   363
	test(r==KErrNone);
sl@0
   364
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   365
	test(fileParse.Drive()==defaultPath);
sl@0
   366
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
   367
	test(_L("file2.bbb").MatchF(fileParse.NameAndExt())!=KErrNotFound); // MatchF only sees wildcards in its argument
sl@0
   368
	r=finder.Find();
sl@0
   369
	if (r==KErrNone)
sl@0
   370
		{
sl@0
   371
		fileParse.Set(finder.File(),NULL,NULL);
sl@0
   372
		if (defaultPath==_L("C:"))
sl@0
   373
			test(fileParse.Drive()==_L("Y:"));
sl@0
   374
		else
sl@0
   375
			test(fileParse.Drive()==_L("C:"));
sl@0
   376
		test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
   377
		test(_L("file2.bbb").MatchF(fileParse.NameAndExt())!=KErrNotFound);
sl@0
   378
		r=finder.Find();
sl@0
   379
		}
sl@0
   380
	test(r==KErrNotFound);
sl@0
   381
	}
sl@0
   382
sl@0
   383
LOCAL_C void Test2()
sl@0
   384
//
sl@0
   385
// Test extremes
sl@0
   386
//
sl@0
   387
	{
sl@0
   388
sl@0
   389
	test.Next(_L("Test extremes"));
sl@0
   390
	TAutoClose<RFs> fs;
sl@0
   391
	TInt r=fs.iObj.Connect();
sl@0
   392
	test(r==KErrNone);
sl@0
   393
	TBuf<4> temp=_L("");
sl@0
   394
	TFindFile finder(fs.iObj);
sl@0
   395
	r=finder.FindByPath(_L("file1.aaa"),&temp);
sl@0
   396
	test(r==KErrNotFound);
sl@0
   397
	r=finder.Find();
sl@0
   398
	test(r==KErrNotFound);
sl@0
   399
//
sl@0
   400
	TPtrC path=_L("blarg.7");
sl@0
   401
	r=finder.FindByPath(_L(""),&path);	
sl@0
   402
	test(r==KErrArgument);
sl@0
   403
	r=finder.FindByPath(_L("*"),&path);
sl@0
   404
	test(r==KErrNotFound);
sl@0
   405
	r=finder.FindByPath(_L("xmvid"),&path);
sl@0
   406
	test(r==KErrNotFound);
sl@0
   407
	r=finder.Find();
sl@0
   408
	test(r==KErrNotFound);
sl@0
   409
//
sl@0
   410
	path.Set(_L("C:\\F32-TST\\LOCTEST\\BIN1\\;\\F32-TST\\LOCTEST\\BIN2\\;Z:\\F32-TST\\LOCTEST\\BIN1\\BIN4\\;\\F32-TST\\LOCTEST\\BIN3\\;"));
sl@0
   411
	r=finder.FindByPath(_L(""),&path);
sl@0
   412
	test(r==KErrArgument);
sl@0
   413
	r=finder.FindByPath(_L("xyz.abc"),&path);
sl@0
   414
	test(r==KErrNotFound);
sl@0
   415
	r=finder.Find();
sl@0
   416
	test(r==KErrNotFound);
sl@0
   417
	
sl@0
   418
	test.Next(_L("Test FindByDir with empty file spec"));
sl@0
   419
	TPtrC dir2=_L("\\F32-TST\\LOCTEST\\");
sl@0
   420
	r=finder.FindByDir(_L(""),dir2);
sl@0
   421
	test(r==KErrArgument);		
sl@0
   422
	
sl@0
   423
	}
sl@0
   424
sl@0
   425
LOCAL_C void Test3()
sl@0
   426
//
sl@0
   427
// Test FindByDrives in a path=_L("c:\xyz;z:\lmnop;\abc;\y:\help");
sl@0
   428
//
sl@0
   429
	{
sl@0
   430
sl@0
   431
	test.Next(_L("Test FindInDrivesByPath"));
sl@0
   432
	TPtrC path=_L("\\F32-TST\\LOCTEST\\BIN2\\");
sl@0
   433
	TFileName defaultPath;
sl@0
   434
	TInt r=TheFs.SessionPath(defaultPath);
sl@0
   435
	defaultPath.SetLength(2);
sl@0
   436
//
sl@0
   437
	TAutoClose<RFs> fs;
sl@0
   438
	r=fs.iObj.Connect();
sl@0
   439
	test(r==KErrNone);
sl@0
   440
	TFindFile finder(fs.iObj);
sl@0
   441
	r=finder.FindByPath(_L("file1.aaa"),&path);
sl@0
   442
	test(r==KErrNotFound);
sl@0
   443
	r=finder.Find();
sl@0
   444
	test(r==KErrNotFound);
sl@0
   445
//
sl@0
   446
	path.Set(_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
   447
	r=finder.FindByPath(_L("file2.bbb"),&path);
sl@0
   448
	test(r==KErrNone);
sl@0
   449
	TParse fileParse;
sl@0
   450
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   451
	test(fileParse.Drive()==defaultPath);
sl@0
   452
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
   453
	test(fileParse.NameAndExt()==_L("file2.bbb"));
sl@0
   454
	r=finder.Find();
sl@0
   455
	test(r==KErrNotFound || r==KErrNone);
sl@0
   456
	if (r==KErrNone)
sl@0
   457
		{
sl@0
   458
		fileParse.Set(finder.File(),NULL,NULL);
sl@0
   459
		test(fileParse.Drive()!=defaultPath);
sl@0
   460
		test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
   461
		test(fileParse.NameAndExt()==_L("file2.bbb"));
sl@0
   462
		r=finder.Find();
sl@0
   463
		test(r==KErrNotFound);
sl@0
   464
		}
sl@0
   465
//
sl@0
   466
	path.Set(_L("C:\\F32-TST\\LOCTEST\\BIN1\\;;\\F32-TST\\LOCTEST\\BIN2\\;Z:\\F32-TST\\LOCTEST\\BIN1\\BIN4\\;\\F32-TST\\LOCTEST\\BIN3\\;"));
sl@0
   467
	r=finder.FindByPath(_L("xyz.abc"),&path);
sl@0
   468
	test(r==KErrNotFound);
sl@0
   469
	r=finder.Find();
sl@0
   470
	test(r==KErrNotFound);
sl@0
   471
//
sl@0
   472
	r=finder.FindByPath(_L("file2.bbb"),&path);
sl@0
   473
	test(r==KErrNone);
sl@0
   474
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   475
	test(fileParse.Drive()==defaultPath);
sl@0
   476
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
   477
	test(fileParse.NameAndExt()==_L("file2.bbb"));
sl@0
   478
	r=finder.Find();
sl@0
   479
	test(r==KErrNotFound || r==KErrNone);
sl@0
   480
	if (r==KErrNone)
sl@0
   481
		{
sl@0
   482
		fileParse.Set(finder.File(),NULL,NULL);
sl@0
   483
		test(fileParse.Drive()!=defaultPath);
sl@0
   484
		test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
   485
		test(fileParse.NameAndExt()==_L("file2.bbb"));
sl@0
   486
		r=finder.Find();
sl@0
   487
		test(r==KErrNotFound);
sl@0
   488
		}
sl@0
   489
	}
sl@0
   490
sl@0
   491
LOCAL_C void Test4()
sl@0
   492
//
sl@0
   493
// Test wildcard findbypath
sl@0
   494
//
sl@0
   495
	{
sl@0
   496
sl@0
   497
	test.Next(_L("FindByPath with wild filenames"));
sl@0
   498
	TFindFile finder(TheFs);
sl@0
   499
	CDir* dir;
sl@0
   500
	TInt count;
sl@0
   501
	TEntry entry;
sl@0
   502
	TFileName path;
sl@0
   503
sl@0
   504
	TInt r=finder.FindWildByPath(_L("*.aaa"),&gPath3,dir);
sl@0
   505
	test(r==KErrNone);
sl@0
   506
	count=dir->Count();
sl@0
   507
	test(count==3);
sl@0
   508
	entry=(*dir)[0];
sl@0
   509
	test(entry.iName.MatchF(_L("FILE.AAA"))!=KErrNotFound);
sl@0
   510
	entry=(*dir)[1];
sl@0
   511
	test(entry.iName.MatchF(_L("FILE1.AAA"))!=KErrNotFound);
sl@0
   512
	entry=(*dir)[2];
sl@0
   513
	test(entry.iName.MatchF(_L("WORK.AAA"))!=KErrNotFound);
sl@0
   514
	TParse fileParse;
sl@0
   515
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   516
	path=fileParse.FullName();
sl@0
   517
	test(path==_L("*.aaa"));
sl@0
   518
	delete dir;
sl@0
   519
sl@0
   520
	r=finder.FindWild(dir);
sl@0
   521
	test(r==KErrNone);
sl@0
   522
	count=dir->Count();
sl@0
   523
	test(count==2);
sl@0
   524
	entry=(*dir)[0];
sl@0
   525
	test(entry.iName.MatchF(_L("FILE1.AAA"))!=KErrNotFound);
sl@0
   526
	entry=(*dir)[1];
sl@0
   527
	test(entry.iName.MatchF(_L("WORK.AAA"))!=KErrNotFound);
sl@0
   528
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   529
	path=fileParse.FullName();
sl@0
   530
	test(path==_L("C:\\F32-TST\\LOCTEST\\BIN1\\*.aaa"));
sl@0
   531
	delete dir;
sl@0
   532
sl@0
   533
	r=finder.FindWild(dir);
sl@0
   534
	test(r==KErrNotFound);
sl@0
   535
	r=finder.FindWild(dir);
sl@0
   536
	test(r==KErrNotFound);
sl@0
   537
sl@0
   538
	r=finder.FindWildByPath(_L("*FILE.AAA*"), &gPath1, dir);
sl@0
   539
	test(r==KErrNone);
sl@0
   540
	test(dir->Count()==1);
sl@0
   541
	entry=(*dir)[0];
sl@0
   542
	test(entry.iName.MatchF(_L("FILE.AAA"))!=KErrNotFound);
sl@0
   543
	delete dir;
sl@0
   544
	r=finder.FindWildByPath(_L("*FILE.AAA"), &gPath1, dir);
sl@0
   545
	test(r==KErrNone);
sl@0
   546
	test(dir->Count()==1);
sl@0
   547
	entry=(*dir)[0];
sl@0
   548
	test(entry.iName.MatchF(_L("FILE.AAA"))!=KErrNotFound);
sl@0
   549
	delete dir;
sl@0
   550
	r=finder.FindWildByPath(_L("FILE.AAA*"), &gPath1, dir);
sl@0
   551
	test(r==KErrNone);
sl@0
   552
	test(dir->Count()==1);
sl@0
   553
	entry=(*dir)[0];
sl@0
   554
	test(entry.iName.MatchF(_L("FILE.AAA"))!=KErrNotFound);
sl@0
   555
	delete dir;
sl@0
   556
	r=finder.FindWildByPath(_L("CONFUSED.DOG"), &gPath1, dir);
sl@0
   557
	test(r==KErrNone);
sl@0
   558
	test(dir->Count()==1);
sl@0
   559
	entry=(*dir)[0];
sl@0
   560
	test(entry.iName.MatchF(_L("CONFUSED.DOG"))!=KErrNotFound);
sl@0
   561
	delete dir;
sl@0
   562
	r=finder.FindWildByPath(_L("*CONFUSED.DOG"), &gPath1, dir);
sl@0
   563
	test(r==KErrNone);
sl@0
   564
	test(dir->Count()==1);
sl@0
   565
	entry=(*dir)[0];
sl@0
   566
	test(entry.iName.MatchF(_L("CONFUSED.DOG"))!=KErrNotFound);
sl@0
   567
	delete dir;
sl@0
   568
	r=finder.FindWildByPath(_L("CONFUSED.DOG*"), &gPath1, dir);
sl@0
   569
	test(r==KErrNone);
sl@0
   570
	test(dir->Count()==1);
sl@0
   571
	entry=(*dir)[0];
sl@0
   572
	test(entry.iName.MatchF(_L("CONFUSED.DOG"))!=KErrNotFound);
sl@0
   573
	delete dir;
sl@0
   574
	r=finder.FindWildByPath(_L("*CONFUSED.DOG*"), &gPath1, dir);
sl@0
   575
	test(r==KErrNone);
sl@0
   576
	test(dir->Count()==1);
sl@0
   577
	entry=(*dir)[0];
sl@0
   578
	test(entry.iName.MatchF(_L("CONFUSED.DOG"))!=KErrNotFound);
sl@0
   579
	delete dir;
sl@0
   580
	}
sl@0
   581
sl@0
   582
LOCAL_C void Test5()
sl@0
   583
//
sl@0
   584
// Test wildcard findbydir
sl@0
   585
//
sl@0
   586
	{
sl@0
   587
sl@0
   588
	test.Next(_L("FindByDir with wild filenames"));
sl@0
   589
	TFindFile finder(TheFs);
sl@0
   590
	CDir* dir;
sl@0
   591
	TInt count;
sl@0
   592
	TEntry entry;
sl@0
   593
	TFileName path;
sl@0
   594
sl@0
   595
	TInt r=finder.FindWildByDir(_L("FILE*"),_L("\\F32-TST\\LOCTEST\\BIN3\\"),dir);
sl@0
   596
	test(r==KErrNone);
sl@0
   597
	count=dir->Count();
sl@0
   598
	test(count==1);
sl@0
   599
	entry=(*dir)[0];
sl@0
   600
	test(entry.iName.MatchF(_L("FILE3.CCC"))!=KErrNotFound);
sl@0
   601
	TParse fileParse;
sl@0
   602
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   603
	path=fileParse.FullName();
sl@0
   604
	TFileName tpath=_L("?:\\F32-TST\\LOCTEST\\BIN3\\FILE*");
sl@0
   605
    tpath[0]=gSessionPath[0];
sl@0
   606
	test(path.CompareF(tpath)==0);
sl@0
   607
	delete dir;
sl@0
   608
sl@0
   609
	r=finder.FindWild(dir);
sl@0
   610
	if (r==KErrNotFound)
sl@0
   611
		return;
sl@0
   612
	test(r==KErrNone);
sl@0
   613
	entry=(*dir)[0];
sl@0
   614
	test(entry.iName.MatchF(_L("FILE3.CCC"))!=KErrNotFound);
sl@0
   615
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   616
	path=fileParse.FullName();
sl@0
   617
	test(path.CompareF(tpath)==0);
sl@0
   618
	delete dir;
sl@0
   619
sl@0
   620
	r=finder.FindWild(dir);
sl@0
   621
	test(r==KErrNotFound);
sl@0
   622
	r=finder.FindWild(dir);
sl@0
   623
	test(r==KErrNotFound);
sl@0
   624
	}
sl@0
   625
sl@0
   626
LOCAL_C void Test6()
sl@0
   627
//
sl@0
   628
// Test file not found
sl@0
   629
//
sl@0
   630
	{
sl@0
   631
sl@0
   632
	test.Next(_L("Test file not found"));
sl@0
   633
	TFindFile ff(TheFs);
sl@0
   634
	TInt r=ff.FindByDir(_L("NOEXIST.EXE"),_L("\\System\\Programs\\"));
sl@0
   635
	test(r==KErrNotFound);
sl@0
   636
	}
sl@0
   637
sl@0
   638
sl@0
   639
sl@0
   640
sl@0
   641
//  The following test has the requirement that the only remote drive is the one we mount 
sl@0
   642
//  during the test(DELAYFS) and which doesn't have any other attributes set. If this is not the
sl@0
   643
//  case then test conditions must be changed, in order for the test to stop failing.
sl@0
   644
// 	Even more if a removable drive is not present in the target platform then findfile.aaa
sl@0
   645
//	only exists in the remote one and this is why we have a distinction in the test results.
sl@0
   646
//
sl@0
   647
sl@0
   648
sl@0
   649
sl@0
   650
  	//--------------------------------------------- 
sl@0
   651
	//! @SYMTestCaseID			PBASE-T_LOCATE-0553
sl@0
   652
	//! @SYMTestType			UT 
sl@0
   653
	//! @SYMREQ					CR909
sl@0
   654
	//! @SYMTestCaseDesc		When using the various Find functions of class TFindFile,by default remote drives are 
sl@0
   655
	//!							excluded from the list of drives that are searched. Using function 
sl@0
   656
	//!							SetFindMask(TUint aMask) it is possible to specify a combination of attributes that
sl@0
   657
	//!						    the drives to be searched must match.
sl@0
   658
	//! @SYMTestActions			Call function FindByPath/Find without specifying a mask. Check that remote drives are not 
sl@0
   659
	//!							included. Then call SetFindMask(TUint aMask) using various combinations and verify 
sl@0
   660
	//!							that FindByPath or Find return appopriate results.
sl@0
   661
	//! @SYMTestExpectedResults	Test that file findfile.aaa is found or not depending on the specified mask.
sl@0
   662
	//! @SYMTestPriority		High
sl@0
   663
	//! @SYMTestStatus			Implemented 
sl@0
   664
	//--------------------------------------------- 
sl@0
   665
sl@0
   666
sl@0
   667
sl@0
   668
LOCAL_C void Test7()
sl@0
   669
sl@0
   670
	{
sl@0
   671
	
sl@0
   672
	TAutoClose<RFs> fs;
sl@0
   673
	TInt r=fs.iObj.Connect();
sl@0
   674
	test(r==KErrNone);
sl@0
   675
	TFindFile finder(fs.iObj);
sl@0
   676
	TPtrC path=gPath4;
sl@0
   677
	r=finder.FindByPath(_L("findfile.aaa"),&path); 	
sl@0
   678
	
sl@0
   679
	TParse fileParse;
sl@0
   680
	
sl@0
   681
	test.Next(_L("Test FindByPath without specifying any mask"));
sl@0
   682
	
sl@0
   683
	if (removableFlag == 1)
sl@0
   684
		{
sl@0
   685
			test(r==KErrNone); 
sl@0
   686
			fileParse.Set(finder.File(),NULL,NULL);
sl@0
   687
			test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN\\"));
sl@0
   688
			test(fileParse.NameAndExt()==_L("findfile.aaa")); //The filename.aaa in the removable Drive
sl@0
   689
			r=finder.Find();
sl@0
   690
			test(r==KErrNotFound);     //remote drives are excluded by default
sl@0
   691
		
sl@0
   692
		}
sl@0
   693
	else
sl@0
   694
		test(r==KErrNotFound);
sl@0
   695
sl@0
   696
	
sl@0
   697
sl@0
   698
	test.Next(_L("Search for the specified file in all Drives, including remotes ones \n"));
sl@0
   699
sl@0
   700
sl@0
   701
	r=finder.SetFindMask(	KDriveAttAll) ;
sl@0
   702
	test(r==KErrNone);
sl@0
   703
	r=finder.FindByPath(_L("findfile.aaa"),&path);
sl@0
   704
	test(r==KErrNone);
sl@0
   705
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   706
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN\\"));   
sl@0
   707
	test(fileParse.NameAndExt()==_L("findfile.aaa"));      //either the remote or removable one.
sl@0
   708
	r=finder.Find();
sl@0
   709
	
sl@0
   710
	
sl@0
   711
	if (removableFlag == 1)
sl@0
   712
		{	
sl@0
   713
		test(r==KErrNone);
sl@0
   714
	
sl@0
   715
		fileParse.Set(finder.File(),NULL,NULL);
sl@0
   716
sl@0
   717
		test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN\\"));
sl@0
   718
		test(fileParse.NameAndExt()==_L("findfile.aaa"));         //either the remote or removable one.
sl@0
   719
sl@0
   720
		r=finder.Find();
sl@0
   721
		test(r==KErrNotFound);
sl@0
   722
		}
sl@0
   723
	else 
sl@0
   724
		{
sl@0
   725
		test(r==KErrNotFound);	
sl@0
   726
			
sl@0
   727
		}
sl@0
   728
		
sl@0
   729
		
sl@0
   730
	test.Next(_L("Search exclusively in remote drives \n"));
sl@0
   731
sl@0
   732
	r=finder.SetFindMask(	KDriveAttExclusive| KDriveAttRemote); 
sl@0
   733
	test(r==KErrNone);
sl@0
   734
	r=finder.FindByPath(_L("findfile.aaa"),&path);
sl@0
   735
	test(r==KErrNone);
sl@0
   736
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   737
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN\\"));
sl@0
   738
	test(fileParse.NameAndExt()==_L("findfile.aaa"));
sl@0
   739
	r=finder.Find();
sl@0
   740
	test(r==KErrNotFound);
sl@0
   741
sl@0
   742
	
sl@0
   743
	test.Next(_L("Search excluding removables and remote \n"));
sl@0
   744
sl@0
   745
	r=finder.SetFindMask(	KDriveAttExclude | KDriveAttRemovable |KDriveAttRemote ); 
sl@0
   746
	test(r==KErrNone);
sl@0
   747
	r=finder.FindByPath(_L("findfile.aaa"),&path);   
sl@0
   748
	test(r==KErrNotFound);   //filename.aaa exists in the remote drive and if present to the removable one
sl@0
   749
sl@0
   750
sl@0
   751
	test.Next(_L("Search in Internal Drives \n"));
sl@0
   752
sl@0
   753
	r=finder.SetFindMask(KDriveAttInternal ) ;
sl@0
   754
	test(r==KErrNone);
sl@0
   755
	r=finder.FindByPath(_L("findfile.aaa"),&path);   
sl@0
   756
	test(r==KErrNotFound);   //filename.aaa exists only in the Removable drive and the remote one.
sl@0
   757
sl@0
   758
sl@0
   759
	}
sl@0
   760
sl@0
   761
	
sl@0
   762
	 //--------------------------------------------- 
sl@0
   763
	//! @SYMTestCaseID			PBASE-T_LOCATE-0554
sl@0
   764
	//! @SYMTestType			UT 
sl@0
   765
	//! @SYMREQ					CR909
sl@0
   766
	//! @SYMTestCaseDesc		Test that SetFindMask(TUint aMask) returns the correct value for all combinations of matching masks.						
sl@0
   767
	//!							
sl@0
   768
	//! @SYMTestActions			Call SetFindMask for every combination of mask and check that the correct value is returned.   
sl@0
   769
	//!							A structure is used to store the expected value for each combination.
sl@0
   770
	//! @SYMTestExpectedResults	For every combination either KErrNone or KErrArgument must be returned.
sl@0
   771
	//! @SYMTestPriority		High.
sl@0
   772
	//! @SYMTestStatus			Implemented 
sl@0
   773
	//--------------------------------------------- 
sl@0
   774
	
sl@0
   775
sl@0
   776
sl@0
   777
sl@0
   778
LOCAL_C void Test8()
sl@0
   779
sl@0
   780
	{
sl@0
   781
sl@0
   782
	test.Next(_L("Test SetFindMask with all mask combinations \n"));	
sl@0
   783
	
sl@0
   784
	
sl@0
   785
	TAutoClose<RFs> fs;
sl@0
   786
	TInt r=fs.iObj.Connect();
sl@0
   787
	test(r==KErrNone);
sl@0
   788
	TFindFile finder(fs.iObj);
sl@0
   789
	TPtrC path=gPath4;	
sl@0
   790
	TParse fileParse;
sl@0
   791
		
sl@0
   792
sl@0
   793
	r=finder.SetFindMask(KDriveAttAll) ;
sl@0
   794
	test(r==KErrNone);
sl@0
   795
	r=finder.FindByPath(_L("findfile.aaa"),&path);
sl@0
   796
	test(r==KErrNone);
sl@0
   797
	fileParse.Set(finder.File(),NULL,NULL);
sl@0
   798
	test(fileParse.Path()==_L("\\F32-TST\\LOCTEST\\BIN\\"));   
sl@0
   799
	test(fileParse.NameAndExt()==_L("findfile.aaa"));
sl@0
   800
sl@0
   801
sl@0
   802
	struct TCombinations
sl@0
   803
		{
sl@0
   804
		TUint iMatchMask;			  // The Match Mask to be combined with drive attributes
sl@0
   805
		TInt  iExpectedResultNoAtts;	  // Expected result when flag used on it's own
sl@0
   806
		TInt  iExpectedResultWithAtts;  // Expected result when flag used in combination with drive flags
sl@0
   807
		};
sl@0
   808
sl@0
   809
	TCombinations testCombinations[] = {
sl@0
   810
		{ 0,														KErrNone,     KErrNone},
sl@0
   811
		{ KDriveAttAll,												KErrNone,     KErrArgument },
sl@0
   812
		{ KDriveAttExclude,											KErrArgument, KErrNone },
sl@0
   813
		{ KDriveAttExclusive,										KErrArgument, KErrNone },
sl@0
   814
		{ KDriveAttExclude | KDriveAttExclusive,					KErrArgument, KErrNone },
sl@0
   815
		{ KDriveAttAll	   | KDriveAttExclude,						KErrArgument, KErrArgument },
sl@0
   816
		{ KDriveAttAll     | KDriveAttExclusive,					KErrArgument, KErrArgument},
sl@0
   817
		{ KDriveAttAll     | KDriveAttExclude | KDriveAttExclusive, KErrArgument, KErrArgument}};
sl@0
   818
sl@0
   819
sl@0
   820
	
sl@0
   821
	for(TUint matchIdx = 0; matchIdx < sizeof(testCombinations) / sizeof(TCombinations); matchIdx++)
sl@0
   822
		{
sl@0
   823
		test.Printf(_L("\nTest mask : KDriveAttAll[%c] KDriveAttExclude[%c] KDriveAttExclusive[%c]\n"), testCombinations[matchIdx].iMatchMask & KDriveAttAll       ? 'X' : ' ',
sl@0
   824
																										 testCombinations[matchIdx].iMatchMask & KDriveAttExclude   ? 'X' : ' ',
sl@0
   825
																										 testCombinations[matchIdx].iMatchMask & KDriveAttExclusive ? 'X' : ' ');
sl@0
   826
		for(TUint testAtt = 0; testAtt <= KMaxTUint8; testAtt++)
sl@0
   827
			{
sl@0
   828
			r= finder.SetFindMask( testCombinations[matchIdx].iMatchMask | testAtt ) ;
sl@0
   829
	 		
sl@0
   830
		//	test.Printf(_L("            ATT : 0x%08x \n"), testAtt);
sl@0
   831
		//	test.Printf(_L("Expected Result : %d     \n"), testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts);
sl@0
   832
		//	test.Printf(_L("  Actual Result : 0x%08x \n"), err);
sl@0
   833
		
sl@0
   834
		//	test.Printf(_L("\nTest mask : %d \n"),testCombinations[matchIdx].iMatchMask | testAtt );
sl@0
   835
			
sl@0
   836
			test( r == (testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts) );
sl@0
   837
			
sl@0
   838
			
sl@0
   839
			if (r== KErrNone)
sl@0
   840
				{
sl@0
   841
				r  = finder.FindByPath(_L("findfile.aaa"),&path);
sl@0
   842
				test (r== KErrNone || r ==KErrNotFound);
sl@0
   843
				}
sl@0
   844
			
sl@0
   845
			}
sl@0
   846
		}
sl@0
   847
sl@0
   848
	}
sl@0
   849
	
sl@0
   850
	
sl@0
   851
sl@0
   852
sl@0
   853
sl@0
   854
LOCAL_C void Test9()
sl@0
   855
//
sl@0
   856
// Test wildcard findbydir and FindByWildPath in Removable and Internal Drives
sl@0
   857
//
sl@0
   858
sl@0
   859
	//--------------------------------------------- 
sl@0
   860
	//! @SYMTestCaseID			PBASE-T_LOCATE-0555
sl@0
   861
	//! @SYMTestType			UT 
sl@0
   862
	//! @SYMREQ					CR909
sl@0
   863
	//! @SYMTestCaseDesc		Check that FindWildByDir and FindByDir functions behave correctly when a mask has been specified 
sl@0
   864
	//! 						through SetFindMask.
sl@0
   865
	//! @SYMTestActions			Call FindWildByDir with a filename containing wildchars and a specific path. Then call SetFindMask
sl@0
   866
	//!							to exclude Removable drives and call FindWildByDir again.Even more call FindByDir for the file in
sl@0
   867
	//!							the removable drive and for the same directory as before. 
sl@0
   868
	//! @SYMTestExpectedResults The number of files found when excluding the removable drive(if a removable drive exists in the
sl@0
   869
	//!							target platform) must differ by one. The FinByDir must find the same results.
sl@0
   870
	//! @SYMTestPriority		High
sl@0
   871
	//! @SYMTestStatus			Implemented 
sl@0
   872
	//--------------------------------------------- 
sl@0
   873
sl@0
   874
sl@0
   875
	{		
sl@0
   876
sl@0
   877
	TAutoClose<RFs> fs;
sl@0
   878
	TInt r=fs.iObj.Connect();
sl@0
   879
	test(r==KErrNone);
sl@0
   880
	
sl@0
   881
	TFindFile finder(fs.iObj);
sl@0
   882
	
sl@0
   883
	CDir* dir;
sl@0
   884
	CDir* dir3;
sl@0
   885
	
sl@0
   886
	TInt count;
sl@0
   887
	TEntry entry;	
sl@0
   888
sl@0
   889
sl@0
   890
sl@0
   891
	if ( removableFlag == 1 )
sl@0
   892
		{
sl@0
   893
		
sl@0
   894
		test.Next(_L("FindByDir with wild filenames when a find mask is specified"));
sl@0
   895
		
sl@0
   896
		TInt r=finder.SetFindMask(KDriveAttRemovable);
sl@0
   897
		test(r==KErrNone);
sl@0
   898
		r=finder.FindWildByDir(_L("FIND*"),_L("\\F32-TST\\LOCTEST\\BIN\\"),dir);
sl@0
   899
		test(r==KErrNone);
sl@0
   900
		count=dir->Count();
sl@0
   901
		test(count==1);
sl@0
   902
		entry=(*dir)[0];
sl@0
   903
		test(entry.iName.MatchF(_L("FINDFILE.AAA"))!=KErrNotFound); 
sl@0
   904
		delete dir;	
sl@0
   905
sl@0
   906
		r=finder.FindWild(dir);
sl@0
   907
		test(r==KErrNotFound);	
sl@0
   908
		
sl@0
   909
		
sl@0
   910
		r=finder.SetFindMask(KDriveAttExclude| KDriveAttRemovable);
sl@0
   911
		test(r==KErrNone);
sl@0
   912
		r=finder.FindWildByDir(_L("FIND*"),_L("\\F32-TST\\LOCTEST\\BIN\\"),dir);
sl@0
   913
		test(r==KErrNotFound);
sl@0
   914
		
sl@0
   915
		
sl@0
   916
		test.Next(_L("Test FindByDir when a find mask is specified"));
sl@0
   917
		
sl@0
   918
		
sl@0
   919
		TPtrC dir2=_L("\\F32-TST\\LOCTEST\\BIN\\");
sl@0
   920
		
sl@0
   921
		r=finder.SetFindMask(KDriveAttExclude | KDriveAttRemote );
sl@0
   922
		test(r==KErrNone);
sl@0
   923
		r=finder.FindByDir(_L("findfile.aaa"),dir2);
sl@0
   924
		test(r==KErrNone);
sl@0
   925
	
sl@0
   926
		r=finder.Find();
sl@0
   927
		test(r==KErrNotFound);	
sl@0
   928
		
sl@0
   929
sl@0
   930
		}
sl@0
   931
	
sl@0
   932
sl@0
   933
sl@0
   934
	//--------------------------------------------- 
sl@0
   935
	//! @SYMTestCaseID			PBASE-T_LOCATE-0556
sl@0
   936
	//! @SYMTestType			UT 
sl@0
   937
	//! @SYMREQ					CR909
sl@0
   938
	//! @SYMTestCaseDesc		FindByWildPath and FindByPath functions when supplied with a path that also contains 
sl@0
   939
	//!							a Drive letter, they will not need to check other Drives. Therefore calling SetFindMask 
sl@0
   940
	//!							does not affect the drives returned. 
sl@0
   941
	//! @SYMTestActions			Call FindWildByPath with an appropriate path in the internal drive. Then call SetFindMask
sl@0
   942
	//!							to exclude Internal drives and call FindWildByPath again.
sl@0
   943
	//! @SYMTestExpectedResults The number of files found in both cases must be the same since no other drive is searched.
sl@0
   944
	//! @SYMTestPriority		High
sl@0
   945
	//! @SYMTestStatus			Implemented 
sl@0
   946
	//--------------------------------------------- 
sl@0
   947
sl@0
   948
sl@0
   949
sl@0
   950
sl@0
   951
	if( internalFlag == 1 )
sl@0
   952
		{
sl@0
   953
		
sl@0
   954
		
sl@0
   955
		test.Next(_L("Test that SetFindMask does not affect Find functions that have a drive letter specified"));
sl@0
   956
		
sl@0
   957
sl@0
   958
		gPath5.Append (internalDriveLetter);
sl@0
   959
		gPath5.Append (_L(":\\F32-TST\\LOCTEST\\BIN\\INT\\") );
sl@0
   960
sl@0
   961
		
sl@0
   962
		r=finder.FindWildByPath(_L("FIND*.AAA"), &gPath5, dir3);
sl@0
   963
 		test(r==KErrNone);
sl@0
   964
		test(dir3->Count()==2);
sl@0
   965
		
sl@0
   966
		entry=(*dir3)[0];		
sl@0
   967
		test(  (entry.iName.MatchF(_L("FINDINTERNALFILE_B.AAA"))!=KErrNotFound)  || (entry.iName.MatchF(_L("FINDINTERNALFILE.AAA"))!=KErrNotFound)  );
sl@0
   968
		
sl@0
   969
				
sl@0
   970
		entry=(*dir3)[1];
sl@0
   971
		test(  (entry.iName.MatchF(_L("FINDINTERNALFILE_B.AAA"))!=KErrNotFound )  || (entry.iName.MatchF(_L("FINDINTERNALFILE.AAA"))!=KErrNotFound)  );		
sl@0
   972
sl@0
   973
		
sl@0
   974
		delete dir3;
sl@0
   975
		
sl@0
   976
		
sl@0
   977
		
sl@0
   978
		r=finder.SetFindMask(KDriveAttExclude| KDriveAttInternal);
sl@0
   979
		test(r==KErrNone);
sl@0
   980
		r=finder.FindWildByPath(_L("FIND*.AAA"), &gPath5, dir3);	
sl@0
   981
 		test(r==KErrNone);
sl@0
   982
		test(dir3->Count()==2);
sl@0
   983
		
sl@0
   984
		delete dir3;
sl@0
   985
		
sl@0
   986
		
sl@0
   987
		r=finder.FindWild(dir3);
sl@0
   988
		test(r==KErrNotFound);
sl@0
   989
				
sl@0
   990
				
sl@0
   991
		}
sl@0
   992
sl@0
   993
sl@0
   994
	}
sl@0
   995
sl@0
   996
sl@0
   997
sl@0
   998
sl@0
   999
GLDEF_C void CallTestsL()
sl@0
  1000
//
sl@0
  1001
// Do all tests
sl@0
  1002
//
sl@0
  1003
	{
sl@0
  1004
sl@0
  1005
		
sl@0
  1006
		gPath3=_L("C:\\F32-TST\\LOCTEST\\BIN1\\;C:\\F32-TST\\LOCTEST\\BIN2\\");
sl@0
  1007
sl@0
  1008
		gPath1=_L("");
sl@0
  1009
		gPath1.Append(gSessionPath[0]);
sl@0
  1010
		gPath1.Append(_L(":\\F32-TST\\LOCTEST\\BIN1\\;"));
sl@0
  1011
		gPath1.Append(gSessionPath[0]);
sl@0
  1012
		gPath1.Append(_L(":\\F32-TST\\LOCTEST\\BIN2\\"));
sl@0
  1013
	
sl@0
  1014
		gPath2=gPath1;
sl@0
  1015
		gPath2.Append(';');
sl@0
  1016
		gPath2.Append(gSessionPath[0]);
sl@0
  1017
		gPath2.Append(_L(":\\F32-TST\\LOCTEST\\BIN1\\BIN4\\;"));
sl@0
  1018
		if (gSessionPath[0]!='C')
sl@0
  1019
			gPath2.Append(gSessionPath.Left(2));
sl@0
  1020
		gPath2.Append(_L("\\F32-TST\\LOCTEST\\BIN3\\;"));
sl@0
  1021
		
sl@0
  1022
		gPath4=_L("");
sl@0
  1023
		gPath4.Append(_L("\\F32-TST\\LOCTEST\\BIN\\"));
sl@0
  1024
		
sl@0
  1025
	
sl@0
  1026
sl@0
  1027
		CreateTestDirectory(_L("\\F32-TST\\LOCTEST\\"));
sl@0
  1028
		MakeLocateTestDirectoryStructure();
sl@0
  1029
		Test1();
sl@0
  1030
		Test2();
sl@0
  1031
		Test3();
sl@0
  1032
		Test4();
sl@0
  1033
		Test5();
sl@0
  1034
		Test6();
sl@0
  1035
	
sl@0
  1036
		MountRemoteFilesystem();      
sl@0
  1037
		CreateFilesInRemovableDrive();  //used in Test7/8/9   	
sl@0
  1038
	
sl@0
  1039
		Test7();
sl@0
  1040
		Test8();
sl@0
  1041
	
sl@0
  1042
		CreateFilesInInternalDrive();  //used in Test9
sl@0
  1043
		Test9();
sl@0
  1044
			
sl@0
  1045
		DisMountRemoteFilesystem();	
sl@0
  1046
		
sl@0
  1047
		DeleteTestDirectory();
sl@0
  1048
		
sl@0
  1049
		//Explicity delete the directories created
sl@0
  1050
		DeleteRemovableDirectory();
sl@0
  1051
		DeleteInternalDirectory();
sl@0
  1052
sl@0
  1053
sl@0
  1054
	
sl@0
  1055
	}