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