1 /* |
|
2 * Copyright (c) 2007 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 "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 |
|
20 // INCLUDE FILES |
|
21 #include <stiftestinterface.h> |
|
22 #include "ttscontrollerplugintest.h" |
|
23 #include <settingserverclient.h> |
|
24 |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // Cttscontrollerplugintest::Cttscontrollerplugintest |
|
30 // C++ default constructor can NOT contain any code, that |
|
31 // might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 Cttscontrollerplugintest::Cttscontrollerplugintest( CTestModuleIf& aTestModuleIf ) : |
|
35 CScriptBase( aTestModuleIf ) |
|
36 { |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // Cttscontrollerplugintest::ConstructL |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void Cttscontrollerplugintest::ConstructL() |
|
45 { |
|
46 //Read logger settings to check whether test case name is to be |
|
47 //appended to log file name. |
|
48 RSettingServer settingServer; |
|
49 TInt ret = settingServer.Connect(); |
|
50 if(ret != KErrNone) |
|
51 { |
|
52 User::Leave(ret); |
|
53 } |
|
54 // Struct to StifLogger settigs. |
|
55 TLoggerSettings loggerSettings; |
|
56 // Parse StifLogger defaults from STIF initialization file. |
|
57 ret = settingServer.GetLoggerSettings(loggerSettings); |
|
58 if(ret != KErrNone) |
|
59 { |
|
60 User::Leave(ret); |
|
61 } |
|
62 // Close Setting server session |
|
63 settingServer.Close(); |
|
64 |
|
65 TFileName logFileName; |
|
66 |
|
67 if(loggerSettings.iAddTestCaseTitle) |
|
68 { |
|
69 TName title; |
|
70 TestModuleIf().GetTestCaseTitleL(title); |
|
71 logFileName.Format(KttscontrollerplugintestLogFileWithTitle, &title); |
|
72 } |
|
73 else |
|
74 { |
|
75 logFileName.Copy(KttscontrollerplugintestLogFile); |
|
76 } |
|
77 |
|
78 iLog = CStifLogger::NewL( KttscontrollerplugintestLogPath, |
|
79 logFileName, |
|
80 CStifLogger::ETxt, |
|
81 CStifLogger::EFile, |
|
82 EFalse ); |
|
83 |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // Cttscontrollerplugintest::NewL |
|
88 // Two-phased constructor. |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 Cttscontrollerplugintest* Cttscontrollerplugintest::NewL( |
|
92 CTestModuleIf& aTestModuleIf ) |
|
93 { |
|
94 Cttscontrollerplugintest* self = new (ELeave) Cttscontrollerplugintest( aTestModuleIf ); |
|
95 |
|
96 CleanupStack::PushL( self ); |
|
97 self->ConstructL(); |
|
98 CleanupStack::Pop(); |
|
99 |
|
100 return self; |
|
101 |
|
102 } |
|
103 |
|
104 // Destructor |
|
105 Cttscontrollerplugintest::~Cttscontrollerplugintest() |
|
106 { |
|
107 |
|
108 // Delete resources allocated from test methods |
|
109 Delete(); |
|
110 |
|
111 // Delete logger |
|
112 delete iLog; |
|
113 |
|
114 } |
|
115 |
|
116 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // LibEntryL is a polymorphic Dll entry point. |
|
120 // Returns: CScriptBase: New CScriptBase derived object |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 EXPORT_C CScriptBase* LibEntryL( |
|
124 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
125 { |
|
126 |
|
127 return ( CScriptBase* ) Cttscontrollerplugintest::NewL( aTestModuleIf ); |
|
128 |
|
129 } |
|
130 |
|
131 |
|
132 // End of File |
|