1 /* |
1 /* |
2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
46 { |
46 { |
47 } |
47 } |
48 |
48 |
49 TTestActionSpec::~TTestActionSpec() |
49 TTestActionSpec::~TTestActionSpec() |
50 { |
50 { |
51 iniSectionResultBody.Close(); |
51 iIniSectionResultBody.Close(); |
|
52 iTestIniFilePtr.Close(); |
52 } |
53 } |
53 |
54 |
54 TInt TTestActionSpec::Init(const TDesC8& aInput, |
55 TInt TTestActionSpec::Init(const TDesC8& aInput, |
55 TInt& aPos, |
56 TInt& aPos, |
56 CConsoleBase& /*aConsole*/, |
57 CConsoleBase& /*aConsole*/, |
186 TBool scriptactionResultSet = EFalse; |
187 TBool scriptactionResultSet = EFalse; |
187 // TBool iniactionResultSet = EFalse; |
188 // TBool iniactionResultSet = EFalse; |
188 TBuf8<512> prevTestCaseID; |
189 TBuf8<512> prevTestCaseID; |
189 TBuf8<512> prevTestDescription; |
190 TBuf8<512> prevTestDescription; |
190 |
191 |
191 |
|
192 |
|
193 // Checks if the first word from the script file is an error code |
192 // Checks if the first word from the script file is an error code |
194 // if(error code) |
193 // if(error code) |
195 // sets 'actionResult' to the relevent error code with the <return></return> tags |
194 // sets 'actionResult' to the relevent error code with the <return></return> tags |
196 |
195 |
197 TPtrC8 firstWord = Tefinput::ParseNthElement(aInput,1, err); |
196 TPtrC8 firstWord = Tefinput::ParseNthElement(aInput,1, err); |
225 if(err == KErrNone) |
224 if(err == KErrNone) |
226 { |
225 { |
227 err = Tefinput::ParseiniPath(iniFileName, aScriptPath, iniFilePath); |
226 err = Tefinput::ParseiniPath(iniFileName, aScriptPath, iniFilePath); |
228 if(err == KErrNone) |
227 if(err == KErrNone) |
229 { |
228 { |
230 aTestIniFilePtr.Assign(Tefinput::GetiniFile(aFs, iniFilePath, err)); // Load up our local RBuf ptr to takeover the management of the inifile data in Heap |
229 iTestIniFilePtr.Assign(Tefinput::GetiniFile(aFs, iniFilePath, err)); // Load up our local RBuf ptr to takeover the management of the inifile data in Heap |
231 |
|
232 if(err == KErrNone) |
230 if(err == KErrNone) |
233 { |
231 { |
234 TPtrC8 iniFile = aTestIniFilePtr.Ptr(); |
232 TPtrC8 iniFile; |
|
233 if (iTestIniFilePtr.Length() == iTestIniFilePtr.MaxLength()) |
|
234 iniFile.Set(iTestIniFilePtr.Ptr()); |
|
235 else |
|
236 iniFile.Set(iTestIniFilePtr.PtrZ()); |
235 inifile = ETrue; |
237 inifile = ETrue; |
236 err = Tefinput::ParseActionbody(iniFile, iniSectionName, iniSectionData); |
238 err = Tefinput::ParseActionbody(iniFile, iniSectionName, iniSectionData); |
237 if(err == KErrNone) |
239 if(err == KErrNone) |
238 { |
240 { |
239 TInt pos = 0; |
241 TInt pos = 0; |
271 scriptResult.Set(aScriptResult); |
273 scriptResult.Set(aScriptResult); |
272 tempResult.Set(Input::ParseElement(iniSectionData, KActionResultStart, KActionResultEnd, pos, err)); |
274 tempResult.Set(Input::ParseElement(iniSectionData, KActionResultStart, KActionResultEnd, pos, err)); |
273 if (err == KErrNone) |
275 if (err == KErrNone) |
274 { |
276 { |
275 resultlen = scriptResult.Length() + tempResult.Length(); |
277 resultlen = scriptResult.Length() + tempResult.Length(); |
276 iniSectionResultBody.Create(tempResult,resultlen); |
278 iIniSectionResultBody.Create(tempResult,resultlen); |
277 iniSectionResultBody.Insert(0,scriptResult); |
279 iIniSectionResultBody.Insert(0,scriptResult); |
278 iActionResult.Set(iniSectionResultBody); |
280 iActionResult.Set(iIniSectionResultBody); |
279 // iniactionResultSet = ETrue; |
281 // iniactionResultSet = ETrue; |
280 } |
282 } |
281 else |
283 else |
282 { |
284 { |
283 iniSectionResultBody.Create(scriptResult); |
285 iIniSectionResultBody.Create(scriptResult); |
284 iActionResult.Set(iniSectionResultBody); |
286 iActionResult.Set(iIniSectionResultBody); |
285 } |
287 } |
286 } |
288 } |
287 else |
289 else |
288 { |
290 { |
289 tempResult.Set(Input::ParseElement(iniSectionData, KActionResultStart, KActionResultEnd, pos, err)); |
291 tempResult.Set(Input::ParseElement(iniSectionData, KActionResultStart, KActionResultEnd, pos, err)); |
290 err = Tefinput::GetActionResult(KErrNone, aScriptResult); |
292 err = Tefinput::GetActionResult(KErrNone, aScriptResult); |
291 if(err == KErrNone) |
293 if(err == KErrNone) |
292 { |
294 { |
293 scriptResult.Set(aScriptResult); |
295 scriptResult.Set(aScriptResult); |
294 resultlen = tempResult.Length() + scriptResult.Length(); |
296 resultlen = tempResult.Length() + scriptResult.Length(); |
295 iniSectionResultBody.Create(tempResult, resultlen); |
297 iIniSectionResultBody.Create(tempResult, resultlen); |
296 iniSectionResultBody.Insert(0,aScriptResult); |
298 iIniSectionResultBody.Insert(0,aScriptResult); |
297 iActionResult.Set(iniSectionResultBody); |
299 iActionResult.Set(iIniSectionResultBody); |
298 } |
300 } |
299 else |
301 else |
300 { |
302 { |
301 iniSectionResultBody.Create(tempResult); |
303 iIniSectionResultBody.Create(tempResult); |
302 iActionResult.Set(iniSectionResultBody); |
304 iActionResult.Set(iIniSectionResultBody); |
303 } |
305 } |
304 } |
306 } |
305 |
307 |
306 |
308 |
307 // aPrevTestCaseID = aTestCaseID; |
309 // aPrevTestCaseID = aTestCaseID; |