sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// This file contains test classes and their implementations
|
sl@0
|
15 |
// to test production class CRegistrar. Where necessary stubs
|
sl@0
|
16 |
// are implemented to help in writing test harness using RTest.
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "RegistryData.h"
|
sl@0
|
21 |
#include "EComErrorCodes.h"
|
sl@0
|
22 |
#include "EComUidCodes.h"
|
sl@0
|
23 |
#include "ImplementationInformation.h"
|
sl@0
|
24 |
#include "RegistryData.h"
|
sl@0
|
25 |
#include "Registrar.h"
|
sl@0
|
26 |
#include "RegistrarObserver.h"
|
sl@0
|
27 |
#include "../EcomTestUtils/EcomTestUtils.h"
|
sl@0
|
28 |
#include "EComEntryBase.h"
|
sl@0
|
29 |
#include "DriveInfo.h"
|
sl@0
|
30 |
|
sl@0
|
31 |
#include <e32test.h>
|
sl@0
|
32 |
#include <f32file.h>
|
sl@0
|
33 |
#include <bautils.h>
|
sl@0
|
34 |
#include <startup.hrh>
|
sl@0
|
35 |
|
sl@0
|
36 |
#include "baspi.h"
|
sl@0
|
37 |
|
sl@0
|
38 |
_LIT (KDataDir, "C:\\private\\10009D8F\\ECom*");
|
sl@0
|
39 |
|
sl@0
|
40 |
//We need two different entry RSC and the SPI to fully test CRegistrar
|
sl@0
|
41 |
//------------------------------NEW TYPE----------------------------------------
|
sl@0
|
42 |
const TUid NewDllUid={0x101F847B};
|
sl@0
|
43 |
_LIT(KNewResourceFileNameOnly,"EComExample5.rsc");
|
sl@0
|
44 |
_LIT(KNewResourceFileNameC, "C:\\resource\\plugins\\EComExample5.rsc");
|
sl@0
|
45 |
_LIT(KNewDllFileNameC, "C:\\sys\\bin\\EComExample5.dll");
|
sl@0
|
46 |
_LIT(KNewResourceFileNameZ, "z:\\RAMOnly\\EComExample5.rsc");
|
sl@0
|
47 |
_LIT(KNewDllFileNameZ,"z:\\RAMOnly\\EComExample5.dll");
|
sl@0
|
48 |
|
sl@0
|
49 |
//We need IIC type 3 RSC to fully test CRegistrar
|
sl@0
|
50 |
//------------------------------IIC TYPE 3----------------------------------------
|
sl@0
|
51 |
const TUid Type3DllUid = {0x10009E3E};
|
sl@0
|
52 |
_LIT(KType3ResourceFileNameOnly,"EComExample12.rsc");
|
sl@0
|
53 |
_LIT(KType3ResourceFileNameC, "C:\\resource\\plugins\\EComExample12.rsc");
|
sl@0
|
54 |
_LIT(KType3DllFileNameC, "C:\\sys\\bin\\EComExample12.dll");
|
sl@0
|
55 |
_LIT(KType3ResourceFileNameZ, "z:\\RAMOnly\\EComExample12.rsc");
|
sl@0
|
56 |
_LIT(KType3DllFileNameZ,"z:\\RAMOnly\\EComExample12.dll");
|
sl@0
|
57 |
|
sl@0
|
58 |
//We need IIC type 3 RSC with data exceed maximum to fully test CRegistrar
|
sl@0
|
59 |
//------------------------------IIC TYPE 3----------------------------------------
|
sl@0
|
60 |
_LIT(KType3BadDataResourceFileNameOnly,"EComExampleBadData.rsc");
|
sl@0
|
61 |
_LIT(KType3BadDataResourceFileNameC, "C:\\resource\\plugins\\EComExampleBadData.rsc");
|
sl@0
|
62 |
_LIT(KType3BadDataDllFileNameC, "C:\\sys\\bin\\EComExampleBadData.dll");
|
sl@0
|
63 |
_LIT(KType3BadDataResourceFileNameZ, "z:\\RAMOnly\\EComExampleBadData.rsc");
|
sl@0
|
64 |
_LIT(KType3BadDataDllFileNameZ,"z:\\RAMOnly\\EComExampleBadData.dll");
|
sl@0
|
65 |
|
sl@0
|
66 |
_LIT(KType3BadData1ResourceFileNameOnly,"EComExampleBadData1.rsc");
|
sl@0
|
67 |
_LIT(KType3BadData1ResourceFileNameC, "C:\\resource\\plugins\\EComExampleBadData1.rsc");
|
sl@0
|
68 |
_LIT(KType3BadData1DllFileNameC, "C:\\sys\\bin\\EComExampleBadData1.dll");
|
sl@0
|
69 |
_LIT(KType3BadData1ResourceFileNameZ, "z:\\RAMOnly\\EComExampleBadData1.rsc");
|
sl@0
|
70 |
_LIT(KType3BadData1DllFileNameZ,"z:\\RAMOnly\\EComExampleBadData1.dll");
|
sl@0
|
71 |
|
sl@0
|
72 |
_LIT(KType3BadData2ResourceFileNameOnly,"EComExampleBadData2.rsc");
|
sl@0
|
73 |
_LIT(KType3BadData2ResourceFileNameC, "C:\\resource\\plugins\\EComExampleBadData2.rsc");
|
sl@0
|
74 |
_LIT(KType3BadData2DllFileNameC, "C:\\sys\\bin\\EComExampleBadData2.dll");
|
sl@0
|
75 |
_LIT(KType3BadData2ResourceFileNameZ, "z:\\RAMOnly\\EComExampleBadData2.rsc");
|
sl@0
|
76 |
_LIT(KType3BadData2DllFileNameZ,"z:\\RAMOnly\\EComExampleBadData2.dll");
|
sl@0
|
77 |
|
sl@0
|
78 |
//We need IIC type 2 RSC to fully test CRegistrar
|
sl@0
|
79 |
//------------------------------IIC TYPE 2----------------------------------------
|
sl@0
|
80 |
_LIT(KType2ResourceFileNameOnly,"EComExample14.rsc");
|
sl@0
|
81 |
_LIT(KType2ResourceFileNameC, "C:\\resource\\plugins\\EComExample14.rsc");
|
sl@0
|
82 |
_LIT(KType2DllFileNameC, "C:\\sys\\bin\\EComExample14.dll");
|
sl@0
|
83 |
_LIT(KType2ResourceFileNameZ, "z:\\RAMOnly\\EComExample14.rsc");
|
sl@0
|
84 |
_LIT(KType2DllFileNameZ,"z:\\RAMOnly\\EComExample14.dll");
|
sl@0
|
85 |
|
sl@0
|
86 |
//------------------------------LEGACY TYPE-------------------------------------
|
sl@0
|
87 |
|
sl@0
|
88 |
// spi test file
|
sl@0
|
89 |
_LIT(KEComSpiTestFilePathAndName, "Z:\\Test\\Data\\EcomTest.spi");
|
sl@0
|
90 |
// spi test file for testing IIC Type3
|
sl@0
|
91 |
_LIT(KEComSpiTestFileType3PathAndName, "Z:\\Test\\Data\\ecomtesttype3.spi");
|
sl@0
|
92 |
|
sl@0
|
93 |
const TInt KOneSecond = 1000000;
|
sl@0
|
94 |
|
sl@0
|
95 |
const TUid interfaceUidExample12 = {0x10009E36};
|
sl@0
|
96 |
const TUid extendedInterfaceUid1 = {0x10009E44};
|
sl@0
|
97 |
const TUid extendedInterfaceUid2 = {0x10009E45};
|
sl@0
|
98 |
const TUid extendedInterfaceUid3 = {0x10009E46};
|
sl@0
|
99 |
|
sl@0
|
100 |
|
sl@0
|
101 |
LOCAL_D RTest test(_L("t_Registrar.exe"));
|
sl@0
|
102 |
|
sl@0
|
103 |
LOCAL_D RFs TheFs;
|
sl@0
|
104 |
|
sl@0
|
105 |
LOCAL_D CTrapCleanup* TheTrapCleanup = NULL;
|
sl@0
|
106 |
|
sl@0
|
107 |
LOCAL_D CActiveScheduler* TheActiveScheduler = NULL;
|
sl@0
|
108 |
|
sl@0
|
109 |
// Used for supressing warning in OOM tests
|
sl@0
|
110 |
#define __UNUSED_VAR(var) var = var
|
sl@0
|
111 |
|
sl@0
|
112 |
//It is used by some test methods which are called two times:
|
sl@0
|
113 |
//from normal test and from OOM test.
|
sl@0
|
114 |
static void LeaveIfErrNoMemory(TInt aError)
|
sl@0
|
115 |
{
|
sl@0
|
116 |
if(aError == KErrNoMemory)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
User::Leave(aError);
|
sl@0
|
119 |
}
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
TRegistrar_StateAccessor class allows access to private and protected
|
sl@0
|
124 |
members of production code class CRegistrar, as its a friend class.
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
class TRegistrar_StateAccessor
|
sl@0
|
127 |
{
|
sl@0
|
128 |
public:
|
sl@0
|
129 |
void DiscoveriesBegin(CRegistrar& aRegistrar);
|
sl@0
|
130 |
|
sl@0
|
131 |
void DiscoveriesComplete(CRegistrar& aRegistrar, TBool aSuccessful);
|
sl@0
|
132 |
|
sl@0
|
133 |
void DriveRemovedL(CRegistrar& aRegistrar, TDriveUnit aDriveUnit);
|
sl@0
|
134 |
|
sl@0
|
135 |
void DriveReinstatedL(CRegistrar& aRegistrar, TDriveUnit aDriveUnit);
|
sl@0
|
136 |
|
sl@0
|
137 |
void RegisterDiscoveryL(CRegistrar& aRegistrar,const TDriveName& aDrive, CPluginBase*& aEntry,TBool aDatFileExists);
|
sl@0
|
138 |
|
sl@0
|
139 |
void ParseL(CRegistrar& aRegistrar,
|
sl@0
|
140 |
CPluginBase*& aEntry,
|
sl@0
|
141 |
CRegistryData::CDllData& aDll);
|
sl@0
|
142 |
|
sl@0
|
143 |
void ParseRegistrationDataL(CRegistrar& aRegistrar,
|
sl@0
|
144 |
CPluginBase*& aEntry,
|
sl@0
|
145 |
TDriveUnit& aDriveUnit,
|
sl@0
|
146 |
TBool aUpdate,
|
sl@0
|
147 |
TInt aRegistryDriveIndex,
|
sl@0
|
148 |
CRegistryData::CDriveData* aDriveData);
|
sl@0
|
149 |
|
sl@0
|
150 |
CRegistrar::TRegistrarState State(CRegistrar& aRegistrar);
|
sl@0
|
151 |
};
|
sl@0
|
152 |
|
sl@0
|
153 |
/**
|
sl@0
|
154 |
Parses the resource file associated with an
|
sl@0
|
155 |
Interface Implementation Collection for the plugin entry.
|
sl@0
|
156 |
|
sl@0
|
157 |
@param aRegistrar The CRegistrar class object under test
|
sl@0
|
158 |
@param aEntry an ecom entry discovered
|
sl@0
|
159 |
@param aDll CRegistrar::CDllData object in which parsed data needs to be stored
|
sl@0
|
160 |
@pre CRegistrar should be fully constructed.
|
sl@0
|
161 |
@post The resource file is parsed and the data is added to 'aDll'.
|
sl@0
|
162 |
*/
|
sl@0
|
163 |
void TRegistrar_StateAccessor::ParseL(CRegistrar& aRegistrar,
|
sl@0
|
164 |
CPluginBase*& aEntry,
|
sl@0
|
165 |
CRegistryData::CDllData& aDll)
|
sl@0
|
166 |
|
sl@0
|
167 |
{
|
sl@0
|
168 |
aRegistrar.ParseL(aEntry,aDll);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
/**
|
sl@0
|
172 |
Determines if the directory entry for an Interface Implementation
|
sl@0
|
173 |
Collection requires registration. Parses and registers the plugin entry
|
sl@0
|
174 |
associated with the resource file if entry is not already registered.
|
sl@0
|
175 |
|
sl@0
|
176 |
@param aRegistrar The CRegistrar class object under test
|
sl@0
|
177 |
@param aEntry Directory entry for the Interface Impplementation Collection.
|
sl@0
|
178 |
@param aRscFileName Resource file from which to extract the data
|
sl@0
|
179 |
@param aDrive Drive on which registry data has been found on
|
sl@0
|
180 |
@param aUpdate Flag indicating if this is an update, or new entry.
|
sl@0
|
181 |
@param aRegistryDriveIndex Index within the registry data
|
sl@0
|
182 |
for the branch that the registry entry was found within.
|
sl@0
|
183 |
@pre CRegistrar is fully constructed.
|
sl@0
|
184 |
@post The Interface Implementation Collection entry has been processed appropriately.
|
sl@0
|
185 |
*/
|
sl@0
|
186 |
void TRegistrar_StateAccessor::ParseRegistrationDataL(CRegistrar& aRegistrar,
|
sl@0
|
187 |
CPluginBase*& aEntry,
|
sl@0
|
188 |
TDriveUnit& aDrive,
|
sl@0
|
189 |
TBool aUpdate,
|
sl@0
|
190 |
TInt aRegistryDriveIndex,
|
sl@0
|
191 |
CRegistryData::CDriveData* aDriveData)
|
sl@0
|
192 |
{
|
sl@0
|
193 |
aRegistrar.ParseRegistrationDataL(aEntry, aDrive,aUpdate, aRegistryDriveIndex, aDriveData);
|
sl@0
|
194 |
}
|
sl@0
|
195 |
|
sl@0
|
196 |
/**
|
sl@0
|
197 |
Overload of the MDiscovererObserver callback method.
|
sl@0
|
198 |
The cue that a registry update is about to occur.
|
sl@0
|
199 |
|
sl@0
|
200 |
@param aRegistrar The CRegistrar class object under test
|
sl@0
|
201 |
@pre CRegistrar is fully constructed
|
sl@0
|
202 |
@post The Registry data manager has been informed that its internal
|
sl@0
|
203 |
data is out of date.
|
sl@0
|
204 |
*/
|
sl@0
|
205 |
void TRegistrar_StateAccessor::DiscoveriesBegin(CRegistrar& aRegistrar)
|
sl@0
|
206 |
{
|
sl@0
|
207 |
aRegistrar.DiscoveriesBegin();
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
/**
|
sl@0
|
211 |
Overload of the MDiscovererObserver callback method.
|
sl@0
|
212 |
The cue that a registry update is done.
|
sl@0
|
213 |
|
sl@0
|
214 |
@param aRegistrar The CRegistrar class object under test
|
sl@0
|
215 |
@param aSuccessful The registry data has been updated successfully
|
sl@0
|
216 |
@pre CRegistrar is fully constructed
|
sl@0
|
217 |
@post The current registry data and the internal access indexes have been rebuilt.
|
sl@0
|
218 |
*/
|
sl@0
|
219 |
void TRegistrar_StateAccessor::DiscoveriesComplete(CRegistrar& aRegistrar,
|
sl@0
|
220 |
TBool aSuccessful)
|
sl@0
|
221 |
{
|
sl@0
|
222 |
aRegistrar.DiscoveriesComplete(aSuccessful, EPluginProcessingTypeAll);
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
/**
|
sl@0
|
226 |
Overload of the MDiscovererObserver callback method.
|
sl@0
|
227 |
Signals registry that the registered Interface Implementation
|
sl@0
|
228 |
Collections stored upon the specified drive are no
|
sl@0
|
229 |
longer available for use.
|
sl@0
|
230 |
|
sl@0
|
231 |
@param aRegistrar The CRegistrar class object under test
|
sl@0
|
232 |
@param aDrive The drive identifier.
|
sl@0
|
233 |
@pre CRegistrar is fully constructed.
|
sl@0
|
234 |
@post The registered Interface Implementation Collections
|
sl@0
|
235 |
stored upon the specified drive are no
|
sl@0
|
236 |
longer available for use.
|
sl@0
|
237 |
*/
|
sl@0
|
238 |
void TRegistrar_StateAccessor::DriveRemovedL(CRegistrar& aRegistrar,
|
sl@0
|
239 |
TDriveUnit aDrive)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
aRegistrar.DriveRemovedL(aDrive);
|
sl@0
|
242 |
}
|
sl@0
|
243 |
|
sl@0
|
244 |
/**
|
sl@0
|
245 |
Overload of the MDiscovererObserver callback method.
|
sl@0
|
246 |
Signals registry that the registered Interface
|
sl@0
|
247 |
Implementation Collections stored upon the specified drive are again
|
sl@0
|
248 |
available for use.
|
sl@0
|
249 |
|
sl@0
|
250 |
@param aRegistrar The CRegistrar class object under test
|
sl@0
|
251 |
@param aDrive The drive identifier.
|
sl@0
|
252 |
@pre CRegistrar is fully constructed.
|
sl@0
|
253 |
@post The registered Interface Implementation Collections
|
sl@0
|
254 |
stored upon the specified drive are again
|
sl@0
|
255 |
made available for use.
|
sl@0
|
256 |
*/
|
sl@0
|
257 |
void TRegistrar_StateAccessor::DriveReinstatedL(CRegistrar& aRegistrar,
|
sl@0
|
258 |
TDriveUnit aDrive)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
aRegistrar.DriveReinstatedL(aDrive);
|
sl@0
|
261 |
}
|
sl@0
|
262 |
|
sl@0
|
263 |
/**
|
sl@0
|
264 |
Overload of the MDiscovererObserver callback method.
|
sl@0
|
265 |
Adds the specified Interface Implementation Collection Entry to the registry.
|
sl@0
|
266 |
|
sl@0
|
267 |
@param aRegistrar The CRegistrar class object under test
|
sl@0
|
268 |
@param aDirEntry The plugin entry to register.
|
sl@0
|
269 |
@pre CRegistrar is fully constructed
|
sl@0
|
270 |
@post The plugin entry is registered.
|
sl@0
|
271 |
*/
|
sl@0
|
272 |
void TRegistrar_StateAccessor::RegisterDiscoveryL(CRegistrar& aRegistrar,
|
sl@0
|
273 |
const TDriveName& aDrive,
|
sl@0
|
274 |
CPluginBase*& aEntry,
|
sl@0
|
275 |
TBool aDatFileExists )
|
sl@0
|
276 |
{
|
sl@0
|
277 |
aRegistrar.RegisterDiscoveryL(aDrive,aEntry,aDatFileExists);
|
sl@0
|
278 |
}
|
sl@0
|
279 |
|
sl@0
|
280 |
/**
|
sl@0
|
281 |
Retrieves the object's current state.
|
sl@0
|
282 |
|
sl@0
|
283 |
@return TCRegistarState the CRegistrar's current state.
|
sl@0
|
284 |
@pre CRegistrar is fully constructed.
|
sl@0
|
285 |
@post the CRegistrar's current state has been returned.
|
sl@0
|
286 |
*/
|
sl@0
|
287 |
CRegistrar::TRegistrarState TRegistrar_StateAccessor::State(CRegistrar& aRegistrar)
|
sl@0
|
288 |
{
|
sl@0
|
289 |
return aRegistrar.State();
|
sl@0
|
290 |
}
|
sl@0
|
291 |
|
sl@0
|
292 |
/**
|
sl@0
|
293 |
TRegistryData_StateAccessor class allows access to private and protected
|
sl@0
|
294 |
members of production code class CRegistryData, as its a friend class.
|
sl@0
|
295 |
*/
|
sl@0
|
296 |
class TRegistryData_StateAccessor
|
sl@0
|
297 |
{
|
sl@0
|
298 |
public:
|
sl@0
|
299 |
TInt FindImplementation(CRegistryData& aRegistryData,
|
sl@0
|
300 |
const TUid aImplUid,
|
sl@0
|
301 |
const TUid aInterfaceUid,
|
sl@0
|
302 |
CRegistryData::CImplementationData*& aImplData) const;
|
sl@0
|
303 |
};
|
sl@0
|
304 |
|
sl@0
|
305 |
/**
|
sl@0
|
306 |
@return KErrNone if found otherwise KErrNotFound
|
sl@0
|
307 |
@param aRegistryData The CRegistryData class object
|
sl@0
|
308 |
@param aImplUid The implementation to find.
|
sl@0
|
309 |
@param aInterfaceUid If greater than 0 the interface associated with the
|
sl@0
|
310 |
implementation to find.
|
sl@0
|
311 |
@param aImplData The found implementation data.
|
sl@0
|
312 |
@pre CRegistrar is fully constructed
|
sl@0
|
313 |
*/
|
sl@0
|
314 |
TInt TRegistryData_StateAccessor::FindImplementation(CRegistryData& aRegistryData,
|
sl@0
|
315 |
const TUid aImplUid,
|
sl@0
|
316 |
const TUid aInterfaceUid,
|
sl@0
|
317 |
CRegistryData::CImplementationData*& aImplData) const
|
sl@0
|
318 |
{
|
sl@0
|
319 |
return aRegistryData.FindImplementation(aImplUid, aInterfaceUid, aImplData);
|
sl@0
|
320 |
}
|
sl@0
|
321 |
|
sl@0
|
322 |
|
sl@0
|
323 |
/**
|
sl@0
|
324 |
The implementation of the abstract Registrar Observer class,
|
sl@0
|
325 |
used for recieving notifications of registry changes.
|
sl@0
|
326 |
Stub class(for CEComServer) used for the creation of CRegistrar class object.
|
sl@0
|
327 |
CEComServer class acts as observer for CRegistrar.
|
sl@0
|
328 |
*/
|
sl@0
|
329 |
class CTestRegistrarObserver : public MRegistrarObserver // codescanner::missingcclass
|
sl@0
|
330 |
{
|
sl@0
|
331 |
public:
|
sl@0
|
332 |
// This function is used by RegistrarObserver (i.e.CEComServer) to notify its
|
sl@0
|
333 |
// clients(REComSession objects) that some change has happened in Registry.
|
sl@0
|
334 |
// Here we have no clients to notify, so no implementaion.
|
sl@0
|
335 |
void Notification( TInt /*aNotification*/ ) {}
|
sl@0
|
336 |
};
|
sl@0
|
337 |
|
sl@0
|
338 |
/**
|
sl@0
|
339 |
Test class for object CRegistrar.
|
sl@0
|
340 |
This class provides the parameters and behaviour that
|
sl@0
|
341 |
allows this class to behave normally under a test
|
sl@0
|
342 |
scenario.
|
sl@0
|
343 |
*/
|
sl@0
|
344 |
class CRegistrarTest : public CBase
|
sl@0
|
345 |
{
|
sl@0
|
346 |
public:
|
sl@0
|
347 |
|
sl@0
|
348 |
static CRegistrarTest* NewL(TBool aIsFullDiscovery);
|
sl@0
|
349 |
virtual ~CRegistrarTest();
|
sl@0
|
350 |
const CImplementationInformation * GetImplementationDataL();
|
sl@0
|
351 |
|
sl@0
|
352 |
void EnableDisableTestL();
|
sl@0
|
353 |
void ResumeSuspendTestL();
|
sl@0
|
354 |
void DiscoveriesBegin_Register_CompleteTestL();
|
sl@0
|
355 |
void DriveRemovedReinstatedTestL();
|
sl@0
|
356 |
void ParseTestL();
|
sl@0
|
357 |
void ParseType2TestL();
|
sl@0
|
358 |
void ParseType3TestL();
|
sl@0
|
359 |
void ParseType3BadDataTestL();
|
sl@0
|
360 |
void ParseRegistrationDataTestL();
|
sl@0
|
361 |
void ParseRegistrationDataType3TestL();
|
sl@0
|
362 |
void StateTransitionTestL();
|
sl@0
|
363 |
void ParseSpiRegistrationDataTestL();
|
sl@0
|
364 |
void ParseSpiRegistrationDataType3TestL();
|
sl@0
|
365 |
void ParseSpiTestL();
|
sl@0
|
366 |
void ParseSpiType3TestL();
|
sl@0
|
367 |
|
sl@0
|
368 |
private:
|
sl@0
|
369 |
CRegistrarTest();
|
sl@0
|
370 |
void ConstructL(TBool aIsFullDiscovery);
|
sl@0
|
371 |
void ParseBadDataTestL(const TDesC& aRscFullName, const TDesC& aRscNameOnly);
|
sl@0
|
372 |
public:
|
sl@0
|
373 |
/** The instance of the class under test */
|
sl@0
|
374 |
CRegistrar* iRegistrar;
|
sl@0
|
375 |
|
sl@0
|
376 |
/** The instance of the State Accessor class */
|
sl@0
|
377 |
TRegistrar_StateAccessor* iStateAccessor;
|
sl@0
|
378 |
|
sl@0
|
379 |
/** The registry data instance required to construct a CRegistrar object */
|
sl@0
|
380 |
CRegistryData* iRegistryData;
|
sl@0
|
381 |
|
sl@0
|
382 |
/** The instance of the Registry Data State Accessor class */
|
sl@0
|
383 |
TRegistryData_StateAccessor* iRegistryDataStateAccessor;
|
sl@0
|
384 |
|
sl@0
|
385 |
/** The instance of the observer of CRegistrar class */
|
sl@0
|
386 |
MRegistrarObserver* iRegistrarObserver;
|
sl@0
|
387 |
|
sl@0
|
388 |
/** The destination for the data discovered during a parse */
|
sl@0
|
389 |
CRegistryData::CDllData* iDllData;
|
sl@0
|
390 |
|
sl@0
|
391 |
/** Unique Id of the ECOM dll */
|
sl@0
|
392 |
TUid iDllUid;
|
sl@0
|
393 |
|
sl@0
|
394 |
/** Unique Id of an interface implementation */
|
sl@0
|
395 |
TUid iImplementationUid;
|
sl@0
|
396 |
|
sl@0
|
397 |
/** Unique Id of an interface */
|
sl@0
|
398 |
TUid iInterfaceUid;
|
sl@0
|
399 |
|
sl@0
|
400 |
/** The drive on which interface implementations can be found */
|
sl@0
|
401 |
TDriveUnit iDriveUnit;
|
sl@0
|
402 |
|
sl@0
|
403 |
/** Ecom plugin which contains interface implementations. Used in Registration APIs.*/
|
sl@0
|
404 |
TEntry iDllEntry;
|
sl@0
|
405 |
};
|
sl@0
|
406 |
|
sl@0
|
407 |
/**
|
sl@0
|
408 |
Standardised safe construction which
|
sl@0
|
409 |
leaves nothing on the cleanup stack.
|
sl@0
|
410 |
|
sl@0
|
411 |
@param aIsFullDiscovery whether the constructor make full discovery
|
sl@0
|
412 |
@post CRegistrarTest is fully constructed and initialised.
|
sl@0
|
413 |
*/
|
sl@0
|
414 |
CRegistrarTest* CRegistrarTest::NewL(TBool aIsFullDiscovery)
|
sl@0
|
415 |
{
|
sl@0
|
416 |
CRegistrarTest* self = new (ELeave) CRegistrarTest();
|
sl@0
|
417 |
CleanupStack::PushL(self);
|
sl@0
|
418 |
self->ConstructL(aIsFullDiscovery);
|
sl@0
|
419 |
CleanupStack::Pop(self);
|
sl@0
|
420 |
return self;
|
sl@0
|
421 |
}
|
sl@0
|
422 |
|
sl@0
|
423 |
/**
|
sl@0
|
424 |
Standardized default c'tor
|
sl@0
|
425 |
|
sl@0
|
426 |
@post CRegistrarTest is fully constructed.
|
sl@0
|
427 |
*/
|
sl@0
|
428 |
CRegistrarTest::CRegistrarTest()
|
sl@0
|
429 |
: CBase(),
|
sl@0
|
430 |
iDriveUnit(EDriveC)
|
sl@0
|
431 |
{
|
sl@0
|
432 |
iDllUid.iUid = 0x101F847B; // Dlluid for Ecom plugin EComExample5.dll
|
sl@0
|
433 |
iInterfaceUid.iUid = 0x10009DC0; // Interface uid for interface contained in above plugin
|
sl@0
|
434 |
iImplementationUid.iUid = 0x101f847C; // Implementaion uid for above interface
|
sl@0
|
435 |
TUid uid1 = {0};
|
sl@0
|
436 |
TUid uid2 = {0};
|
sl@0
|
437 |
iDllEntry.iType = TUidType(uid1, uid2, iDllUid);//Setting Dlluid to plugin entry
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
/**
|
sl@0
|
441 |
Destructor.
|
sl@0
|
442 |
|
sl@0
|
443 |
@post This object is properly destroyed.
|
sl@0
|
444 |
*/
|
sl@0
|
445 |
CRegistrarTest::~CRegistrarTest()
|
sl@0
|
446 |
{
|
sl@0
|
447 |
delete iDllData;
|
sl@0
|
448 |
delete iRegistrar;
|
sl@0
|
449 |
delete iRegistryData;
|
sl@0
|
450 |
delete iRegistrarObserver;
|
sl@0
|
451 |
delete iStateAccessor;
|
sl@0
|
452 |
delete iRegistryDataStateAccessor;
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
/**
|
sl@0
|
456 |
Standardized 2nd(Initialization) phase of two phase construction.
|
sl@0
|
457 |
|
sl@0
|
458 |
@param aIsFullDiscovery whether the constructor make full discovery
|
sl@0
|
459 |
@post CRegistrarTest is fully constructed.
|
sl@0
|
460 |
*/
|
sl@0
|
461 |
void CRegistrarTest::ConstructL(TBool aIsFullDiscovery)
|
sl@0
|
462 |
{
|
sl@0
|
463 |
CRegistryData::CDriveData* driveData=NULL;
|
sl@0
|
464 |
iRegistrarObserver = new (ELeave) CTestRegistrarObserver;
|
sl@0
|
465 |
iStateAccessor = new (ELeave) TRegistrar_StateAccessor;
|
sl@0
|
466 |
iRegistryDataStateAccessor = new (ELeave) TRegistryData_StateAccessor;
|
sl@0
|
467 |
iRegistryData = CRegistryData::NewL(TheFs);
|
sl@0
|
468 |
iRegistrar = CRegistrar::NewL(*iRegistryData, *iRegistrarObserver, TheFs);
|
sl@0
|
469 |
if(aIsFullDiscovery)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
iRegistrar->ProcessSSAEventL(EStartupStateNonCritical);
|
sl@0
|
472 |
}
|
sl@0
|
473 |
iDllData = CRegistryData::CDllData::NewLC(driveData);
|
sl@0
|
474 |
CleanupStack::Pop(iDllData);
|
sl@0
|
475 |
}
|
sl@0
|
476 |
|
sl@0
|
477 |
|
sl@0
|
478 |
/**
|
sl@0
|
479 |
Returns information of a particular interface implementation.
|
sl@0
|
480 |
|
sl@0
|
481 |
@return Information on the requested implementation
|
sl@0
|
482 |
@pre This object is fully constructed
|
sl@0
|
483 |
*/
|
sl@0
|
484 |
const CImplementationInformation * CRegistrarTest::GetImplementationDataL()
|
sl@0
|
485 |
{
|
sl@0
|
486 |
CRegistryData::CImplementationData *implementationData=NULL;
|
sl@0
|
487 |
TUid dummyUid;
|
sl@0
|
488 |
dummyUid.iUid = 0;
|
sl@0
|
489 |
User::LeaveIfError(iRegistryDataStateAccessor->FindImplementation(*iRegistryData, iImplementationUid,
|
sl@0
|
490 |
dummyUid, implementationData));
|
sl@0
|
491 |
return implementationData->iImplInfo;
|
sl@0
|
492 |
}
|
sl@0
|
493 |
|
sl@0
|
494 |
/**
|
sl@0
|
495 |
The test executes by first Disabling the Implementation then by
|
sl@0
|
496 |
Enabling it.
|
sl@0
|
497 |
|
sl@0
|
498 |
@SYMTestCaseID SYSLIB-ECOM-CT-0727
|
sl@0
|
499 |
@SYMTestCaseDesc Tests for enabling and disabling the Implementation
|
sl@0
|
500 |
@SYMTestPriority High
|
sl@0
|
501 |
@SYMTestActions Fetch the Implementation information for testing for iImplementationUid
|
sl@0
|
502 |
Disable and enable the implementation for the unique UID
|
sl@0
|
503 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
504 |
@SYMREQ REQ0000
|
sl@0
|
505 |
*/
|
sl@0
|
506 |
void CRegistrarTest::EnableDisableTestL()
|
sl@0
|
507 |
{
|
sl@0
|
508 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0727 "));
|
sl@0
|
509 |
const CImplementationInformation *implimentationInfo = NULL;
|
sl@0
|
510 |
|
sl@0
|
511 |
// Get the Implementation information for testing for iImplementationUid.
|
sl@0
|
512 |
// Implementation for iImplementationUid should be registered to
|
sl@0
|
513 |
// run this test successfully.
|
sl@0
|
514 |
TRAPD(err, implimentationInfo = GetImplementationDataL());
|
sl@0
|
515 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
516 |
test(err == KErrNone);
|
sl@0
|
517 |
test(implimentationInfo != NULL);
|
sl@0
|
518 |
|
sl@0
|
519 |
// Disable the implementaion
|
sl@0
|
520 |
err = iRegistrar->Disable(iImplementationUid);
|
sl@0
|
521 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
522 |
test(KErrNone == err);
|
sl@0
|
523 |
test(implimentationInfo->Disabled());//It should be disabled
|
sl@0
|
524 |
|
sl@0
|
525 |
|
sl@0
|
526 |
// Enable the implementaion
|
sl@0
|
527 |
err = iRegistrar->Enable(iImplementationUid);
|
sl@0
|
528 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
529 |
test(KErrNone == err);
|
sl@0
|
530 |
test(!implimentationInfo->Disabled());//It should be enabled
|
sl@0
|
531 |
}
|
sl@0
|
532 |
|
sl@0
|
533 |
/**
|
sl@0
|
534 |
The test executes by first suspending the discoverer then by resuming it.
|
sl@0
|
535 |
|
sl@0
|
536 |
@SYMTestCaseID SYSLIB-ECOM-CT-0728
|
sl@0
|
537 |
@SYMTestCaseDesc Tests for overloaded MBackupNotifierObserver's Suspend and Resume functions
|
sl@0
|
538 |
@SYMTestPriority High
|
sl@0
|
539 |
@SYMTestActions The test executes by first calling CRegistrar's suspend and then by resume.
|
sl@0
|
540 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
541 |
@SYMREQ REQ0000
|
sl@0
|
542 |
*/
|
sl@0
|
543 |
void CRegistrarTest::ResumeSuspendTestL()
|
sl@0
|
544 |
{
|
sl@0
|
545 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0728 "));
|
sl@0
|
546 |
TInt err = iRegistrar->Suspend();
|
sl@0
|
547 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
548 |
test(err == KErrNone);
|
sl@0
|
549 |
|
sl@0
|
550 |
err = iRegistrar->Resume();
|
sl@0
|
551 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
552 |
test(err == KErrNone);
|
sl@0
|
553 |
}
|
sl@0
|
554 |
|
sl@0
|
555 |
/**
|
sl@0
|
556 |
The test executes by calling DiscoveriesBegin, RegisterDiscoveryL and
|
sl@0
|
557 |
DiscoveriesComplete in sequence to register the plugin.
|
sl@0
|
558 |
|
sl@0
|
559 |
@SYMTestCaseID SYSLIB-ECOM-CT-0729
|
sl@0
|
560 |
@SYMTestCaseDesc Tests for registering the DLL interfaces
|
sl@0
|
561 |
@SYMTestPriority High
|
sl@0
|
562 |
@SYMTestActions Calls up DiscoveriesBegin, RegisterDiscoveryL and
|
sl@0
|
563 |
DiscoveriesComplete in sequence to register the plugin and
|
sl@0
|
564 |
verifies that DLL's have been registered succesfully.
|
sl@0
|
565 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
566 |
@SYMREQ REQ0000
|
sl@0
|
567 |
*/
|
sl@0
|
568 |
void CRegistrarTest::DiscoveriesBegin_Register_CompleteTestL()
|
sl@0
|
569 |
{
|
sl@0
|
570 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0729 "));
|
sl@0
|
571 |
// The following three steps need to be executed to successfully
|
sl@0
|
572 |
// register the plugin
|
sl@0
|
573 |
iStateAccessor->DiscoveriesBegin(*iRegistrar);
|
sl@0
|
574 |
|
sl@0
|
575 |
//-----------------REGISTRATION PART------------------------------------
|
sl@0
|
576 |
CPluginBase* entryBase=NULL;
|
sl@0
|
577 |
TInt err=KErrNone;
|
sl@0
|
578 |
TBool update = EFalse;
|
sl@0
|
579 |
TInt driveIndex = KErrNotFound; //Used as return parameter used below
|
sl@0
|
580 |
TBool isDriveRegistered = EFalse; //Used as return parameter used below
|
sl@0
|
581 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
582 |
|
sl@0
|
583 |
|
sl@0
|
584 |
//Testing a RSc based entry using EComExample5.dll and EComExample5.rsc
|
sl@0
|
585 |
TEntry rscBasedEntry;
|
sl@0
|
586 |
rscBasedEntry.iName=KNewResourceFileNameOnly;
|
sl@0
|
587 |
err = TheFs.Modified(KNewResourceFileNameC, rscBasedEntry.iModified);
|
sl@0
|
588 |
test(err==KErrNone);
|
sl@0
|
589 |
TParse rscPath;
|
sl@0
|
590 |
rscPath.Set(KNewResourceFileNameC,NULL,NULL);
|
sl@0
|
591 |
entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), ETrue);
|
sl@0
|
592 |
CleanupStack::PushL(entryBase);
|
sl@0
|
593 |
|
sl@0
|
594 |
//Now register this Rsc Entry with the registrar
|
sl@0
|
595 |
TRAP(err, iStateAccessor->RegisterDiscoveryL(*iRegistrar,rscPath.Drive(), entryBase,ETrue));
|
sl@0
|
596 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
597 |
test(err == KErrNone);
|
sl@0
|
598 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
599 |
entryBase=NULL;
|
sl@0
|
600 |
TRAP(err, driveIndex = iRegistryData->FindDriveL(iDriveUnit, driveData));
|
sl@0
|
601 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
602 |
test(driveIndex != KErrNotFound);
|
sl@0
|
603 |
//Verify weather dll interfaces got registered
|
sl@0
|
604 |
// Check whether Rsc based entry is already registered in CRegistryData
|
sl@0
|
605 |
|
sl@0
|
606 |
TRAP(err, isDriveRegistered = iRegistryData->IsRegisteredWithDate(
|
sl@0
|
607 |
NewDllUid,
|
sl@0
|
608 |
rscBasedEntry.iModified,
|
sl@0
|
609 |
update,
|
sl@0
|
610 |
driveData));
|
sl@0
|
611 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
612 |
test(err == KErrNone);
|
sl@0
|
613 |
test(isDriveRegistered);
|
sl@0
|
614 |
test(!update);// As plugin is just registered, it does not require update.
|
sl@0
|
615 |
|
sl@0
|
616 |
//THE REASON WHY THIS FUNCTION IS MOVED TO THE BACK AS IT PREVENT THE TESTING
|
sl@0
|
617 |
//OF THE LEGACY PLUGINS BEING REGISTERED AS DURING THE VALIDATE REGISTRY
|
sl@0
|
618 |
//THE LEGACY ENTRY WILL BE WIPED OUT
|
sl@0
|
619 |
iStateAccessor->DiscoveriesComplete(*iRegistrar, EFalse);
|
sl@0
|
620 |
test(iRegistrar != NULL);
|
sl@0
|
621 |
}
|
sl@0
|
622 |
|
sl@0
|
623 |
/**
|
sl@0
|
624 |
@SYMTestCaseID SYSLIB-ECOM-CT-0730
|
sl@0
|
625 |
@SYMTestCaseDesc Tests for CRegistrar::DriveRemovedL,DriveReinstatedL functions
|
sl@0
|
626 |
@SYMTestPriority High
|
sl@0
|
627 |
@SYMTestActions The test executes by first making the test drive uninstall and
|
sl@0
|
628 |
then testing for Install and Uninstall.
|
sl@0
|
629 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
630 |
@SYMREQ REQ0000
|
sl@0
|
631 |
*/
|
sl@0
|
632 |
void CRegistrarTest::DriveRemovedReinstatedTestL()
|
sl@0
|
633 |
{
|
sl@0
|
634 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0730 "));
|
sl@0
|
635 |
// We are checking with F Drive.
|
sl@0
|
636 |
// The test executes by first removing and then reinstalling
|
sl@0
|
637 |
const TTime modified(0); //Dummy parameter...
|
sl@0
|
638 |
TBool update = EFalse; //Dummy parameter...
|
sl@0
|
639 |
TBool isDriveRegistered = EFalse;
|
sl@0
|
640 |
TInt driveIndex = KErrNotFound;
|
sl@0
|
641 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
642 |
|
sl@0
|
643 |
iDriveUnit = EDriveF;
|
sl@0
|
644 |
TInt error = KErrNone;
|
sl@0
|
645 |
TRAP(error, driveIndex = iRegistryData->FindDriveL(iDriveUnit, driveData));
|
sl@0
|
646 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
647 |
TInt err = KErrNone;
|
sl@0
|
648 |
if(driveIndex != KErrNotFound)
|
sl@0
|
649 |
{
|
sl@0
|
650 |
TRAP(err, iRegistryData->IsRegisteredWithDate(
|
sl@0
|
651 |
iDllUid,
|
sl@0
|
652 |
modified,
|
sl@0
|
653 |
update,
|
sl@0
|
654 |
|
sl@0
|
655 |
driveData));
|
sl@0
|
656 |
|
sl@0
|
657 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
658 |
}
|
sl@0
|
659 |
|
sl@0
|
660 |
isDriveRegistered = (driveIndex != KErrNotFound);
|
sl@0
|
661 |
|
sl@0
|
662 |
//Remove the drive from registry if registered
|
sl@0
|
663 |
if(isDriveRegistered)
|
sl@0
|
664 |
{
|
sl@0
|
665 |
TRAP(err, iStateAccessor->DriveRemovedL( *iRegistrar, iDriveUnit));
|
sl@0
|
666 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
667 |
test(err == KErrNone);
|
sl@0
|
668 |
|
sl@0
|
669 |
//Call CRegistryData::IsRegisteredWithDate again to check its removed now
|
sl@0
|
670 |
driveIndex = KErrNotFound;
|
sl@0
|
671 |
TRAP(err, driveIndex = iRegistryData->FindDriveL(iDriveUnit, driveData));
|
sl@0
|
672 |
//Drive should not be present
|
sl@0
|
673 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
674 |
test(driveIndex == KErrNotFound);
|
sl@0
|
675 |
|
sl@0
|
676 |
}
|
sl@0
|
677 |
|
sl@0
|
678 |
|
sl@0
|
679 |
// Install the drive in registry
|
sl@0
|
680 |
TRAP(err, iStateAccessor->DriveReinstatedL(*iRegistrar, iDriveUnit));
|
sl@0
|
681 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
682 |
test(err == KErrNone);
|
sl@0
|
683 |
|
sl@0
|
684 |
//Call CRegistryData::IsRegisteredWithDate to check its Reinstalled now
|
sl@0
|
685 |
driveIndex = KErrNotFound;
|
sl@0
|
686 |
TRAP(err, driveIndex = iRegistryData->FindDriveL(iDriveUnit, driveData));
|
sl@0
|
687 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
688 |
//Drive should be present now
|
sl@0
|
689 |
test(driveIndex != KErrNotFound);
|
sl@0
|
690 |
TRAP(err, iRegistryData->IsRegisteredWithDate(
|
sl@0
|
691 |
iDllUid,
|
sl@0
|
692 |
modified,
|
sl@0
|
693 |
update,
|
sl@0
|
694 |
|
sl@0
|
695 |
driveData));
|
sl@0
|
696 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
697 |
test(err == KErrNone);
|
sl@0
|
698 |
|
sl@0
|
699 |
|
sl@0
|
700 |
//Remove the drive from registry if it was not registered before
|
sl@0
|
701 |
if(!isDriveRegistered)
|
sl@0
|
702 |
{
|
sl@0
|
703 |
TRAP(err, iStateAccessor->DriveRemovedL( *iRegistrar, iDriveUnit));
|
sl@0
|
704 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
705 |
test(err == KErrNone);
|
sl@0
|
706 |
|
sl@0
|
707 |
//Call CRegistryData::IsRegisteredWithDate again to check its removed now
|
sl@0
|
708 |
driveIndex = KErrNotFound;
|
sl@0
|
709 |
TRAP(err, driveIndex = iRegistryData->FindDriveL(iDriveUnit, driveData));
|
sl@0
|
710 |
//Drive should not be present
|
sl@0
|
711 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
712 |
test(driveIndex == KErrNotFound);
|
sl@0
|
713 |
}
|
sl@0
|
714 |
}
|
sl@0
|
715 |
|
sl@0
|
716 |
/**
|
sl@0
|
717 |
The test executes by parsing the Interface implementaion information
|
sl@0
|
718 |
from the given resource file.
|
sl@0
|
719 |
|
sl@0
|
720 |
@SYMTestCaseID SYSLIB-ECOM-CT-0731
|
sl@0
|
721 |
@SYMTestCaseDesc Tests for verification of Interface implementaion information
|
sl@0
|
722 |
@SYMTestPriority High
|
sl@0
|
723 |
@SYMTestActions Parse the resource information associated with an
|
sl@0
|
724 |
Interface Implementation Collection for entry into the registry
|
sl@0
|
725 |
information.Check for OOM error or parse error.
|
sl@0
|
726 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
727 |
@SYMREQ REQ0000
|
sl@0
|
728 |
*/
|
sl@0
|
729 |
void CRegistrarTest::ParseTestL()
|
sl@0
|
730 |
{
|
sl@0
|
731 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0731 "));
|
sl@0
|
732 |
TInt error=KErrNone;
|
sl@0
|
733 |
CPluginBase* entryBase=NULL;
|
sl@0
|
734 |
CRegistryData::CDllData* dllData=NULL;
|
sl@0
|
735 |
CRegistryData::CInterfaceData* ifData =NULL;
|
sl@0
|
736 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
737 |
|
sl@0
|
738 |
//Testing a RSC based entry using EComExample5.dll and EComExample5.rsc
|
sl@0
|
739 |
//(101F847B.RSS)
|
sl@0
|
740 |
TEntry rscBasedEntry;
|
sl@0
|
741 |
rscBasedEntry.iName=KNewResourceFileNameOnly;
|
sl@0
|
742 |
error = TheFs.Modified(KNewResourceFileNameC, rscBasedEntry.iModified);
|
sl@0
|
743 |
test(error==KErrNone);
|
sl@0
|
744 |
TParse rscPath;
|
sl@0
|
745 |
rscPath.Set(KNewResourceFileNameC,NULL,NULL);
|
sl@0
|
746 |
TDriveUnit driveUnit(rscPath.Drive());
|
sl@0
|
747 |
error=iRegistryData->FindDriveL(driveUnit,driveData);
|
sl@0
|
748 |
test(error!=KErrNotFound);
|
sl@0
|
749 |
entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), ETrue);
|
sl@0
|
750 |
CleanupStack::PushL(entryBase);
|
sl@0
|
751 |
dllData=CRegistryData::CDllData::NewLC(*(entryBase->iDllName),entryBase->iDllModifiedTime,entryBase->iDllSecondUid,entryBase->iDllThirdUid,driveData);
|
sl@0
|
752 |
|
sl@0
|
753 |
//Now testing the parseL function
|
sl@0
|
754 |
TRAP(error, iStateAccessor->ParseL(*iRegistrar,entryBase,*dllData));
|
sl@0
|
755 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
756 |
test(error == KErrNone);
|
sl@0
|
757 |
//Now checking the content of the DllData
|
sl@0
|
758 |
test(dllData->iIfList->Count()==1);
|
sl@0
|
759 |
ifData=(*(dllData->iIfList))[0];
|
sl@0
|
760 |
test(ifData->iInterfaceUid.iUid==0x10009DC0);
|
sl@0
|
761 |
test(ifData->iImplementations->Count()==1);
|
sl@0
|
762 |
|
sl@0
|
763 |
CleanupStack::PopAndDestroy(dllData);
|
sl@0
|
764 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
765 |
entryBase=NULL;
|
sl@0
|
766 |
dllData=NULL;
|
sl@0
|
767 |
ifData=NULL;
|
sl@0
|
768 |
}
|
sl@0
|
769 |
|
sl@0
|
770 |
/**
|
sl@0
|
771 |
The test executes by parsing the Interface implementation information with type 2 entries
|
sl@0
|
772 |
from the given resource file.
|
sl@0
|
773 |
|
sl@0
|
774 |
@SYMTestCaseID SYSLIB-ECOM-UT-3563
|
sl@0
|
775 |
@SYMTestCaseDesc Tests for verification of Interface implementation information with type 2 entries
|
sl@0
|
776 |
@SYMTestPriority High
|
sl@0
|
777 |
@SYMTestActions Parse the resource information associated with an
|
sl@0
|
778 |
Interface Implementation Collection type 2 for entry into the registry
|
sl@0
|
779 |
information.Check for OOM error or parse error.
|
sl@0
|
780 |
@SYMTestExpectedResults CRegistrar::ParseL() function parses resource file without error.
|
sl@0
|
781 |
Data is interpreted correctly.
|
sl@0
|
782 |
@SYMEC EC43
|
sl@0
|
783 |
*/
|
sl@0
|
784 |
void CRegistrarTest::ParseType2TestL()
|
sl@0
|
785 |
{
|
sl@0
|
786 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3563 "));
|
sl@0
|
787 |
TInt error = KErrNone;
|
sl@0
|
788 |
CPluginBase* entryBase = NULL;
|
sl@0
|
789 |
CRegistryData::CDllData* dllData = NULL;
|
sl@0
|
790 |
CRegistryData::CInterfaceData* ifData = NULL;
|
sl@0
|
791 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
792 |
TUid interfaceUidExample14 = {0x10009E36};
|
sl@0
|
793 |
|
sl@0
|
794 |
//Tests an RSC based entry using EComExample14.dll and EComExample14.rsc
|
sl@0
|
795 |
//(EcomExample14.RSS)
|
sl@0
|
796 |
TEntry rscBasedEntry;
|
sl@0
|
797 |
rscBasedEntry.iName = KType2ResourceFileNameOnly;
|
sl@0
|
798 |
error = TheFs.Modified(KType2ResourceFileNameC, rscBasedEntry.iModified);
|
sl@0
|
799 |
test(error == KErrNone);
|
sl@0
|
800 |
TParse rscPath;
|
sl@0
|
801 |
rscPath.Set(KType2ResourceFileNameC,NULL,NULL);
|
sl@0
|
802 |
TDriveUnit driveUnit(rscPath.Drive());
|
sl@0
|
803 |
error = iRegistryData->FindDriveL(driveUnit,driveData);
|
sl@0
|
804 |
test(error != KErrNotFound);
|
sl@0
|
805 |
entryBase = CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), ETrue);
|
sl@0
|
806 |
CleanupStack::PushL(entryBase);
|
sl@0
|
807 |
dllData = CRegistryData::CDllData::NewLC(*(entryBase->iDllName),entryBase->iDllModifiedTime,entryBase->iDllSecondUid,entryBase->iDllThirdUid,driveData);
|
sl@0
|
808 |
|
sl@0
|
809 |
//tests the parseL function
|
sl@0
|
810 |
TRAP(error, iStateAccessor->ParseL(*iRegistrar,entryBase,*dllData));
|
sl@0
|
811 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
812 |
test(error == KErrNone);
|
sl@0
|
813 |
//checks the content of the DllData
|
sl@0
|
814 |
test(dllData->iIfList->Count() == 1);
|
sl@0
|
815 |
ifData = (*(dllData->iIfList))[0];
|
sl@0
|
816 |
test(ifData->iInterfaceUid == interfaceUidExample14);
|
sl@0
|
817 |
CleanupStack::PopAndDestroy(dllData);
|
sl@0
|
818 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
819 |
}
|
sl@0
|
820 |
|
sl@0
|
821 |
/**
|
sl@0
|
822 |
The test executes by parsing the Interface implementation information with type 3 entries
|
sl@0
|
823 |
from the given resource file.
|
sl@0
|
824 |
|
sl@0
|
825 |
@SYMTestCaseID SYSLIB-ECOM-UT-3564
|
sl@0
|
826 |
@SYMTestCaseDesc Tests for verification of Interface implementation information with type 3 entries
|
sl@0
|
827 |
@SYMTestPriority High
|
sl@0
|
828 |
@SYMTestActions Parse the resource information associated with an
|
sl@0
|
829 |
Interface Implementation Collection type 3 for entry into the registry
|
sl@0
|
830 |
information.Check for OOM error or parse error.
|
sl@0
|
831 |
@SYMTestExpectedResults CRegistrar::ParseL() function parses resource file without error.
|
sl@0
|
832 |
Data is interpreted correctly.
|
sl@0
|
833 |
@SYMEC EC43
|
sl@0
|
834 |
*/
|
sl@0
|
835 |
void CRegistrarTest::ParseType3TestL()
|
sl@0
|
836 |
{
|
sl@0
|
837 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3564 "));
|
sl@0
|
838 |
TInt error = KErrNone;
|
sl@0
|
839 |
CPluginBase* entryBase = NULL;
|
sl@0
|
840 |
CRegistryData::CDllData* dllData = NULL;
|
sl@0
|
841 |
CRegistryData::CInterfaceData* ifData = NULL;
|
sl@0
|
842 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
843 |
CRegistryData::CImplementationData* implData = NULL;
|
sl@0
|
844 |
CImplementationInformation* implInfo = NULL;
|
sl@0
|
845 |
|
sl@0
|
846 |
//Tests an RSC based entry using EComExample12.dll and EComExample12.rsc
|
sl@0
|
847 |
//(EcomExample12.RSS)
|
sl@0
|
848 |
TEntry rscBasedEntry;
|
sl@0
|
849 |
rscBasedEntry.iName = KType3ResourceFileNameOnly;
|
sl@0
|
850 |
error = TheFs.Modified(KType3ResourceFileNameC, rscBasedEntry.iModified);
|
sl@0
|
851 |
test(error == KErrNone);
|
sl@0
|
852 |
TParse rscPath;
|
sl@0
|
853 |
rscPath.Set(KType3ResourceFileNameC,NULL,NULL);
|
sl@0
|
854 |
TDriveUnit driveUnit(rscPath.Drive());
|
sl@0
|
855 |
error = iRegistryData->FindDriveL(driveUnit,driveData);
|
sl@0
|
856 |
test(error != KErrNotFound);
|
sl@0
|
857 |
entryBase = CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), ETrue);
|
sl@0
|
858 |
CleanupStack::PushL(entryBase);
|
sl@0
|
859 |
dllData = CRegistryData::CDllData::NewLC(*(entryBase->iDllName),entryBase->iDllModifiedTime,entryBase->iDllSecondUid,entryBase->iDllThirdUid,driveData);
|
sl@0
|
860 |
|
sl@0
|
861 |
// Tests the parseL function
|
sl@0
|
862 |
TRAP(error, iStateAccessor->ParseL(*iRegistrar,entryBase,*dllData));
|
sl@0
|
863 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
864 |
test(error == KErrNone);
|
sl@0
|
865 |
// Checks the content of the DllData
|
sl@0
|
866 |
test(dllData->iIfList->Count() == 1);
|
sl@0
|
867 |
ifData = (*(dllData->iIfList))[0];
|
sl@0
|
868 |
test(ifData->iInterfaceUid == interfaceUidExample12);
|
sl@0
|
869 |
//Currently there are 3 implementations for this interface.
|
sl@0
|
870 |
//But the implementation(UID=0x10009E3D) is ROM-only but is actually in RAM will not be created.
|
sl@0
|
871 |
//So, actually number of implementations created for this interface is 2.
|
sl@0
|
872 |
test(ifData->iImplementations->Count() == 2);
|
sl@0
|
873 |
implData = (*(ifData->iImplementations))[0];
|
sl@0
|
874 |
implInfo = implData->iImplInfo;
|
sl@0
|
875 |
|
sl@0
|
876 |
// Fetches the list of extended interfaces for the first implementation
|
sl@0
|
877 |
RArray<TUid>* extendedInterfaceList = implInfo->GetExtendedInterfaceList();
|
sl@0
|
878 |
test(extendedInterfaceList->Count()==3);
|
sl@0
|
879 |
test((*extendedInterfaceList)[0] == extendedInterfaceUid1);
|
sl@0
|
880 |
test((*extendedInterfaceList)[1] == extendedInterfaceUid2);
|
sl@0
|
881 |
test((*extendedInterfaceList)[2] == extendedInterfaceUid3);
|
sl@0
|
882 |
CleanupStack::PopAndDestroy(dllData);
|
sl@0
|
883 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
884 |
}
|
sl@0
|
885 |
|
sl@0
|
886 |
|
sl@0
|
887 |
/** Wrapper function for testing ParseL function with type 3 entries
|
sl@0
|
888 |
and data in the resource file exceed maximum
|
sl@0
|
889 |
*/
|
sl@0
|
890 |
void CRegistrarTest::ParseBadDataTestL(const TDesC& aRscFullName, const TDesC& aRscNameOnly)
|
sl@0
|
891 |
{
|
sl@0
|
892 |
TInt error = KErrNone;
|
sl@0
|
893 |
CPluginBase* entryBase = NULL;
|
sl@0
|
894 |
CRegistryData::CDllData* dllData = NULL;
|
sl@0
|
895 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
896 |
|
sl@0
|
897 |
TEntry rscBasedEntry;
|
sl@0
|
898 |
rscBasedEntry.iName = aRscNameOnly;
|
sl@0
|
899 |
error = TheFs.Modified(aRscFullName, rscBasedEntry.iModified);
|
sl@0
|
900 |
test(error == KErrNone);
|
sl@0
|
901 |
TParse rscPath;
|
sl@0
|
902 |
rscPath.Set(aRscFullName,NULL,NULL);
|
sl@0
|
903 |
TDriveUnit driveUnit(rscPath.Drive());
|
sl@0
|
904 |
error = iRegistryData->FindDriveL(driveUnit,driveData);
|
sl@0
|
905 |
test(error != KErrNotFound);
|
sl@0
|
906 |
entryBase = CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), ETrue);
|
sl@0
|
907 |
CleanupStack::PushL(entryBase);
|
sl@0
|
908 |
dllData = CRegistryData::CDllData::NewLC(*(entryBase->iDllName),entryBase->iDllModifiedTime,entryBase->iDllSecondUid,entryBase->iDllThirdUid,driveData);
|
sl@0
|
909 |
|
sl@0
|
910 |
//Tests the parseL function
|
sl@0
|
911 |
TRAP(error, iStateAccessor->ParseL(*iRegistrar,entryBase,*dllData));
|
sl@0
|
912 |
test(error == KErrNotSupported);
|
sl@0
|
913 |
|
sl@0
|
914 |
CleanupStack::PopAndDestroy(dllData);
|
sl@0
|
915 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
916 |
}
|
sl@0
|
917 |
|
sl@0
|
918 |
|
sl@0
|
919 |
/**
|
sl@0
|
920 |
@SYMTestCaseID SYSLIB-ECOM-UT-3565
|
sl@0
|
921 |
@SYMTestCaseDesc Tests for verification of Interface implementation information with type 3 entries
|
sl@0
|
922 |
and data in the resource file exceed maximum.
|
sl@0
|
923 |
@SYMTestPriority High
|
sl@0
|
924 |
@SYMTestActions Parse the resource information associated with an
|
sl@0
|
925 |
Interface Implementation Collection type 3 for entry into the registry
|
sl@0
|
926 |
information.
|
sl@0
|
927 |
@SYMTestExpectedResults CRegistrar::ParseL() function parses resource file with KErrNotSupported leave occurs.
|
sl@0
|
928 |
@SYMEC EC43
|
sl@0
|
929 |
@SYMDEF DEF111196
|
sl@0
|
930 |
*/
|
sl@0
|
931 |
void CRegistrarTest::ParseType3BadDataTestL()
|
sl@0
|
932 |
{
|
sl@0
|
933 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3565 "));
|
sl@0
|
934 |
// Tests for number of strings of default data exceeds maximum
|
sl@0
|
935 |
// Uses EComExampleBadData.dll and EComExampleBadData.rsc (EcomExampleBadData.RSS)
|
sl@0
|
936 |
ParseBadDataTestL(KType3BadDataResourceFileNameC,KType3BadDataResourceFileNameOnly);
|
sl@0
|
937 |
|
sl@0
|
938 |
// Tests for number of interfaces exceeds maximum
|
sl@0
|
939 |
// Uses EComExampleBadData1.dll and EComExampleBadData1.rsc (EcomExampleBadData1.RSS)
|
sl@0
|
940 |
ParseBadDataTestL(KType3BadData1ResourceFileNameC,KType3BadData1ResourceFileNameOnly);
|
sl@0
|
941 |
|
sl@0
|
942 |
// Tests for number of implementation in one interfaces exceeds maximum
|
sl@0
|
943 |
// Uses EComExampleBadData2.dll and EComExampleBadData2.rsc (EcomExampleBadData2.RSS)
|
sl@0
|
944 |
ParseBadDataTestL(KType3BadData2ResourceFileNameC,KType3BadData2ResourceFileNameOnly);
|
sl@0
|
945 |
}
|
sl@0
|
946 |
|
sl@0
|
947 |
/**
|
sl@0
|
948 |
@SYMTestCaseID SYSLIB-ECOM-CT-0089
|
sl@0
|
949 |
@SYMTestCaseDesc Check that the ParseL for spi data works correctly.
|
sl@0
|
950 |
@SYMTestPriority High
|
sl@0
|
951 |
@SYMTestActions Ensure ecomtest.spi can be parsed successfully
|
sl@0
|
952 |
and no leave occurs.
|
sl@0
|
953 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
954 |
@SYMREQ REQ3655
|
sl@0
|
955 |
*/
|
sl@0
|
956 |
void CRegistrarTest::ParseSpiTestL()
|
sl@0
|
957 |
{
|
sl@0
|
958 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0089 "));
|
sl@0
|
959 |
TEntry spiEntry;
|
sl@0
|
960 |
TParse spiPath;
|
sl@0
|
961 |
if (TheFs.Entry(KEComSpiTestFilePathAndName, spiEntry) != KErrNone)
|
sl@0
|
962 |
return;
|
sl@0
|
963 |
|
sl@0
|
964 |
spiPath.Set(KEComSpiTestFilePathAndName,NULL,NULL);
|
sl@0
|
965 |
RResourceArchive resourceArchive;
|
sl@0
|
966 |
resourceArchive.OpenL(TheFs, KEComSpiTestFilePathAndName);
|
sl@0
|
967 |
CleanupClosePushL(resourceArchive);
|
sl@0
|
968 |
|
sl@0
|
969 |
// Checks SPI file type
|
sl@0
|
970 |
TUid type = resourceArchive.Type();
|
sl@0
|
971 |
test(type == KEcomSpiFileTypeUid);
|
sl@0
|
972 |
|
sl@0
|
973 |
// there is only 1 resource file
|
sl@0
|
974 |
CPluginBase* entryBase=NULL;
|
sl@0
|
975 |
CRegistryData::CDllData* dllData=NULL;
|
sl@0
|
976 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
977 |
|
sl@0
|
978 |
TDriveUnit driveUnit(spiPath.Drive());
|
sl@0
|
979 |
TInt error=iRegistryData->FindDriveL(driveUnit,driveData);
|
sl@0
|
980 |
test(error!=KErrNotFound);
|
sl@0
|
981 |
|
sl@0
|
982 |
while(!resourceArchive.End())
|
sl@0
|
983 |
{
|
sl@0
|
984 |
entryBase=CSpiPlugin::NewL(resourceArchive);
|
sl@0
|
985 |
CleanupStack::PushL(entryBase);
|
sl@0
|
986 |
dllData=CRegistryData::CDllData::NewLC(*(entryBase->iDllName),entryBase->iDllModifiedTime,entryBase->iDllSecondUid,entryBase->iDllThirdUid,driveData);
|
sl@0
|
987 |
TRAPD(err,iStateAccessor->ParseL(*iRegistrar,entryBase,*dllData));
|
sl@0
|
988 |
|
sl@0
|
989 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
990 |
test(err == KErrNone);
|
sl@0
|
991 |
CleanupStack::Pop(dllData);
|
sl@0
|
992 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
993 |
entryBase=NULL;
|
sl@0
|
994 |
}
|
sl@0
|
995 |
|
sl@0
|
996 |
CleanupStack::PopAndDestroy(&resourceArchive);
|
sl@0
|
997 |
|
sl@0
|
998 |
// Currently only one interface definition in the resource file
|
sl@0
|
999 |
const TInt ifCount = dllData->iIfList->Count();
|
sl@0
|
1000 |
test(ifCount == 1);
|
sl@0
|
1001 |
|
sl@0
|
1002 |
// Currently only one implemention for the above interface in the resource file
|
sl@0
|
1003 |
CRegistryData::CInterfaceData* ifData = (*(dllData->iIfList))[0];
|
sl@0
|
1004 |
const TInt impCount = ifData->iImplementations->Count();
|
sl@0
|
1005 |
test(impCount == 1);
|
sl@0
|
1006 |
// Interface UID verification
|
sl@0
|
1007 |
test(ifData->iInterfaceUid == iInterfaceUid);
|
sl@0
|
1008 |
|
sl@0
|
1009 |
delete dllData;
|
sl@0
|
1010 |
}
|
sl@0
|
1011 |
|
sl@0
|
1012 |
/**
|
sl@0
|
1013 |
@SYMTestCaseID SYSLIB-ECOM-UT-3566
|
sl@0
|
1014 |
@SYMTestCaseDesc Check that the ParseL for spi data with IIC Type 3 entry works correctly.
|
sl@0
|
1015 |
@SYMTestPriority High
|
sl@0
|
1016 |
@SYMTestActions Ensure ecomtesttype3.spi can be parsed successfully
|
sl@0
|
1017 |
and no leave occurs.
|
sl@0
|
1018 |
@SYMTestExpectedResults CRegistrar::ParseL() function parses SPI file without error.
|
sl@0
|
1019 |
Data is interpreted correctly.
|
sl@0
|
1020 |
@SYMEC EC43
|
sl@0
|
1021 |
*/
|
sl@0
|
1022 |
void CRegistrarTest::ParseSpiType3TestL()
|
sl@0
|
1023 |
{
|
sl@0
|
1024 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3566 "));
|
sl@0
|
1025 |
TEntry spiEntry;
|
sl@0
|
1026 |
TParse spiPath;
|
sl@0
|
1027 |
//"Z:\\Test\\Data\\ecomtesttype3.spi" is used for testing. The only resource file included
|
sl@0
|
1028 |
//in the spi file is EComExample12.RSC
|
sl@0
|
1029 |
if (TheFs.Entry(KEComSpiTestFileType3PathAndName, spiEntry) != KErrNone)
|
sl@0
|
1030 |
return;
|
sl@0
|
1031 |
|
sl@0
|
1032 |
spiPath.Set(KEComSpiTestFileType3PathAndName,NULL,NULL);
|
sl@0
|
1033 |
RResourceArchive resourceArchive;
|
sl@0
|
1034 |
resourceArchive.OpenL(TheFs, KEComSpiTestFileType3PathAndName);
|
sl@0
|
1035 |
CleanupClosePushL(resourceArchive);
|
sl@0
|
1036 |
|
sl@0
|
1037 |
// Checks SPI file type
|
sl@0
|
1038 |
TUid type = resourceArchive.Type();
|
sl@0
|
1039 |
test(type == KEcomSpiFileTypeUid);
|
sl@0
|
1040 |
|
sl@0
|
1041 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
1042 |
|
sl@0
|
1043 |
TDriveUnit driveUnit(spiPath.Drive());
|
sl@0
|
1044 |
TInt error=iRegistryData->FindDriveL(driveUnit,driveData);
|
sl@0
|
1045 |
test(error!=KErrNotFound);
|
sl@0
|
1046 |
// there is only 1 resource file in the spi file
|
sl@0
|
1047 |
while(!resourceArchive.End())
|
sl@0
|
1048 |
{
|
sl@0
|
1049 |
CPluginBase* entryBase = NULL;
|
sl@0
|
1050 |
entryBase=CSpiPlugin::NewL(resourceArchive);
|
sl@0
|
1051 |
CleanupStack::PushL(entryBase);
|
sl@0
|
1052 |
CRegistryData::CDllData* dllData = NULL;
|
sl@0
|
1053 |
dllData = CRegistryData::CDllData::NewLC(*(entryBase->iDllName),entryBase->iDllModifiedTime,entryBase->iDllSecondUid,entryBase->iDllThirdUid,driveData);
|
sl@0
|
1054 |
TRAPD(err,iStateAccessor->ParseL(*iRegistrar,entryBase,*dllData));
|
sl@0
|
1055 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
1056 |
test(err == KErrNone);
|
sl@0
|
1057 |
// Currently only one interface definition in the resource file
|
sl@0
|
1058 |
// Checks the content of the DllData
|
sl@0
|
1059 |
test(dllData->iIfList->Count() == 1);
|
sl@0
|
1060 |
CRegistryData::CInterfaceData* ifData = NULL;
|
sl@0
|
1061 |
ifData = (*(dllData->iIfList))[0];
|
sl@0
|
1062 |
//There are 3 implementations for the above interface in the spi file.
|
sl@0
|
1063 |
//Since ecomtesttype3.spi is under Z: drive which is ROM based,
|
sl@0
|
1064 |
//the implementation (UID=0x10009E3D) will be created during Parsing.
|
sl@0
|
1065 |
//So, the total implementations is 3.
|
sl@0
|
1066 |
test(ifData->iImplementations->Count() == 3);
|
sl@0
|
1067 |
// Interface UID verification
|
sl@0
|
1068 |
test(ifData->iInterfaceUid == interfaceUidExample12);
|
sl@0
|
1069 |
// Fetches the list of extended interfaces for the second implementation
|
sl@0
|
1070 |
//Currently we have no extended Interface for the second implementation
|
sl@0
|
1071 |
CRegistryData::CImplementationData* implData = NULL;
|
sl@0
|
1072 |
implData = (*(ifData->iImplementations))[1];
|
sl@0
|
1073 |
CImplementationInformation* implInfo = NULL;
|
sl@0
|
1074 |
implInfo = implData->iImplInfo;
|
sl@0
|
1075 |
|
sl@0
|
1076 |
RArray<TUid>* extendedInterfaceList = implInfo->GetExtendedInterfaceList();
|
sl@0
|
1077 |
test(extendedInterfaceList->Count() == 0);
|
sl@0
|
1078 |
CleanupStack::PopAndDestroy(dllData);
|
sl@0
|
1079 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
1080 |
}
|
sl@0
|
1081 |
CleanupStack::PopAndDestroy(&resourceArchive);
|
sl@0
|
1082 |
}
|
sl@0
|
1083 |
|
sl@0
|
1084 |
/**
|
sl@0
|
1085 |
The test executes by registering the Interface implementaion information
|
sl@0
|
1086 |
for an plugin entry.
|
sl@0
|
1087 |
|
sl@0
|
1088 |
@SYMTestCaseID SYSLIB-ECOM-CT-0732
|
sl@0
|
1089 |
@SYMTestCaseDesc Tests for CRegistrar::ParseRegistrationDataL() function
|
sl@0
|
1090 |
@SYMTestPriority High
|
sl@0
|
1091 |
@SYMTestActions Checks for directory entry for an Interface Implementation
|
sl@0
|
1092 |
Collection entry requires registration.Parses the associated resource file information where necessary
|
sl@0
|
1093 |
Checks for OOM or parsing error.
|
sl@0
|
1094 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
1095 |
@SYMREQ REQ0000
|
sl@0
|
1096 |
*/
|
sl@0
|
1097 |
void CRegistrarTest::ParseRegistrationDataTestL()
|
sl@0
|
1098 |
{
|
sl@0
|
1099 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0732 "));
|
sl@0
|
1100 |
TInt error=KErrNone;
|
sl@0
|
1101 |
TTime modified(0); //Dummy parameter...
|
sl@0
|
1102 |
TBool update = EFalse; //Dummy parameter...
|
sl@0
|
1103 |
TInt driveIndex = KErrNotFound;
|
sl@0
|
1104 |
CRegistryData::CImplementationData *implementationData = NULL;
|
sl@0
|
1105 |
CPluginBase* entryBase=NULL;
|
sl@0
|
1106 |
TUid implementationUid;
|
sl@0
|
1107 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
1108 |
|
sl@0
|
1109 |
// Calling RegistryData->IsRegisteredWithDate to get the drive index,
|
sl@0
|
1110 |
// that will be used in the ParseRegistrationDataL call
|
sl@0
|
1111 |
// The drive should have been installed before registering any plugin
|
sl@0
|
1112 |
TRAP(error, driveIndex = iRegistryData->FindDriveL(iDriveUnit, driveData));
|
sl@0
|
1113 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
1114 |
test(driveIndex != KErrNotFound);
|
sl@0
|
1115 |
TRAP(error, iRegistryData->IsRegisteredWithDate(
|
sl@0
|
1116 |
NewDllUid,
|
sl@0
|
1117 |
modified,
|
sl@0
|
1118 |
update,
|
sl@0
|
1119 |
|
sl@0
|
1120 |
driveData));
|
sl@0
|
1121 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
1122 |
test(error == KErrNone);
|
sl@0
|
1123 |
|
sl@0
|
1124 |
//Creating the entry
|
sl@0
|
1125 |
TEntry rscBasedEntry;
|
sl@0
|
1126 |
rscBasedEntry.iName=KNewResourceFileNameOnly;
|
sl@0
|
1127 |
error = TheFs.Modified(KNewResourceFileNameC, rscBasedEntry.iModified);
|
sl@0
|
1128 |
test(error==KErrNone);
|
sl@0
|
1129 |
TParse rscPath;
|
sl@0
|
1130 |
rscPath.Set(KNewResourceFileNameC,NULL,NULL);
|
sl@0
|
1131 |
entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
|
sl@0
|
1132 |
CleanupStack::PushL(entryBase);
|
sl@0
|
1133 |
|
sl@0
|
1134 |
//Trying to parse the registration data
|
sl@0
|
1135 |
update=ETrue;
|
sl@0
|
1136 |
TRAP(error,iStateAccessor->ParseRegistrationDataL(*iRegistrar,entryBase,iDriveUnit,update,driveIndex, driveData));
|
sl@0
|
1137 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
1138 |
test(error == KErrNone);
|
sl@0
|
1139 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
1140 |
|
sl@0
|
1141 |
// Calling DiscoveriesComplete for building the registry indexes
|
sl@0
|
1142 |
// as registration of new plugin has happened.
|
sl@0
|
1143 |
iStateAccessor->DiscoveriesComplete(*iRegistrar, EFalse);
|
sl@0
|
1144 |
|
sl@0
|
1145 |
//Now checking whether the implementation is already registered in the CRegistryData
|
sl@0
|
1146 |
//The only implementation Uid in EComExample5. see 101F847B.RSS
|
sl@0
|
1147 |
implementationUid=TUid::Uid(0x101F847C);
|
sl@0
|
1148 |
TUid dummyUid;
|
sl@0
|
1149 |
dummyUid.iUid = 0;
|
sl@0
|
1150 |
error = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, implementationUid, dummyUid, implementationData);
|
sl@0
|
1151 |
test(error == KErrNone);
|
sl@0
|
1152 |
test(implementationData != NULL);
|
sl@0
|
1153 |
|
sl@0
|
1154 |
}
|
sl@0
|
1155 |
|
sl@0
|
1156 |
/**
|
sl@0
|
1157 |
The test executes by registering the Interface implementation information
|
sl@0
|
1158 |
for an plugin with type 3 entry.
|
sl@0
|
1159 |
|
sl@0
|
1160 |
@SYMTestCaseID SYSLIB-ECOM-UT-3567
|
sl@0
|
1161 |
@SYMTestCaseDesc Tests for CRegistrar::ParseRegistrationDataL() function
|
sl@0
|
1162 |
@SYMTestPriority High
|
sl@0
|
1163 |
@SYMTestActions Checks for directory entry for an Interface Implementation
|
sl@0
|
1164 |
Collection with Type 3 entry requires registration.Parses the associated resource file information where necessary
|
sl@0
|
1165 |
@SYMTestExpectedResults CRegistrar::ParseRegistrationDataL() function parses resource file and registers
|
sl@0
|
1166 |
implementations correctly.
|
sl@0
|
1167 |
@SYMEC EC43
|
sl@0
|
1168 |
*/
|
sl@0
|
1169 |
void CRegistrarTest::ParseRegistrationDataType3TestL()
|
sl@0
|
1170 |
{
|
sl@0
|
1171 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3567 "));
|
sl@0
|
1172 |
TInt error=KErrNone;
|
sl@0
|
1173 |
TTime modified(0); //Dummy parameter...
|
sl@0
|
1174 |
TBool update = EFalse; //Dummy parameter...
|
sl@0
|
1175 |
TInt driveIndex = KErrNotFound;
|
sl@0
|
1176 |
CRegistryData::CImplementationData *implementationData = NULL;
|
sl@0
|
1177 |
CPluginBase* entryBase = NULL;
|
sl@0
|
1178 |
TUid implementationUid;
|
sl@0
|
1179 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
1180 |
|
sl@0
|
1181 |
// Calls iRegistryData->FindDriveL to get the drive index,
|
sl@0
|
1182 |
// that will be used in the ParseRegistrationDataL call.
|
sl@0
|
1183 |
// The drive should have been installed before registering any plugin
|
sl@0
|
1184 |
TRAP(error, driveIndex = iRegistryData->FindDriveL(iDriveUnit, driveData));
|
sl@0
|
1185 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
1186 |
test(driveIndex != KErrNotFound);
|
sl@0
|
1187 |
// Calls iRegistryData->IsRegisteredWithDate to determine if the entry in the registry needs an update.
|
sl@0
|
1188 |
iRegistryData->IsRegisteredWithDate(Type3DllUid, modified, update, driveData);
|
sl@0
|
1189 |
|
sl@0
|
1190 |
//Creates the entry
|
sl@0
|
1191 |
TEntry rscBasedEntry;
|
sl@0
|
1192 |
rscBasedEntry.iName = KType3ResourceFileNameOnly;
|
sl@0
|
1193 |
error = TheFs.Modified(KType3ResourceFileNameC, rscBasedEntry.iModified);
|
sl@0
|
1194 |
test(error == KErrNone);
|
sl@0
|
1195 |
TParse rscPath;
|
sl@0
|
1196 |
rscPath.Set(KType3ResourceFileNameC,NULL,NULL);
|
sl@0
|
1197 |
entryBase = CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
|
sl@0
|
1198 |
CleanupStack::PushL(entryBase);
|
sl@0
|
1199 |
|
sl@0
|
1200 |
//Try to parse the registration data
|
sl@0
|
1201 |
TRAP(error,iStateAccessor->ParseRegistrationDataL(*iRegistrar,entryBase,iDriveUnit,update,driveIndex, driveData));
|
sl@0
|
1202 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
1203 |
test(error == KErrNone);
|
sl@0
|
1204 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
1205 |
|
sl@0
|
1206 |
// Calls DiscoveriesComplete for building the registry indexes
|
sl@0
|
1207 |
// as registration of new plugin has happened.
|
sl@0
|
1208 |
iStateAccessor->DiscoveriesComplete(*iRegistrar, EFalse);
|
sl@0
|
1209 |
|
sl@0
|
1210 |
// Checks whether the implementations are already registered in the CRegistryData
|
sl@0
|
1211 |
//The implementation Uids in EComExample12 are 0x10009E39, 0x10009E3C and 0x10009E3D
|
sl@0
|
1212 |
// Checks implementation 0x10009E39
|
sl@0
|
1213 |
implementationUid = TUid::Uid(0x10009E39);
|
sl@0
|
1214 |
TUid dummyUid;
|
sl@0
|
1215 |
dummyUid.iUid = 0;
|
sl@0
|
1216 |
error = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, implementationUid, dummyUid, implementationData);
|
sl@0
|
1217 |
test(error == KErrNone);
|
sl@0
|
1218 |
test(implementationData != NULL);
|
sl@0
|
1219 |
// Checks implementation 0x10009E3C
|
sl@0
|
1220 |
implementationUid = TUid::Uid(0x10009E3C);
|
sl@0
|
1221 |
dummyUid.iUid = 0;
|
sl@0
|
1222 |
error = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, implementationUid, dummyUid, implementationData);
|
sl@0
|
1223 |
test(error == KErrNone);
|
sl@0
|
1224 |
test(implementationData != NULL);
|
sl@0
|
1225 |
// Checks implementation 0x10009E3D
|
sl@0
|
1226 |
// This implementation is said it's ROM-only but is actually in RAM.
|
sl@0
|
1227 |
// So, this implementation will not be created.
|
sl@0
|
1228 |
implementationUid = TUid::Uid(0x10009E3D);
|
sl@0
|
1229 |
dummyUid.iUid = 0;
|
sl@0
|
1230 |
error = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, implementationUid, dummyUid, implementationData);
|
sl@0
|
1231 |
test(error == KErrNotFound);
|
sl@0
|
1232 |
test(implementationData == NULL);
|
sl@0
|
1233 |
}
|
sl@0
|
1234 |
|
sl@0
|
1235 |
/**
|
sl@0
|
1236 |
@SYMTestCaseID SYSLIB-ECOM-CT-0090
|
sl@0
|
1237 |
@SYMTestCaseDesc Check that the ParseL for spi data works correctly.
|
sl@0
|
1238 |
@SYMTestPriority High
|
sl@0
|
1239 |
@SYMTestActions Ensure ecomtest.spi can be parsed successfully
|
sl@0
|
1240 |
and no leave occurred.
|
sl@0
|
1241 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
1242 |
@SYMREQ REQ3655
|
sl@0
|
1243 |
*/
|
sl@0
|
1244 |
void CRegistrarTest::ParseSpiRegistrationDataTestL()
|
sl@0
|
1245 |
{
|
sl@0
|
1246 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0090 "));
|
sl@0
|
1247 |
TDriveUnit driveUnit(EDriveZ);
|
sl@0
|
1248 |
TEntry spiEntry;
|
sl@0
|
1249 |
test(TheFs.Entry(KEComSpiTestFilePathAndName, spiEntry) == KErrNone);
|
sl@0
|
1250 |
TParse spiPath;
|
sl@0
|
1251 |
spiPath.Set(KEComSpiTestFilePathAndName, NULL, NULL);
|
sl@0
|
1252 |
|
sl@0
|
1253 |
RResourceArchive resourceArchive;
|
sl@0
|
1254 |
resourceArchive.OpenL(TheFs, KEComSpiTestFilePathAndName);
|
sl@0
|
1255 |
CleanupClosePushL(resourceArchive);
|
sl@0
|
1256 |
|
sl@0
|
1257 |
// Checks SPI file type
|
sl@0
|
1258 |
TUid type = resourceArchive.Type();
|
sl@0
|
1259 |
test(type == KEcomSpiFileTypeUid);
|
sl@0
|
1260 |
|
sl@0
|
1261 |
CPluginBase* entryBase=NULL;
|
sl@0
|
1262 |
// there is only 1 resource file
|
sl@0
|
1263 |
while(!resourceArchive.End())
|
sl@0
|
1264 |
{
|
sl@0
|
1265 |
const TTime modified(0); //Dummy parameter...
|
sl@0
|
1266 |
TBool update = EFalse; //Dummy parameter...
|
sl@0
|
1267 |
TInt driveIndex = KErrNotFound;
|
sl@0
|
1268 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
1269 |
|
sl@0
|
1270 |
// Calls RegistryData->IsRegisteredWithDate to get the drive index,
|
sl@0
|
1271 |
// that will be used in the ParseRegistrationDataL call
|
sl@0
|
1272 |
// The drive should have been installed before registering any plugin
|
sl@0
|
1273 |
TRAPD(error, driveIndex = iRegistryData->FindDriveL(driveUnit, driveData));
|
sl@0
|
1274 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
1275 |
test(driveIndex != KErrNotFound);
|
sl@0
|
1276 |
TRAPD(err, (void)iRegistryData->IsRegisteredWithDate(
|
sl@0
|
1277 |
|
sl@0
|
1278 |
iDllUid,
|
sl@0
|
1279 |
modified,
|
sl@0
|
1280 |
update,
|
sl@0
|
1281 |
|
sl@0
|
1282 |
driveData));
|
sl@0
|
1283 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
1284 |
test(err == KErrNone);
|
sl@0
|
1285 |
|
sl@0
|
1286 |
|
sl@0
|
1287 |
entryBase=CSpiPlugin::NewL(resourceArchive);
|
sl@0
|
1288 |
CleanupStack::PushL(entryBase);
|
sl@0
|
1289 |
|
sl@0
|
1290 |
TRAP(err, iStateAccessor->ParseRegistrationDataL(*iRegistrar,
|
sl@0
|
1291 |
entryBase,
|
sl@0
|
1292 |
driveUnit,
|
sl@0
|
1293 |
update,
|
sl@0
|
1294 |
driveIndex,
|
sl@0
|
1295 |
driveData));
|
sl@0
|
1296 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
1297 |
test(err == KErrNone);
|
sl@0
|
1298 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
1299 |
entryBase = NULL;
|
sl@0
|
1300 |
}
|
sl@0
|
1301 |
|
sl@0
|
1302 |
CleanupStack::PopAndDestroy(&resourceArchive);
|
sl@0
|
1303 |
|
sl@0
|
1304 |
// Calls DiscoveriesComplete for building the registry indexes
|
sl@0
|
1305 |
// as registration of new plugin has happened.
|
sl@0
|
1306 |
iStateAccessor->DiscoveriesComplete(*iRegistrar, EFalse);
|
sl@0
|
1307 |
|
sl@0
|
1308 |
CRegistryData::CImplementationData *implementationData = NULL;
|
sl@0
|
1309 |
TUid dummyUid;
|
sl@0
|
1310 |
dummyUid.iUid = 0;
|
sl@0
|
1311 |
TInt err = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, dummyUid, implementationData);
|
sl@0
|
1312 |
test(err == KErrNone);
|
sl@0
|
1313 |
test(implementationData != NULL);
|
sl@0
|
1314 |
}
|
sl@0
|
1315 |
|
sl@0
|
1316 |
/**
|
sl@0
|
1317 |
@SYMTestCaseID SYSLIB-ECOM-UT-3568
|
sl@0
|
1318 |
@SYMTestCaseDesc Check that the ParseL for spi data works correctly.
|
sl@0
|
1319 |
@SYMTestPriority High
|
sl@0
|
1320 |
@SYMTestActions Ensure ecomtesttype3.spi can be parsed successfully
|
sl@0
|
1321 |
and no leave occurs.
|
sl@0
|
1322 |
@SYMTestExpectedResults CRegistrar::ParseRegistrationDataL() function parses SPI file and registers
|
sl@0
|
1323 |
implementations correctly.
|
sl@0
|
1324 |
@SYMEC EC43
|
sl@0
|
1325 |
*/
|
sl@0
|
1326 |
void CRegistrarTest::ParseSpiRegistrationDataType3TestL()
|
sl@0
|
1327 |
{
|
sl@0
|
1328 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3568 "));
|
sl@0
|
1329 |
TDriveUnit driveUnit(EDriveZ);
|
sl@0
|
1330 |
TEntry spiEntry;
|
sl@0
|
1331 |
//"Z:\\Test\\Data\\ecomtesttype3.spi" is used for testing. The only resource file included
|
sl@0
|
1332 |
//in the spi file is EComExample12.RSC
|
sl@0
|
1333 |
test(TheFs.Entry(KEComSpiTestFileType3PathAndName, spiEntry) == KErrNone);
|
sl@0
|
1334 |
TParse spiPath;
|
sl@0
|
1335 |
spiPath.Set(KEComSpiTestFileType3PathAndName, NULL, NULL);
|
sl@0
|
1336 |
|
sl@0
|
1337 |
RResourceArchive resourceArchive;
|
sl@0
|
1338 |
resourceArchive.OpenL(TheFs, KEComSpiTestFileType3PathAndName);
|
sl@0
|
1339 |
CleanupClosePushL(resourceArchive);
|
sl@0
|
1340 |
|
sl@0
|
1341 |
// Checks SPI file type
|
sl@0
|
1342 |
TUid type = resourceArchive.Type();
|
sl@0
|
1343 |
test(type == KEcomSpiFileTypeUid);
|
sl@0
|
1344 |
|
sl@0
|
1345 |
CPluginBase* entryBase = NULL;
|
sl@0
|
1346 |
// there is only 1 resource file in the spi file
|
sl@0
|
1347 |
while(!resourceArchive.End())
|
sl@0
|
1348 |
{
|
sl@0
|
1349 |
const TTime modified(0); //Dummy parameter...
|
sl@0
|
1350 |
TBool update = EFalse; //Dummy parameter...
|
sl@0
|
1351 |
TInt driveIndex = KErrNotFound;
|
sl@0
|
1352 |
CRegistryData::CDriveData* driveData = NULL;
|
sl@0
|
1353 |
|
sl@0
|
1354 |
// Calls RegistryData->FindDriveL to get the drive index,
|
sl@0
|
1355 |
// that will be used in the ParseRegistrationDataL call.
|
sl@0
|
1356 |
// The drive should have been installed before registering any plugin
|
sl@0
|
1357 |
TRAPD(error, driveIndex = iRegistryData->FindDriveL(driveUnit, driveData));
|
sl@0
|
1358 |
::LeaveIfErrNoMemory(error);
|
sl@0
|
1359 |
test(driveIndex != KErrNotFound);
|
sl@0
|
1360 |
iRegistryData->IsRegisteredWithDate(Type3DllUid,modified,update,driveData);
|
sl@0
|
1361 |
|
sl@0
|
1362 |
entryBase=CSpiPlugin::NewL(resourceArchive);
|
sl@0
|
1363 |
CleanupStack::PushL(entryBase);
|
sl@0
|
1364 |
|
sl@0
|
1365 |
TRAPD(err, iStateAccessor->ParseRegistrationDataL(*iRegistrar,
|
sl@0
|
1366 |
entryBase,
|
sl@0
|
1367 |
driveUnit,
|
sl@0
|
1368 |
update,
|
sl@0
|
1369 |
driveIndex,
|
sl@0
|
1370 |
driveData));
|
sl@0
|
1371 |
::LeaveIfErrNoMemory(err);
|
sl@0
|
1372 |
test(err == KErrNone);
|
sl@0
|
1373 |
CleanupStack::PopAndDestroy(entryBase);
|
sl@0
|
1374 |
entryBase = NULL;
|
sl@0
|
1375 |
}
|
sl@0
|
1376 |
|
sl@0
|
1377 |
CleanupStack::PopAndDestroy(&resourceArchive);
|
sl@0
|
1378 |
|
sl@0
|
1379 |
// Calls DiscoveriesComplete for building the registry indexes
|
sl@0
|
1380 |
// as registration of new plugin has happened.
|
sl@0
|
1381 |
iStateAccessor->DiscoveriesComplete(*iRegistrar, EFalse);
|
sl@0
|
1382 |
|
sl@0
|
1383 |
CRegistryData::CImplementationData *implementationData=NULL;
|
sl@0
|
1384 |
// Checks whether the implementations are already registered in the CRegistryData
|
sl@0
|
1385 |
// The implementation Uids in EComExample12 are 0x10009E39, 0x10009E3C and 0x10009E3D
|
sl@0
|
1386 |
// Checks implementation 0x10009E39
|
sl@0
|
1387 |
TUid implementationUid = TUid::Uid(0x10009E39);
|
sl@0
|
1388 |
TUid dummyUid;
|
sl@0
|
1389 |
dummyUid.iUid = 0;
|
sl@0
|
1390 |
TInt error = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, implementationUid, dummyUid, implementationData);
|
sl@0
|
1391 |
test(error == KErrNone);
|
sl@0
|
1392 |
test(implementationData != NULL);
|
sl@0
|
1393 |
// Checks implementation 0x10009E3C
|
sl@0
|
1394 |
implementationUid = TUid::Uid(0x10009E3C);
|
sl@0
|
1395 |
dummyUid.iUid = 0;
|
sl@0
|
1396 |
error = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, implementationUid, dummyUid, implementationData);
|
sl@0
|
1397 |
test(error == KErrNone);
|
sl@0
|
1398 |
test(implementationData != NULL);
|
sl@0
|
1399 |
// Checks implementation 0x10009E3D
|
sl@0
|
1400 |
// Since ecomtesttype3.spi is under Z: drive which is ROM based,
|
sl@0
|
1401 |
// the implementation (UID=0x10009E3D) will be created during Parsing.
|
sl@0
|
1402 |
implementationUid = TUid::Uid(0x10009E3D);
|
sl@0
|
1403 |
dummyUid.iUid = 0;
|
sl@0
|
1404 |
error = iRegistryDataStateAccessor->FindImplementation(*iRegistryData, implementationUid, dummyUid, implementationData);
|
sl@0
|
1405 |
test(error == KErrNone);
|
sl@0
|
1406 |
test(implementationData != NULL);
|
sl@0
|
1407 |
}
|
sl@0
|
1408 |
|
sl@0
|
1409 |
/**
|
sl@0
|
1410 |
@SYMTestCaseID SYSLIB-ECOM-CT-0184
|
sl@0
|
1411 |
@SYMTestCaseDesc Check that SSA related states transition as expected when registration is staged
|
sl@0
|
1412 |
@SYMTestPriority High
|
sl@0
|
1413 |
@SYMTestActions Use CRegistrar::ProcessSSAEventL to start registration in stages i.e. rom only
|
sl@0
|
1414 |
then non rom only. Check that the
|
sl@0
|
1415 |
CRegistrar state is transitioning correctly at every step.
|
sl@0
|
1416 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
1417 |
@SYMPREQ PREQ967
|
sl@0
|
1418 |
*/
|
sl@0
|
1419 |
void CRegistrarTest::StateTransitionTestL()
|
sl@0
|
1420 |
{
|
sl@0
|
1421 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0184 "));
|
sl@0
|
1422 |
//After construction check that initial state is EReg_StartupInProgess
|
sl@0
|
1423 |
test(iStateAccessor->State(*iRegistrar) == CRegistrar::EReg_StartupInProgess);
|
sl@0
|
1424 |
|
sl@0
|
1425 |
//Call ProcessSSAEventL with EStartupStateUndefined. Check that state
|
sl@0
|
1426 |
// is not changed. i.e. still EReg_StartupInProgess
|
sl@0
|
1427 |
iRegistrar->ProcessSSAEventL(EStartupStateUndefined);
|
sl@0
|
1428 |
test(iStateAccessor->State(*iRegistrar) == CRegistrar::EReg_StartupInProgess);
|
sl@0
|
1429 |
|
sl@0
|
1430 |
//Call ProcessSSAEventL with EStartupStateCriticalStatic. Check that state
|
sl@0
|
1431 |
// is not changed. i.e. still EReg_StartupInProgess
|
sl@0
|
1432 |
iRegistrar->ProcessSSAEventL(EStartupStateCriticalStatic);
|
sl@0
|
1433 |
test(iStateAccessor->State(*iRegistrar) == CRegistrar::EReg_StartupInProgess);
|
sl@0
|
1434 |
|
sl@0
|
1435 |
//Call ProcessSSAEventL with EStartupStateCriticalDynamic. Check that state
|
sl@0
|
1436 |
// is not changed. i.e. still EReg_StartupInProgess
|
sl@0
|
1437 |
iRegistrar->ProcessSSAEventL(EStartupStateCriticalDynamic);
|
sl@0
|
1438 |
test(iStateAccessor->State(*iRegistrar) == CRegistrar::EReg_StartupInProgess);
|
sl@0
|
1439 |
|
sl@0
|
1440 |
//Call ProcessSSAEventL with EStartupStateNonCritical. Check that state
|
sl@0
|
1441 |
//is changed to EReg_StartupComplete
|
sl@0
|
1442 |
iRegistrar->ProcessSSAEventL(EStartupStateNonCritical);
|
sl@0
|
1443 |
test(iStateAccessor->State(*iRegistrar) == CRegistrar::EReg_StartupComplete);
|
sl@0
|
1444 |
}
|
sl@0
|
1445 |
|
sl@0
|
1446 |
/**
|
sl@0
|
1447 |
@SYMTestCaseID SYSLIB-ECOM-CT-0733
|
sl@0
|
1448 |
@SYMTestCaseDesc Tests the creation and deletion of CRegistrar
|
sl@0
|
1449 |
@SYMTestPriority High
|
sl@0
|
1450 |
@SYMTestActions Create and delete CRegistrar object,checks for open handles
|
sl@0
|
1451 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
1452 |
@SYMREQ REQ0000
|
sl@0
|
1453 |
*/
|
sl@0
|
1454 |
LOCAL_C void CreateDeleteTestL()
|
sl@0
|
1455 |
{
|
sl@0
|
1456 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0733 CreateDeleteTestL "));
|
sl@0
|
1457 |
// Set up for heap leak checking
|
sl@0
|
1458 |
__UHEAP_MARK;
|
sl@0
|
1459 |
//Check Thread handles leak
|
sl@0
|
1460 |
TInt startProcessHandleCount = 0;
|
sl@0
|
1461 |
TInt startThreadHandleCount = 0;
|
sl@0
|
1462 |
TInt endProcessHandleCount = 0;
|
sl@0
|
1463 |
TInt endThreadHandleCount = 0;
|
sl@0
|
1464 |
|
sl@0
|
1465 |
RThread rThread;
|
sl@0
|
1466 |
rThread.HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
1467 |
|
sl@0
|
1468 |
//CREATE DELETE TEST START//
|
sl@0
|
1469 |
|
sl@0
|
1470 |
CRegistrarTest* registrarTest = CRegistrarTest::NewL(EFalse);
|
sl@0
|
1471 |
|
sl@0
|
1472 |
test(registrarTest != NULL);
|
sl@0
|
1473 |
|
sl@0
|
1474 |
delete registrarTest;
|
sl@0
|
1475 |
|
sl@0
|
1476 |
//CREATE DELETE TEST END//
|
sl@0
|
1477 |
|
sl@0
|
1478 |
// Check for open handles
|
sl@0
|
1479 |
rThread.HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
1480 |
test(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
1481 |
|
sl@0
|
1482 |
//Test ends
|
sl@0
|
1483 |
__UHEAP_MARKEND;
|
sl@0
|
1484 |
}
|
sl@0
|
1485 |
/*
|
sl@0
|
1486 |
LOCAL_C void OOMCreateDeleteTest()
|
sl@0
|
1487 |
{
|
sl@0
|
1488 |
//
|
sl@0
|
1489 |
// Out of memory test
|
sl@0
|
1490 |
// ------------------------------------------------------------------
|
sl@0
|
1491 |
//
|
sl@0
|
1492 |
test.Next(_L("OOM CreateDeleteTest"));
|
sl@0
|
1493 |
TInt err;
|
sl@0
|
1494 |
TInt failAt = 0;
|
sl@0
|
1495 |
__UNUSED_VAR(failAt);
|
sl@0
|
1496 |
|
sl@0
|
1497 |
CRegistrarTest* registrarTest = NULL;
|
sl@0
|
1498 |
|
sl@0
|
1499 |
do
|
sl@0
|
1500 |
{
|
sl@0
|
1501 |
__UHEAP_MARK;
|
sl@0
|
1502 |
// find out the number of open handles
|
sl@0
|
1503 |
TInt startProcessHandleCount;
|
sl@0
|
1504 |
TInt startThreadHandleCount;
|
sl@0
|
1505 |
RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
1506 |
|
sl@0
|
1507 |
// Setting Heap failure for OOM test
|
sl@0
|
1508 |
__UHEAP_SETFAIL(RHeap::EDeterministic, ++failAt);
|
sl@0
|
1509 |
|
sl@0
|
1510 |
TRAP(err, registrarTest = CRegistrarTest::NewL(EFalse));
|
sl@0
|
1511 |
|
sl@0
|
1512 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
sl@0
|
1513 |
|
sl@0
|
1514 |
delete registrarTest;
|
sl@0
|
1515 |
registrarTest = NULL;
|
sl@0
|
1516 |
|
sl@0
|
1517 |
// check that no handles have leaked
|
sl@0
|
1518 |
TInt endProcessHandleCount;
|
sl@0
|
1519 |
TInt endThreadHandleCount;
|
sl@0
|
1520 |
RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
1521 |
|
sl@0
|
1522 |
test(startProcessHandleCount == endProcessHandleCount);
|
sl@0
|
1523 |
test(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
1524 |
|
sl@0
|
1525 |
__UHEAP_MARKEND;
|
sl@0
|
1526 |
}
|
sl@0
|
1527 |
while (err == KErrNoMemory);
|
sl@0
|
1528 |
|
sl@0
|
1529 |
test.Printf(_L("- Succeeded at heap failure rate of %i\n"), failAt);
|
sl@0
|
1530 |
test(err == KErrNone);
|
sl@0
|
1531 |
}
|
sl@0
|
1532 |
*/
|
sl@0
|
1533 |
// Type definition for pointer to member function.
|
sl@0
|
1534 |
// Used in calling the CDiscovererTest member function for testing.
|
sl@0
|
1535 |
typedef void (CRegistrarTest::*ClassFuncPtrL) (void);
|
sl@0
|
1536 |
|
sl@0
|
1537 |
/**
|
sl@0
|
1538 |
@SYMTestCaseID SYSLIB-ECOM-CT-0735
|
sl@0
|
1539 |
@SYMTestCaseDesc Wrapper function to call all test functions
|
sl@0
|
1540 |
@SYMTestPriority High
|
sl@0
|
1541 |
@SYMTestActions Calls up test functions of CRegistrarTest.
|
sl@0
|
1542 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
1543 |
@SYMREQ REQ0000
|
sl@0
|
1544 |
*/
|
sl@0
|
1545 |
/**
|
sl@0
|
1546 |
Wrapper function to call all test functions
|
sl@0
|
1547 |
|
sl@0
|
1548 |
@param testFuncL pointer to test function
|
sl@0
|
1549 |
@param aTestDesc test function name
|
sl@0
|
1550 |
*/
|
sl@0
|
1551 |
LOCAL_C void DoBasicTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDiscovery)
|
sl@0
|
1552 |
{
|
sl@0
|
1553 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0735 "));
|
sl@0
|
1554 |
test.Next(aTestDesc);
|
sl@0
|
1555 |
|
sl@0
|
1556 |
__UHEAP_MARK;
|
sl@0
|
1557 |
// find out the number of open handles
|
sl@0
|
1558 |
TInt startProcessHandleCount;
|
sl@0
|
1559 |
TInt startThreadHandleCount;
|
sl@0
|
1560 |
RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
1561 |
|
sl@0
|
1562 |
CRegistrarTest* registrarTest = CRegistrarTest::NewL(aIsFullDiscovery);
|
sl@0
|
1563 |
CleanupStack::PushL(registrarTest);
|
sl@0
|
1564 |
|
sl@0
|
1565 |
(registrarTest->*testFuncL)();
|
sl@0
|
1566 |
|
sl@0
|
1567 |
CleanupStack::PopAndDestroy(registrarTest);
|
sl@0
|
1568 |
|
sl@0
|
1569 |
// check that no handles have leaked
|
sl@0
|
1570 |
TInt endProcessHandleCount;
|
sl@0
|
1571 |
TInt endThreadHandleCount;
|
sl@0
|
1572 |
RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
1573 |
|
sl@0
|
1574 |
test(startProcessHandleCount == endProcessHandleCount);
|
sl@0
|
1575 |
test(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
1576 |
|
sl@0
|
1577 |
__UHEAP_MARKEND;
|
sl@0
|
1578 |
}
|
sl@0
|
1579 |
|
sl@0
|
1580 |
/**
|
sl@0
|
1581 |
@SYMTestCaseID SYSLIB-ECOM-CT-0736
|
sl@0
|
1582 |
@SYMTestCaseDesc Function to call all test functions
|
sl@0
|
1583 |
@SYMTestPriority High
|
sl@0
|
1584 |
@SYMTestActions Calls up all OOM test functions of CRegistrarTest.
|
sl@0
|
1585 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
1586 |
@SYMREQ REQ0000
|
sl@0
|
1587 |
*/
|
sl@0
|
1588 |
/**
|
sl@0
|
1589 |
Utility function to continually invoke a test function and cause memory allocation failures
|
sl@0
|
1590 |
|
sl@0
|
1591 |
@param testFuncL pointer to OOM test function
|
sl@0
|
1592 |
@param tryCount specifies what value to start memory allocation failures at
|
sl@0
|
1593 |
@param increment how much to increase the point at which memory allocation will fail on each test attempt
|
sl@0
|
1594 |
@param stopCount the value of memory allocation failure to stop testing at
|
sl@0
|
1595 |
*/
|
sl@0
|
1596 |
TInt RunTestUnderOOMCondition(ClassFuncPtrL testFuncL, TBool aIsFullDiscovery, TInt tryCount, TInt increment, TInt stopCount)
|
sl@0
|
1597 |
{
|
sl@0
|
1598 |
test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0736 "));
|
sl@0
|
1599 |
TInt err = KErrNone;
|
sl@0
|
1600 |
|
sl@0
|
1601 |
do
|
sl@0
|
1602 |
{
|
sl@0
|
1603 |
__UHEAP_MARK;
|
sl@0
|
1604 |
// find out the number of open handles
|
sl@0
|
1605 |
TInt startProcessHandleCount;
|
sl@0
|
1606 |
TInt startThreadHandleCount;
|
sl@0
|
1607 |
RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
1608 |
|
sl@0
|
1609 |
// Need to create object here as ECom has embedded TRAPs
|
sl@0
|
1610 |
// that will fail the test if memory not available
|
sl@0
|
1611 |
CRegistrarTest* registrarTest = CRegistrarTest::NewL(aIsFullDiscovery);
|
sl@0
|
1612 |
CleanupStack::PushL(registrarTest);
|
sl@0
|
1613 |
|
sl@0
|
1614 |
// Setting Heap failure for OOM test
|
sl@0
|
1615 |
__UHEAP_SETFAIL(RHeap::EDeterministic, tryCount);
|
sl@0
|
1616 |
|
sl@0
|
1617 |
TRAP(err, (registrarTest->*testFuncL)());
|
sl@0
|
1618 |
|
sl@0
|
1619 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
sl@0
|
1620 |
|
sl@0
|
1621 |
CleanupStack::PopAndDestroy(registrarTest);
|
sl@0
|
1622 |
registrarTest = NULL;
|
sl@0
|
1623 |
|
sl@0
|
1624 |
// check that no handles have leaked
|
sl@0
|
1625 |
TInt endProcessHandleCount;
|
sl@0
|
1626 |
TInt endThreadHandleCount;
|
sl@0
|
1627 |
RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
1628 |
|
sl@0
|
1629 |
test(startProcessHandleCount == endProcessHandleCount);
|
sl@0
|
1630 |
test(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
1631 |
|
sl@0
|
1632 |
__UHEAP_MARKEND;
|
sl@0
|
1633 |
tryCount = tryCount + increment;
|
sl@0
|
1634 |
|
sl@0
|
1635 |
} while((err == KErrNoMemory) && (tryCount != stopCount));
|
sl@0
|
1636 |
|
sl@0
|
1637 |
tryCount = tryCount - increment;
|
sl@0
|
1638 |
|
sl@0
|
1639 |
if (err == KErrNoMemory)
|
sl@0
|
1640 |
{
|
sl@0
|
1641 |
// test has not yet been able to pass due to memory allocation failures.
|
sl@0
|
1642 |
return -1;
|
sl@0
|
1643 |
}
|
sl@0
|
1644 |
|
sl@0
|
1645 |
test(err == KErrNone);
|
sl@0
|
1646 |
|
sl@0
|
1647 |
// If enough memory has finally been allocated for the test to pass then return
|
sl@0
|
1648 |
// the memory allocation counter value.
|
sl@0
|
1649 |
test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
|
sl@0
|
1650 |
return tryCount;
|
sl@0
|
1651 |
|
sl@0
|
1652 |
}
|
sl@0
|
1653 |
|
sl@0
|
1654 |
/**
|
sl@0
|
1655 |
Wrapper function to call all OOM test functions
|
sl@0
|
1656 |
|
sl@0
|
1657 |
@param testFuncL pointer to OOM test function
|
sl@0
|
1658 |
@param aTestDesc test function name
|
sl@0
|
1659 |
*/
|
sl@0
|
1660 |
LOCAL_C void DoOOMTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDiscovery)
|
sl@0
|
1661 |
{
|
sl@0
|
1662 |
test.Next(aTestDesc);
|
sl@0
|
1663 |
|
sl@0
|
1664 |
TInt startCount = 1;
|
sl@0
|
1665 |
TInt increment = 1;
|
sl@0
|
1666 |
TInt successRate = -1;
|
sl@0
|
1667 |
TInt stopCount = 256;
|
sl@0
|
1668 |
|
sl@0
|
1669 |
successRate = RunTestUnderOOMCondition(testFuncL, aIsFullDiscovery, startCount, increment, stopCount);
|
sl@0
|
1670 |
|
sl@0
|
1671 |
// (INC115057)
|
sl@0
|
1672 |
// When method CDiscoverer::CDirScanner::DoScanDriveL is encountered in a test hundreds
|
sl@0
|
1673 |
// of plug-in files will be scanned. It takes in the order of 3-4000 memory allocation failure
|
sl@0
|
1674 |
// loops (in techview context) before the scan is finished and the test can complete successfully.
|
sl@0
|
1675 |
// This will take over an hour. Instead determine the approximate failure point by
|
sl@0
|
1676 |
// testing with large increments between failures. Once a failure rate interval is found test
|
sl@0
|
1677 |
// for OOM conditions running up to it.
|
sl@0
|
1678 |
// This in effect means that we are checking OOM at the start and end of tests but skipping
|
sl@0
|
1679 |
// the scanning of each and every plugin in the middle of the test.
|
sl@0
|
1680 |
// (Note that CDiscoverer::CDirScanner::DoScanDriveL may return without leaving when it
|
sl@0
|
1681 |
// can't allocate TFileName. In this case it seems to this function that the test is
|
sl@0
|
1682 |
// successful. Therefore even if the successRate above indicates a pass the test is still
|
sl@0
|
1683 |
// re-run below with larger memory allocation failure valued to make sure that the test does
|
sl@0
|
1684 |
// in fact run to completion.
|
sl@0
|
1685 |
|
sl@0
|
1686 |
startCount = 256;
|
sl@0
|
1687 |
increment = 256;
|
sl@0
|
1688 |
stopCount = -1;
|
sl@0
|
1689 |
successRate = RunTestUnderOOMCondition(testFuncL, aIsFullDiscovery, startCount, increment, stopCount);
|
sl@0
|
1690 |
test(successRate > 0);
|
sl@0
|
1691 |
|
sl@0
|
1692 |
if (successRate > 256)
|
sl@0
|
1693 |
{
|
sl@0
|
1694 |
startCount = successRate - 256;
|
sl@0
|
1695 |
increment = 1;
|
sl@0
|
1696 |
stopCount = -1;
|
sl@0
|
1697 |
successRate = RunTestUnderOOMCondition(testFuncL, aIsFullDiscovery, startCount, increment, stopCount);
|
sl@0
|
1698 |
}
|
sl@0
|
1699 |
|
sl@0
|
1700 |
test(successRate > 0);
|
sl@0
|
1701 |
|
sl@0
|
1702 |
}
|
sl@0
|
1703 |
|
sl@0
|
1704 |
LOCAL_C void DoTestsL()
|
sl@0
|
1705 |
{
|
sl@0
|
1706 |
__UHEAP_MARK;
|
sl@0
|
1707 |
|
sl@0
|
1708 |
// Basic tests
|
sl@0
|
1709 |
CreateDeleteTestL();
|
sl@0
|
1710 |
|
sl@0
|
1711 |
DoBasicTestL(&CRegistrarTest::EnableDisableTestL, _L("EnableDisableTestL"), ETrue);
|
sl@0
|
1712 |
DoBasicTestL(&CRegistrarTest::ResumeSuspendTestL, _L("ResumeSuspendTestL"), ETrue);
|
sl@0
|
1713 |
DoBasicTestL(&CRegistrarTest::DriveRemovedReinstatedTestL, _L("DriveRemovedReinstatedTestL"), ETrue);
|
sl@0
|
1714 |
DoBasicTestL(&CRegistrarTest::DiscoveriesBegin_Register_CompleteTestL, _L("DiscoveriesBegin_Register_CompleteTestL"), ETrue);
|
sl@0
|
1715 |
DoBasicTestL(&CRegistrarTest::ParseTestL, _L("ParseTestL"), ETrue);
|
sl@0
|
1716 |
DoBasicTestL(&CRegistrarTest::ParseType2TestL, _L("ParseType2TestL"), ETrue);
|
sl@0
|
1717 |
DoBasicTestL(&CRegistrarTest::ParseType3TestL, _L("ParseType3TestL"), ETrue);
|
sl@0
|
1718 |
DoBasicTestL(&CRegistrarTest::ParseType3BadDataTestL, _L("ParseType3BadDataTestL"), ETrue);
|
sl@0
|
1719 |
DoBasicTestL(&CRegistrarTest::ParseRegistrationDataTestL, _L("ParseRegistrationDataTestL"), ETrue);
|
sl@0
|
1720 |
DoBasicTestL(&CRegistrarTest::ParseRegistrationDataType3TestL, _L("ParseRegistrationDataType3TestL"), ETrue);
|
sl@0
|
1721 |
DoBasicTestL(&CRegistrarTest::ParseSpiTestL, _L("ParseSpiTestL"), ETrue);
|
sl@0
|
1722 |
DoBasicTestL(&CRegistrarTest::ParseSpiType3TestL, _L("ParseSpiType3TestL"), ETrue);
|
sl@0
|
1723 |
DoBasicTestL(&CRegistrarTest::ParseSpiRegistrationDataTestL, _L("ParseSpiRegistrationDataTestL"), ETrue);
|
sl@0
|
1724 |
DoBasicTestL(&CRegistrarTest::ParseSpiRegistrationDataType3TestL, _L("ParseSpiRegistrationDataType3TestL"), ETrue);
|
sl@0
|
1725 |
DoBasicTestL(&CRegistrarTest::StateTransitionTestL, _L("StateTransitionTestL"), EFalse);
|
sl@0
|
1726 |
// OOM tests
|
sl@0
|
1727 |
// The OOM test for CRegistrar takes nearly 1 hour on hardware as it is reading the entire ecom.spi file
|
sl@0
|
1728 |
// Since ECOMSERVERTEST OOM test covered the full CRegistar OOM part, we will not run this the following
|
sl@0
|
1729 |
// test as that means 2 hours for ecom tests.
|
sl@0
|
1730 |
//OOMCreateDeleteTest();
|
sl@0
|
1731 |
DoOOMTestL(&CRegistrarTest::EnableDisableTestL, _L("OOM EnableDisableTestL"), ETrue);
|
sl@0
|
1732 |
DoOOMTestL(&CRegistrarTest::ResumeSuspendTestL, _L("OOM ResumeSuspendTestL"), ETrue);
|
sl@0
|
1733 |
DoOOMTestL(&CRegistrarTest::DriveRemovedReinstatedTestL, _L("OOM DriveRemovedReinstatedTestL"), ETrue);
|
sl@0
|
1734 |
DoOOMTestL(&CRegistrarTest::DiscoveriesBegin_Register_CompleteTestL, _L("OOM DiscoveriesBegin_Register_CompleteTestL"), ETrue);
|
sl@0
|
1735 |
DoOOMTestL(&CRegistrarTest::ParseTestL, _L("OOM ParseTestL"), ETrue);
|
sl@0
|
1736 |
DoOOMTestL(&CRegistrarTest::ParseType2TestL, _L("OOM ParseType2TestL"), ETrue);
|
sl@0
|
1737 |
DoOOMTestL(&CRegistrarTest::ParseType3TestL, _L("OOM ParseType3TestL"), ETrue);
|
sl@0
|
1738 |
DoOOMTestL(&CRegistrarTest::ParseSpiTestL, _L("OOM ParseSpiTestL"), ETrue);
|
sl@0
|
1739 |
DoOOMTestL(&CRegistrarTest::ParseSpiType3TestL, _L("OOM ParseSpiType3TestL"), ETrue);
|
sl@0
|
1740 |
DoOOMTestL(&CRegistrarTest::StateTransitionTestL, _L("OOM StateTransitionTestL"), EFalse);
|
sl@0
|
1741 |
// Not performing the OOM on ParseRegistrationDataL because of TRAPs present inside this function.
|
sl@0
|
1742 |
// The OOM error is trapped inside during the creation of the DllData but this error is not propagated to
|
sl@0
|
1743 |
// the calling funtion. Hence does not give the right results. However the normal test is performed above.
|
sl@0
|
1744 |
//DoOOMTestL(&CRegistrarTest::ParseRegistrationDataTestL,_L("OOM ParseRegistrationDataTestL"));
|
sl@0
|
1745 |
__UHEAP_MARKEND;
|
sl@0
|
1746 |
}
|
sl@0
|
1747 |
|
sl@0
|
1748 |
// Copies the Plugins to specific folder for testing purpose
|
sl@0
|
1749 |
LOCAL_C void CopyPlugins()
|
sl@0
|
1750 |
{
|
sl@0
|
1751 |
TInt err=KErrNone;
|
sl@0
|
1752 |
TRAP(err, EComTestUtils::FileManCopyFileL(KNewResourceFileNameZ, KNewResourceFileNameC));
|
sl@0
|
1753 |
test(err==KErrNone);
|
sl@0
|
1754 |
TRAP(err, EComTestUtils::FileManCopyFileL(KNewDllFileNameZ, KNewDllFileNameC));
|
sl@0
|
1755 |
test(err==KErrNone);
|
sl@0
|
1756 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3ResourceFileNameZ, KType3ResourceFileNameC));
|
sl@0
|
1757 |
test(err==KErrNone);
|
sl@0
|
1758 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3DllFileNameZ, KType3DllFileNameC));
|
sl@0
|
1759 |
test(err==KErrNone);
|
sl@0
|
1760 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3BadDataResourceFileNameZ, KType3BadDataResourceFileNameC));
|
sl@0
|
1761 |
test(err==KErrNone);
|
sl@0
|
1762 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3BadDataDllFileNameZ, KType3BadDataDllFileNameC));
|
sl@0
|
1763 |
test(err==KErrNone);
|
sl@0
|
1764 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3BadData1ResourceFileNameZ, KType3BadData1ResourceFileNameC));
|
sl@0
|
1765 |
test(err==KErrNone);
|
sl@0
|
1766 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3BadData1DllFileNameZ, KType3BadData1DllFileNameC));
|
sl@0
|
1767 |
test(err==KErrNone);
|
sl@0
|
1768 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3BadData2ResourceFileNameZ, KType3BadData2ResourceFileNameC));
|
sl@0
|
1769 |
test(err==KErrNone);
|
sl@0
|
1770 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType3BadData2DllFileNameZ, KType3BadData2DllFileNameC));
|
sl@0
|
1771 |
test(err==KErrNone);
|
sl@0
|
1772 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType2ResourceFileNameZ, KType2ResourceFileNameC));
|
sl@0
|
1773 |
test(err==KErrNone);
|
sl@0
|
1774 |
TRAP(err, EComTestUtils::FileManCopyFileL(KType2DllFileNameZ, KType2DllFileNameC));
|
sl@0
|
1775 |
test(err==KErrNone);
|
sl@0
|
1776 |
}
|
sl@0
|
1777 |
|
sl@0
|
1778 |
// Deleting plugin from the RAM for cleanup purpose
|
sl@0
|
1779 |
inline LOCAL_C void DeleteTestPlugin()
|
sl@0
|
1780 |
{
|
sl@0
|
1781 |
TInt err=KErrNone;
|
sl@0
|
1782 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KNewResourceFileNameC));
|
sl@0
|
1783 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KNewDllFileNameC));
|
sl@0
|
1784 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3ResourceFileNameC));
|
sl@0
|
1785 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3DllFileNameC));
|
sl@0
|
1786 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3BadDataResourceFileNameC));
|
sl@0
|
1787 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3BadDataDllFileNameC));
|
sl@0
|
1788 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3BadData1ResourceFileNameC));
|
sl@0
|
1789 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3BadData1DllFileNameC));
|
sl@0
|
1790 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3BadData2ResourceFileNameC));
|
sl@0
|
1791 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType3BadData2DllFileNameC));
|
sl@0
|
1792 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType2ResourceFileNameC));
|
sl@0
|
1793 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KType2DllFileNameC));
|
sl@0
|
1794 |
}
|
sl@0
|
1795 |
|
sl@0
|
1796 |
//Initialise the Active Scheduler
|
sl@0
|
1797 |
LOCAL_C void SetupL()
|
sl@0
|
1798 |
{
|
sl@0
|
1799 |
// Construct and install the Active Scheduler. The Active Schedular is needed
|
sl@0
|
1800 |
// by components used by this test as they are ActiveObjects.
|
sl@0
|
1801 |
TheActiveScheduler = new(ELeave)CActiveScheduler;
|
sl@0
|
1802 |
CActiveScheduler::Install(TheActiveScheduler);
|
sl@0
|
1803 |
}
|
sl@0
|
1804 |
|
sl@0
|
1805 |
GLDEF_C TInt E32Main()
|
sl@0
|
1806 |
{
|
sl@0
|
1807 |
__UHEAP_MARK;
|
sl@0
|
1808 |
|
sl@0
|
1809 |
test.Printf(_L("\n"));
|
sl@0
|
1810 |
test.Title();
|
sl@0
|
1811 |
test.Start( _L("Registrar Tests.") );
|
sl@0
|
1812 |
|
sl@0
|
1813 |
TheTrapCleanup = CTrapCleanup::New();
|
sl@0
|
1814 |
|
sl@0
|
1815 |
// Connect the file server instance
|
sl@0
|
1816 |
User::LeaveIfError(TheFs.Connect());
|
sl@0
|
1817 |
|
sl@0
|
1818 |
TRAPD(err, SetupL());
|
sl@0
|
1819 |
test(err == KErrNone);
|
sl@0
|
1820 |
|
sl@0
|
1821 |
// We need to clean up the registry files to ensure a fresh discovery that
|
sl@0
|
1822 |
// has the effect of taking certain pathways within the code. This
|
sl@0
|
1823 |
// tests the memory cleanup
|
sl@0
|
1824 |
// Delete the prevous data files so we rediscover from scratch
|
sl@0
|
1825 |
|
sl@0
|
1826 |
TRAP(err, EComTestUtils::FileManDeleteFileL(KDataDir));
|
sl@0
|
1827 |
CopyPlugins();
|
sl@0
|
1828 |
|
sl@0
|
1829 |
// The reason for the folowing delay is:
|
sl@0
|
1830 |
// ECOM server could be already started. It means that when we copy some
|
sl@0
|
1831 |
// ECOM plugins from Z: to C: drive - ECOM server should look for and
|
sl@0
|
1832 |
// find the new ECOM plugins. The ECOM server uses for that an active object,
|
sl@0
|
1833 |
// which scans plugin directories. So the discovering service is asynchronous.
|
sl@0
|
1834 |
// We have to wait some time until it finishes.
|
sl@0
|
1835 |
// Otherwise ListImplementationsL could fail to find requested implementations.
|
sl@0
|
1836 |
User::After(KOneSecond * 3);
|
sl@0
|
1837 |
|
sl@0
|
1838 |
// Call the main tests
|
sl@0
|
1839 |
TRAP(err, DoTestsL());
|
sl@0
|
1840 |
test(err == KErrNone);
|
sl@0
|
1841 |
|
sl@0
|
1842 |
// Cleanup files. If the cleanup fails that is no problem,
|
sl@0
|
1843 |
// as any subsequent tests will replace them. The only downside
|
sl@0
|
1844 |
// would be the disk not being tidied
|
sl@0
|
1845 |
DeleteTestPlugin();
|
sl@0
|
1846 |
|
sl@0
|
1847 |
delete TheActiveScheduler;
|
sl@0
|
1848 |
delete TheTrapCleanup;
|
sl@0
|
1849 |
|
sl@0
|
1850 |
TheFs.Close();
|
sl@0
|
1851 |
|
sl@0
|
1852 |
test.End();
|
sl@0
|
1853 |
test.Close();
|
sl@0
|
1854 |
|
sl@0
|
1855 |
__UHEAP_MARKEND;
|
sl@0
|
1856 |
return (KErrNone);
|
sl@0
|
1857 |
}
|