datacommsserver/networkingdialogapi/TE_Dialog/src/TestDialogIniCopy.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 // INICOPY.CPP
       
    15 // @file
       
    16 // @internalComponent
       
    17 // Ini file preparation
       
    18 // 
       
    19 //
       
    20 
       
    21 //Symbian OS Headers
       
    22 #include <c32comm.h>
       
    23 //#include <agentdialog.h>
       
    24 #include <f32file.h>
       
    25 #include "TestDialogIniCopy.h"
       
    26 //Test Framework Header
       
    27 #include <test/testexecutelog.h>
       
    28 
       
    29 //
       
    30 //
       
    31 // Test Copy Test
       
    32 /* This New Class is added to remove copyfile command from auto_Ts_genconn.script file
       
    33    This test does a copy operation for agentdialog.ini file	
       
    34 */
       
    35 CTestPreCopyIni::CTestPreCopyIni()
       
    36 	{
       
    37 	// store the name of this test case
       
    38 	SetTestStepName(KPreCopyDialog);
       
    39 	}
       
    40 
       
    41 CTestPreCopyIni::~CTestPreCopyIni()
       
    42 	{
       
    43 	}
       
    44 
       
    45 // Copy Test Main Code
       
    46 enum TVerdict CTestPreCopyIni::doTestStepL( void )
       
    47 	{
       
    48 	copyFileL(KSrcPath, KDestPath);
       
    49 	return EPass;
       
    50 	}
       
    51 
       
    52 void CTestPreCopyIni::copyFileL(const TDesC& anOld,const TDesC& aNew) 
       
    53 	{
       
    54 	// create a fileserver
       
    55 	RFs fileSystem;
       
    56 
       
    57 	// connect to file server
       
    58 	User::LeaveIfError(fileSystem.Connect());
       
    59 	CleanupClosePushL(fileSystem);
       
    60 
       
    61 	// create a file manager
       
    62 	CFileMan* fileMan = CFileMan::NewL(fileSystem);
       
    63 	CleanupStack::PushL(fileMan);
       
    64 
       
    65 	// parse the filenames
       
    66 	TParse source;
       
    67 	User::LeaveIfError(source.Set(anOld, NULL, NULL));
       
    68  
       
    69 	// parse the filenames
       
    70 	TParse target;
       
    71 	User::LeaveIfError(target.Set(aNew, NULL, NULL));
       
    72 
       
    73 	// do the copy
       
    74 	User::LeaveIfError(fileMan->Copy(source.FullName(), target.FullName(), CFileMan::EOverWrite));
       
    75 
       
    76 	CleanupStack::PopAndDestroy(fileMan);
       
    77 	CleanupStack::PopAndDestroy(&fileSystem);
       
    78 	}
       
    79