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