os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/Setup.cpp
Update contrib.
1 // Copyright (c) 2003-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // See the test specification for details of what these test cases do.
19 #include "TE_comsdbgServer.h"
20 #include "TestMessage.h"
28 * Function Name : CFloggerTest_Setup
29 * Input parameters : None
30 * Output parameters : None
31 * Description : This is the constructor
34 CFloggerTest_Setup::CFloggerTest_Setup()
36 // store the name of this test case
37 SetTestStepName(_L("Setup_File"));
42 * Function Name : ~CFloggerTest_Setup
43 * Input parameters : None
44 * Output parameters : None
45 * Description : This is the destructor
49 CFloggerTest_Setup::~CFloggerTest_Setup()
54 * Function Name : doTestStepL
55 * Input parameters : None
56 * Output parameters : TVerdict
57 * Description : This function sets the flogger.ini file to run the test
64 TVerdict CFloggerTest_Setup::doTestStepL( )
70 ret = fileSystem.Connect();
73 SetTestStepResult(EFail); return TestStepResult();
76 CFileMan *fman = CFileMan::NewL(fileSystem);
77 // rename flogger.ini to a backup name. If not found, ignore.
78 // overwrite backup if found.
79 ret = fileSystem.SetAtt(KFloggerIniFile,KEntryAttNormal, KEntryAttReadOnly);
81 ret = fman->Rename(KFloggerIniFile, KTempPreserveFloggerIniFile, CFileMan::EOverWrite );
83 TRAP(r,constructFloggerIniL(KDefaultIniFileSettings));
87 ret = fileSystem.SetAtt(KFloggerIniFile,KEntryAttNormal, KEntryAttReadOnly);
96 // Check to see if the setup step was successful.
99 INFO_PRINTF1(_L("Setup completed."));
103 INFO_PRINTF2(_L("Setup failed with error %d."), ret); }
107 SetTestStepResult(EPass);
111 SetTestStepResult(EFail);
114 return TestStepResult();
121 Simply initializes the flogger.ini to the default test config.
124 CFloggerTest_InitializeIniFile::CFloggerTest_InitializeIniFile()
126 // store the name of this test case
127 SetTestStepName(_L("Setup_InitializeIniFile"));
131 CFloggerTest_InitializeIniFile::~CFloggerTest_InitializeIniFile()
137 TVerdict CFloggerTest_InitializeIniFile::doTestStepL( )
140 TRAPD(ret,constructFloggerIniL(KDefaultIniFileSettings));
144 SetTestStepResult(EPass); return TestStepResult();
148 SetTestStepResult(EFail); return TestStepResult();
157 * Function Name : CFloggerTest_Restore
158 * Input parameters : None
159 * Output parameters : None
160 * Description : This is the constructor
164 CFloggerTest_Restore::CFloggerTest_Restore()
166 // store the name of this test case
167 SetTestStepName(_L("Restore_File"));
172 * Function Name : ~CFloggerTest_Restore
173 * Input parameters : None
174 * Output parameters : None
175 * Description : This is the destructor
179 CFloggerTest_Restore::~CFloggerTest_Restore()
184 * Function Name : doTestStepL
185 * Input parameters : None
186 * Output parameters : TVerdict
187 * Description : This function restores the orginal flogger.ini file
192 TVerdict CFloggerTest_Restore::doTestStepL( )
196 ret = fileSystem.Connect();
199 // if replace fails, ignore since most likely the preserved file is not there
200 fileSystem.Replace(KTempPreserveFloggerIniFile, KFloggerIniFile);
206 SetTestStepResult(EPass); return TestStepResult();
210 SetTestStepResult(EFail); return TestStepResult();