kerneltest/f32test/server/t_scan.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #define	__E32TEST_EXTENSION__
       
    17 #include <f32file.h>
    16 #include <f32file.h>
    18 #include <e32test.h>
    17 #include <e32test.h>
    19 #include "t_server.h"
    18 #include "t_server.h"
    20 
    19 
    21 GLDEF_D RTest test(_L("T_SCAN"));
    20 GLDEF_D RTest test(_L("T_SCAN"));
    56 	MakeFile(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\HiddenFile"));
    55 	MakeFile(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\HiddenFile"));
    57 	MakeFile(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\System\\File9"));
    56 	MakeFile(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\System\\File9"));
    58 
    57 
    59 	TInt r;
    58 	TInt r;
    60 	r=TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden"), KEntryAttHidden, 0);
    59 	r=TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden"), KEntryAttHidden, 0);
    61 	test_KErrNone(r);
    60 	test(r==KErrNone);
    62 	r=TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\HiddenFile"), KEntryAttHidden, 0);
    61 	r=TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\HiddenFile"), KEntryAttHidden, 0);
    63 	test_KErrNone(r);
    62 	test(r==KErrNone);
    64 	r=TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\System"), KEntryAttSystem, 0);
    63 	r=TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\System"), KEntryAttSystem, 0);
    65 	test_KErrNone(r);
    64 	test(r==KErrNone);
    66 	}
    65 	}
    67 
    66 
    68 LOCAL_C void Test1()
    67 LOCAL_C void Test1()
    69 //
    68 //
    70 // Test all methods
    69 // Test all methods
   235 
   234 
   236 	test.Next(_L("List directory structure"));
   235 	test.Next(_L("List directory structure"));
   237 	TheFs.SetAllocFailure(gAllocFailOff);
   236 	TheFs.SetAllocFailure(gAllocFailOff);
   238 	TFileName sessionPath;
   237 	TFileName sessionPath;
   239 	TInt r=TheFs.SessionPath(sessionPath);
   238 	TInt r=TheFs.SessionPath(sessionPath);
   240 	test_KErrNone(r);
   239 	test(r==KErrNone);
   241 	r=TheFs.SetSessionPath(_L("N:\\"));
   240 	r=TheFs.SetSessionPath(_L("N:\\"));
   242 	test_KErrNone(r);
   241 	test(r==KErrNone);
   243 	TAutoClose<RFs> fs;
   242 	TAutoClose<RFs> fs;
   244 	r=fs.iObj.Connect();
   243 	r=fs.iObj.Connect();
   245 	test_KErrNone(r);
   244 	test(r==KErrNone);
   246 	CDirScan* scanner=CDirScan::NewL(fs.iObj);
   245 	CDirScan* scanner=CDirScan::NewL(fs.iObj);
   247 	TParse dirName;
   246 	TParse dirName;
   248 	TheFs.Parse(sessionPath,dirName);
   247 	TheFs.Parse(sessionPath,dirName);
   249 	scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName);
   248 	scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName);
   250 	CDir* entryList;
   249 	CDir* entryList;
   263 		delete entryList;
   262 		delete entryList;
   264 		entryList=NULL;
   263 		entryList=NULL;
   265 		}
   264 		}
   266 	delete scanner;
   265 	delete scanner;
   267 	r=TheFs.SetSessionPath(sessionPath);
   266 	r=TheFs.SetSessionPath(sessionPath);
   268 	test_KErrNone(r);
   267 	test(r==KErrNone);
   269 	TheFs.SetAllocFailure(gAllocFailOn);
   268 	TheFs.SetAllocFailure(gAllocFailOn);
   270 	}
   269 	}
   271 
   270 
   272 LOCAL_C void Test4()
   271 LOCAL_C void Test4()
   273 //
   272 //
   386 	test.Next(_L("List Z: directory structure"));
   385 	test.Next(_L("List Z: directory structure"));
   387 	CDirScan* scanner=CDirScan::NewLC(TheFs);
   386 	CDirScan* scanner=CDirScan::NewLC(TheFs);
   388 	TPtrC romPath(_L("Z:\\"));
   387 	TPtrC romPath(_L("Z:\\"));
   389 	TParse dirName;
   388 	TParse dirName;
   390 	TInt r=TheFs.Parse(romPath,dirName);
   389 	TInt r=TheFs.Parse(romPath,dirName);
   391 	test_KErrNone(r);
   390 	test(r==KErrNone);
   392 	scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName);
   391 	scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName);
   393 	CDir* entryList;
   392 	CDir* entryList;
   394 	FOREVER
   393 	FOREVER
   395 		{
   394 		{
   396 		scanner->NextL(entryList);
   395 		scanner->NextL(entryList);