1 /* |
|
2 * Copyright (c) 2002-2004 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: Base class of all other test classes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <stiftestinterface.h> |
|
23 #include "core.h" |
|
24 #include <cmmmessagemanagerbase.h> |
|
25 #include <cmmmessagemanager.h> |
|
26 #include <mmmmesshandlerbase.h> |
|
27 #include "cmmmessagerouterbase.h" |
|
28 #include "cmmmessagerouter.h" |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CCore::CCore |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 EXPORT_C CCore::CCore( |
|
39 CTestModuleIf& aTestModuleIf ): |
|
40 CScriptBase( aTestModuleIf ) |
|
41 { |
|
42 |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CCore::ConstructL |
|
47 // Symbian 2nd phase constructor can leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C void CCore::BaseConstructL() |
|
51 { |
|
52 iCoreLog = CStifLogger::NewL( KCoreLogPath, |
|
53 KCoreLogFile, |
|
54 CStifLogger::ETxt, |
|
55 CStifLogger::EFile, |
|
56 EFalse ); |
|
57 |
|
58 _LIT8(KBaseConstruct, "CORE: In BaseConstructL"); |
|
59 iCoreLog->Log((TDesC8)KBaseConstruct); |
|
60 |
|
61 CMmMessageRouterBase* messageRouter; |
|
62 |
|
63 iMessageManager = NULL; |
|
64 // Create Message Manager (the 'core' of the LTSY Plug-in API) |
|
65 iMessageManager = CMmMessageManager::NewL(); |
|
66 |
|
67 _LIT8(KMessageManager, "iMessageManager OK"); |
|
68 iCoreLog->Log((TDesC8)KMessageManager); |
|
69 messageRouter = CMmMessageRouter::NewL( iMessageManager ); |
|
70 |
|
71 _LIT8(KMessageRouter, "iMessageRouter OK"); |
|
72 iCoreLog->Log((TDesC8)KMessageRouter); |
|
73 // set the pointer to the message router object |
|
74 iMessageManager->SetMessageRouter( messageRouter ); |
|
75 |
|
76 messageRouter->SetCore((CCore*)this); |
|
77 |
|
78 iIscTestCase = new(ELeave) CIscTestCase(); |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CCore::NewL |
|
83 // Two-phased constructor. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 CCore* CCore::NewL( |
|
87 CTestModuleIf& aTestModuleIf ) |
|
88 { |
|
89 |
|
90 CCore* self = new (ELeave) CCore( aTestModuleIf ); |
|
91 CleanupStack::PushL( (CScriptBase*)self ); |
|
92 self->BaseConstructL(); |
|
93 CleanupStack::Pop(self); |
|
94 |
|
95 return self; |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CCore::~CCore |
|
100 // Destructor |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C CCore::~CCore() |
|
104 { |
|
105 iCoreLog->Log(_L("CCore::~CCore") ); |
|
106 |
|
107 // Delete resources allocated from test methods |
|
108 Delete(); |
|
109 |
|
110 // delete isc controller |
|
111 delete iIscTestCase; |
|
112 |
|
113 CloseNTSY(); |
|
114 |
|
115 // Delete logger |
|
116 delete iCoreLog; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CCore::CloseNTSY() |
|
121 // Close/delete NTSY |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C TInt CCore::CloseNTSY() |
|
125 { |
|
126 iCoreLog->Log(_L("CCore::CloseNTSY") ); |
|
127 |
|
128 if ( iMessageManager ) |
|
129 { |
|
130 //delete messageManager object |
|
131 delete iMessageManager; |
|
132 iMessageManager = NULL; |
|
133 } |
|
134 |
|
135 return KErrNone; |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CCore::InitializeIscControlL |
|
140 // Two-phased constructor. |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 |
|
144 EXPORT_C void CCore::InitializeIscControlL(const TDesC& aIscTestCaseFile) |
|
145 { |
|
146 iCoreLog->Log(_L("CCore::InitializeIscControl(%S)"), &aIscTestCaseFile ); |
|
147 iIscTestCase->InitializeL(aIscTestCaseFile); |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CCCore::SyncIscControl |
|
152 // Two-phased constructor. |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 EXPORT_C void CCore::SyncIscControl() |
|
156 { |
|
157 iCoreLog->Log(_L("CCore::SyncIscControl")); |
|
158 iIscTestCase->Sync(); |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CCore::RunIscControlTestCase |
|
163 // Two-phased constructor. |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 EXPORT_C void CCore::RunIscControlTestCase(TInt aTestControlId, TInt aTestCaseId) |
|
167 { |
|
168 iCoreLog->Log(_L("CCore::RunIscControlTestCase (%d,%d)"), aTestControlId, aTestCaseId); |
|
169 iIscTestCase->RunTestCase(aTestControlId, aTestCaseId); |
|
170 } |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // LibEntryL is a polymorphic Dll entry point. |
|
179 // Returns: CScriptBase: New CScriptBase derived object |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 EXPORT_C CScriptBase* LibEntryL( |
|
183 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
184 { |
|
185 |
|
186 return ( CScriptBase* ) CCore::NewL( aTestModuleIf ); |
|
187 |
|
188 } |
|
189 |
|
190 // End of File |
|