datacommsserver/networkingdialogapi/TE_Dialog/src/TestDialogPostDelete.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // POSTDELETE.CPP
       
    15 // @file
       
    16 // @internalComponent
       
    17 // Ini file Deletion
       
    18 // 
       
    19 //
       
    20 
       
    21 //Symbian OS Headers
       
    22 #include <c32comm.h>
       
    23 //#include <agentdialog.h>
       
    24 #include <f32file.h>
       
    25 #include "TestDialogPostDelete.h"
       
    26 //Test Framework Header
       
    27 #include <test/testexecutelog.h>
       
    28 
       
    29 //
       
    30 //
       
    31 // Test Delete
       
    32 /* This New Class is added to remove deletefile command from auto_Ts_genconn.script file
       
    33    This test does a delete operation for agentdialog.ini file	
       
    34 */
       
    35 CTestPostDeleteIni::CTestPostDeleteIni()
       
    36 	{
       
    37 	// store the name of this test case
       
    38 	SetTestStepName(KPostDeleteDialog);
       
    39 	}
       
    40 
       
    41 CTestPostDeleteIni::~CTestPostDeleteIni()
       
    42 	{
       
    43 	}
       
    44 
       
    45 // Delete Ini Test Main Code
       
    46 enum TVerdict CTestPostDeleteIni::doTestStepL( void )
       
    47 	{
       
    48 	deleteFileL(KFilePath);
       
    49 	return EPass;
       
    50 	}
       
    51 
       
    52 void CTestPostDeleteIni::deleteFileL(const TDesC& aFileName) 
       
    53 	{
       
    54 	// create a fileserver
       
    55 	RFs  fileSystem;
       
    56 	CTestExecuteLogger log = Logger();
       
    57 
       
    58 	User::LeaveIfError(fileSystem.Connect());
       
    59 	CleanupClosePushL(fileSystem);
       
    60 
       
    61 	// Remove read only flag
       
    62 	TInt ret = fileSystem.SetAtt(aFileName, 0, KEntryAttReadOnly);
       
    63 	if (ret == KErrNotFound)
       
    64 		{
       
    65 		// If file already removed then no need to delete it
       
    66 		log.Write(_L("File not found"));
       
    67 		CleanupStack::PopAndDestroy(&fileSystem);
       
    68 		return;
       
    69 		}
       
    70 	User::LeaveIfError(ret);
       
    71 
       
    72 	log.Write(_L("Set file to read only"));
       
    73 
       
    74 	// Delete file
       
    75 	User::LeaveIfError(fileSystem.Delete(aFileName));
       
    76 	log.Write(_L("deleted file"));
       
    77 
       
    78 	// clean up
       
    79 	CleanupStack::PopAndDestroy(&fileSystem);
       
    80 	}
       
    81