1 /* |
|
2 * Copyright (c) 2002 - 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: ganes_api |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <stiftestinterface.h> |
|
21 #include <settingserverclient.h> |
|
22 #include <e32property.h> |
|
23 |
|
24 #include "testplatgane.h" |
|
25 |
|
26 // CONSTANTS |
|
27 _LIT( KModuleName, "testplatgane.dll" ); |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CTestPlatGane::CTestPlatGane |
|
33 // C++ default constructor can NOT contain any code, that |
|
34 // might leave. |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CTestPlatGane::CTestPlatGane( CTestModuleIf& aTestModuleIf ): |
|
38 CScriptBase( aTestModuleIf ) |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CTestPlatGane::~CTestPlatGane |
|
44 // Destructor. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CTestPlatGane::~CTestPlatGane() |
|
48 { |
|
49 // Delete logger |
|
50 delete iLog; |
|
51 |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CTestPlatGane::ConstructL |
|
56 // Symbian 2nd phase constructor can leave. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void CTestPlatGane::ConstructL() |
|
60 { |
|
61 //Read logger settings to check whether test case name is to be |
|
62 //appended to log file name. |
|
63 RSettingServer settingServer; |
|
64 CleanupClosePushL( settingServer ); |
|
65 TInt ret = settingServer.Connect(); |
|
66 if ( ret != KErrNone ) |
|
67 { |
|
68 User::Leave(ret); |
|
69 } |
|
70 // Struct to StifLogger settigs. |
|
71 TLoggerSettings loggerSettings; |
|
72 // Parse StifLogger defaults from STIF initialization file. |
|
73 ret = settingServer.GetLoggerSettings( loggerSettings ); |
|
74 if ( ret != KErrNone ) |
|
75 { |
|
76 User::Leave( ret ); |
|
77 } |
|
78 // Close Setting server session |
|
79 settingServer.Close(); |
|
80 CleanupStack::PopAndDestroy( &settingServer ); |
|
81 |
|
82 TFileName logFileName; |
|
83 |
|
84 if ( loggerSettings.iAddTestCaseTitle ) |
|
85 { |
|
86 TName title; |
|
87 TestModuleIf().GetTestCaseTitleL( title ); |
|
88 logFileName.Format( KTestPlatGaneLogFileWithTitle, &title ); |
|
89 } |
|
90 else |
|
91 { |
|
92 logFileName.Copy( KTestPlatGaneLogFile ); |
|
93 } |
|
94 |
|
95 iLog = CStifLogger::NewL( KTestPlatGaneLogPath, |
|
96 logFileName, |
|
97 CStifLogger::ETxt, |
|
98 CStifLogger::EFile, |
|
99 EFalse ); |
|
100 |
|
101 SendTestClassVersion(); |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CTestPlatGane::NewL |
|
106 // Two-phased constructor. |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 CTestPlatGane* CTestPlatGane::NewL( CTestModuleIf& aTestModuleIf ) |
|
110 { |
|
111 CTestPlatGane* self = new( ELeave ) CTestPlatGane( aTestModuleIf ); |
|
112 |
|
113 CleanupStack::PushL( self ); |
|
114 self->ConstructL(); |
|
115 CleanupStack::Pop( self ); |
|
116 |
|
117 return self; |
|
118 |
|
119 } |
|
120 |
|
121 //----------------------------------------------------------------------------- |
|
122 // CTestPlatGane::SendTestClassVersion |
|
123 // Method used to send version of test class |
|
124 //----------------------------------------------------------------------------- |
|
125 // |
|
126 void CTestPlatGane::SendTestClassVersion() |
|
127 { |
|
128 TVersion moduleVersion; |
|
129 moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; |
|
130 moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; |
|
131 moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; |
|
132 |
|
133 TFileName moduleName; |
|
134 moduleName = KModuleName; |
|
135 |
|
136 TBool newVersionOfMethod = ETrue; |
|
137 TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName, |
|
138 newVersionOfMethod ); |
|
139 } |
|
140 |
|
141 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // LibEntryL is a polymorphic Dll entry point. |
|
145 // Returns: CScriptBase: New CScriptBase derived object |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C CScriptBase* LibEntryL( |
|
149 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
150 { |
|
151 return ( CScriptBase* ) CTestPlatGane::NewL( aTestModuleIf ); |
|
152 } |
|
153 // End of File |
|