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