//
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description: 
//
//! @file
//! @SYMTestSuiteName			pbase-f32-sfsrv-publicapi-rem
//! @SYMScriptTestEnvironment		This test script requires a basic ROM.
//! @SYMScriptAuthor 			Dmitri Trofimov
//! @SYMScriptDescription		The test script contains API tests for the following functions of TFindFile class:
//! @SYMCreationDate			17/12/2006 
//! TFindFile(RFs &aFs);
//! TInt FindByDir(const TDesC &aFileName, const TDesC &aDirPath);
//! TInt FindWildByDir(const TDesC &aFileName, const TDesC &aDirPath, CDir *&aDir);
//! TInt Find();
//! TInt FindWild(CDir *&aDirList);
//! const TDesC &File() const;
//! TInt SetFindMask(TUint aMask);

LOAD_SUITE				T_SfSrv
DELAY					5000


START_TESTCASE				SETUP_FILES
	START_TEST_BLOCK	100		T_SfSrv		\base\PBASE-F32-FindFile-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new
		COMMAND		RFs1		Connect
		COMMAND		RFs1		MkDirAll	test_dir
		COMMAND		RFs1		MkDirAll	test_dir1
		COMMAND		RFs1		MkDirAll	test_rem_dir
		COMMAND		RFs1		MkDirAll	test_rem_dir1
		COMMAND		CFileMan1	NewL		fileman_fs
		COMMAND		CFileMan1	Copy		test_file1
		COMMAND		CFileMan1	Close
		COMMAND		CFileMan1	Copy		test_rem_file1
		COMMAND		CFileMan1	Close
		COMMAND		CFileMan1	~
		COMMAND		RFs1	~
	END_TEST_BLOCK
END_TESTCASE				SETUP_FILES


START_TESTCASE 				PBASE-F32-FindFile-PublicApi-0019
//! @SYMTestCaseID			PBASE-F32-FindFile-PublicApi-0019
//! @SYMAPI				TFindFile
//! @SYMTestCaseDesc			Find() test. This tests for successful finding of file after FindByDir() call.
//!					Uses API elements: FindByDir(), Find(), File()
//! @SYMTestActions			1. Create RFs object.
//!					2. Create RDir object.
//!					3. Create TFindFile object passing a reference to the connected file session as a parameter.
//!					4. Call FindByDir() passing file name "Test1.txt" and path "\base\t_sfsrv\t_findfile\test1\" as arguments.
//!					5. Call File() with checking that value is '\base\t_sfsrv\t_findfile\test1\Test1.txt'
//!					60.Call Find().
//!					71.Call File() with checking that value is 'x:\base\t_sfsrv\t_findfile\test1\Test1.txt'
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		Find() returns KErrNone.
//! @SYMTestType			CIT
	START_TEST_BLOCK	100		T_SfSrv		\base\PBASE-F32-FindFile-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	RDir		RDir1		
		CREATE_OBJECT	TFindFile	TFindFile1	
		COMMAND		RFs1		new
		COMMAND		RDir1		new
		COMMAND		RFs1		Connect
		COMMAND		TFindFile1	new		PBASE-F32-FindFile-PublicApi-0019-command4new
		COMMAND		TFindFile1	FindByDir	PBASE-F32-FindFile-PublicApi-0019-command5FindByDir
		COMMAND		TFindFile1	File		correct_file_path
		COMMAND		TFindFile1	Find		
		COMMAND		TFindFile1	File		rem_correct_file_path
		COMMAND		TFindFile1	~
		COMMAND		RDir1		~
		COMMAND		RFs1		~
	END_TEST_BLOCK
END_TESTCASE				PBASE-F32-FindFile-PublicApi-0019

START_TESTCASE 				PBASE-F32-FindFile-PublicApi-0023
//! @SYMTestCaseID			PBASE-F32-FindFile-PublicApi-0023
//! @SYMAPI				TFindFile
//! @SYMTestCaseDesc			FindWild() test. This test for successful finding of file ather FindWildByDir() call.
//!					Uses API elements: FindWildByDir(), FindWild()
//! @SYMTestActions			1. Create RFs object.
//!					2. Call Connect().
//!					3. Create TFindFile object passing a reference to the connected file session as a parameter.
//!					4. Call FindWildByDir() passing file name "Test1.*" and path "\base\t_sfsrv\t_findfile\test1\" as arguments.
//!					5. Call FindWild().
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		FindWild() returns KErrNone. FindWild find file on another RAM drive.
//! @SYMTestType			CIT
	START_TEST_BLOCK	100		T_SfSrv		\base\PBASE-F32-FindFile-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1	
		CREATE_OBJECT	TFindFile	TFindFile1
		CREATE_OBJECT	TEntry		TEntry1
		CREATE_OBJECT	CDir		CDir1
		COMMAND		RFs1		new		
		COMMAND		RFs1		Connect		
		COMMAND		TFindFile1	new		PBASE-F32-FindFile-PublicApi-0023-command4new
		COMMAND		TFindFile1	FindWildByDir	PBASE-F32-FindFile-PublicApi-0023-command5FindWildByDir
		COMMAND		TFindFile1	FindWild	common_dir_wrapper
		COMMAND		TFindFile1	~		
		COMMAND		RFs1		~
	END_TEST_BLOCK
END_TESTCASE				PBASE-F32-FindFile-PublicApi-0023

START_TESTCASE 				PBASE-F32-FindFile-PublicApi-0026
//! @SYMTestCaseID			PBASE-F32-FindFile-PublicApi-0026
//! @SYMAPI				TFindFile
//! @SYMTestCaseDesc			FindByDir() test. This tests for function to return correct data.
//!					Uses API elements: FindByDir(), SetFindMask(), File()
//! @SYMTestActions			1. Create RFs object.
//!					2. Call Connect().
//!					3. Call SetFindMask() with invalid parameter .
//!                 4. Call SetFindMask() KDriveAttRemovable as passed parameter.
//!					5. Create TFindFile object passing a reference to the connected file session as a parameter.
//!					6. Call FindByDir() passing file name "Test1.txt" and path "\base\t_sfsrv\t_findfile\test1\" as arguments.
//!					7. Call Find() to switch path to removable drive
//!					8. Call File() with checking that value is 'X:\base\t_sfsrv\t_findfile\test1\Test1.txt'
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		SetFindMask() with invalid parameter returns KErrArgument. and File returns a path on removable drive.
//! @SYMTestType			CIT
	START_TEST_BLOCK	100	T_SfSrv		\base\PBASE-F32-FindFile-PublicApi.ini
		CREATE_OBJECT		RFs		RFs1	
		CREATE_OBJECT		TFindFile	TFindFile1	
		CREATE_OBJECT		TEntry		TEntry1
		CREATE_OBJECT		CDir		CDir1
		COMMAND			RFs1		new			
		COMMAND			RFs1		Connect		
		COMMAND			TFindFile1	new		PBASE-F32-FindFile-PublicApi-0026-command4new
		COMMAND	!Error=-6	TFindFile1	SetFindMask     PBASE-F32-FindFile-PublicApi-0026__mask_params
		COMMAND			TFindFile1	SetFindMask	find_mask_params
		COMMAND			TFindFile1	FindByDir	PBASE-F32-FindFile-PublicApi-0026-command5FindByDir
		COMMAND			TFindFile1	Find			
		COMMAND			TFindFile1	~		
		COMMAND			RFs1		~		
	END_TEST_BLOCK
END_TESTCASE				PBASE-F32-FindFile-PublicApi-0026


START_TESTCASE				REMOVE_FILES
	START_TEST_BLOCK	100		T_SfSrv		\base\PBASE-F32-FindFile-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new
		COMMAND		RFs1		Connect
		COMMAND		CFileMan1	NewL		fileman_fs
		COMMAND		CFileMan1	Delete		all_files1
		COMMAND		CFileMan1	Delete		all_rem_files1
		COMMAND		RFs1		RmDir		test_dir1
		COMMAND		RFs1		RmDir		test_dir
		COMMAND		RFs1		RmDir		test_rem_dir1
		COMMAND		RFs1		RmDir		test_rem_dir
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK
END_TESTCASE				REMOVE_FILES
