|
1 /* |
|
2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "tHardcodedTests.h" |
|
20 #include "Thardcodedsetup.h" |
|
21 |
|
22 #include "t_input.h" |
|
23 #include "t_certstoreactionmemfail.h" |
|
24 #include "tcancel.h" |
|
25 #include "t_message.h" |
|
26 #include "t_output.h" |
|
27 #include "tTestSpec.h" |
|
28 #include "t_testactionspec.h" |
|
29 #include "t_logger.h" |
|
30 |
|
31 |
|
32 EXPORT_C CHardcodedSetup* CHardcodedSetup::NewLC(void) |
|
33 { |
|
34 CHardcodedSetup* self = new(ELeave) CHardcodedSetup(); |
|
35 CleanupStack::PushL(self); |
|
36 self->ConstructL(); |
|
37 return self; |
|
38 } |
|
39 |
|
40 EXPORT_C void CHardcodedSetup::SetupTestsL(RFs& aFs, |
|
41 CTestSpec& aTestSpec, |
|
42 THardcodedTests theHardcodedTests[], |
|
43 const CTestHandlerSettings& aCommandLineSettings) |
|
44 { |
|
45 TInt err = KErrNone; |
|
46 for (TInt i = 0; theHardcodedTests[i].action!=NULL; i++) |
|
47 { |
|
48 |
|
49 TInt groupings= theHardcodedTests[i].groupings; |
|
50 TTestActionSpec actionSpec; |
|
51 actionSpec.HardcodedInit(theHardcodedTests[i].name); |
|
52 //Start off checking Exhaustive and Smoke flags, then calls groupings |
|
53 if (!CheckAllFlags(aCommandLineSettings, groupings)) |
|
54 //The current test should not be run |
|
55 continue; |
|
56 |
|
57 |
|
58 CTestAction* newAction = 0; |
|
59 TRAP(err, |
|
60 newAction = theHardcodedTests[i].action(aFs, *iConsole, *iLogFile, actionSpec)); |
|
61 |
|
62 if (err != KErrNone) |
|
63 { |
|
64 // We warn the user that an error occured |
|
65 // IMPROVEMENT : we should give more details because this won't be enough |
|
66 PRINTANDLOG(_L("void CHardcoded::SetupTestsL(RPointerArray<CTestAction>& aTestActions)\n")); |
|
67 PRINTANDLOG1(_L("An error occurred while creating action %D\n"), i); |
|
68 User::Leave(err); |
|
69 } |
|
70 CleanupStack::PushL(newAction); |
|
71 User::LeaveIfError(aTestSpec.AddNextTest(newAction)); |
|
72 CleanupStack::Pop(newAction); |
|
73 } |
|
74 } |
|
75 |
|
76 |
|
77 CHardcodedSetup::~CHardcodedSetup() |
|
78 { |
|
79 } |
|
80 |
|
81 CHardcodedSetup::CHardcodedSetup(void) |
|
82 : CTestSetup(NULL) |
|
83 { |
|
84 } |
|
85 |
|
86 EXPORT_C TBool CHardcodedSetup::InitialiseL(RFs &aFs, const TDesC& aDefaultLog) |
|
87 { |
|
88 TRAPD(err, OpenLogFileL(aFs, 0, aDefaultLog)); |
|
89 |
|
90 if (err != KErrNone) |
|
91 { |
|
92 // We warn the user that an error occured |
|
93 // IMPROVEMENT : we should give more details because this won't be enough |
|
94 PRINTANDLOG1(_L("void CHardcodedSetup::InitialiseL: Failed to open log file: %D\n"), err); |
|
95 User::Leave(err); |
|
96 } |
|
97 |
|
98 return(ETrue); |
|
99 } |