23
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <e32svr.h>
|
|
21 |
#include <f32fsys.h>
|
|
22 |
#include <StifParser.h>
|
|
23 |
#include <Stiftestinterface.h>
|
|
24 |
|
|
25 |
#include <BADESCA.H>
|
|
26 |
#include <COMMDB.H>
|
|
27 |
#include <zipfile.h>
|
|
28 |
|
|
29 |
#include "VCXTestLog.h"
|
|
30 |
#include "IptvTestUtilModule.h"
|
|
31 |
#include "TestUtilConnection.h"
|
|
32 |
#include "TestUtilConnectionWaiter.h"
|
|
33 |
#include "IptvTestDownloadManager.h"
|
|
34 |
#include "VCXTestCommon.h"
|
|
35 |
#include "CIptvTestMobilecrashWatcher.h"
|
|
36 |
#include "CIptvTestTimer.h"
|
|
37 |
|
|
38 |
#include "IptvTestUtilALR.h"
|
|
39 |
|
|
40 |
// CONSTANTS
|
|
41 |
_LIT( KDateTimeString, "%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%H%:1%T%:2%S%.%*C2%:3%-B" );
|
|
42 |
|
|
43 |
// MACROS
|
|
44 |
|
|
45 |
// LOCAL CONSTANTS AND MACROS
|
|
46 |
|
|
47 |
// FORWARD DECLARATIONS
|
|
48 |
class CIptvTestTimer;
|
|
49 |
class CZipFile;
|
|
50 |
|
|
51 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
52 |
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
// CIptvTestUtilModule::Delete
|
|
55 |
// Delete here all resources allocated and opened from test methods.
|
|
56 |
// Called from destructor.
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
void CIptvTestUtilModule::Delete()
|
|
60 |
{
|
|
61 |
VCXLOGLO1(">>>CIptvTestUtilModule::Delete");
|
|
62 |
if(iConnect)
|
|
63 |
{
|
|
64 |
delete iConnect;
|
|
65 |
iConnect = NULL;
|
|
66 |
}
|
|
67 |
|
|
68 |
if(iConnectionWaiter)
|
|
69 |
{
|
|
70 |
delete iConnectionWaiter;
|
|
71 |
iConnectionWaiter = NULL;
|
|
72 |
}
|
|
73 |
|
|
74 |
if(iDownload)
|
|
75 |
{
|
|
76 |
delete iDownload;
|
|
77 |
iDownload = NULL;
|
|
78 |
}
|
|
79 |
|
|
80 |
if(iTimer)
|
|
81 |
{
|
|
82 |
delete iTimer;
|
|
83 |
iTimer = NULL;
|
|
84 |
}
|
|
85 |
|
|
86 |
if( iFileIsLocked )
|
|
87 |
{
|
|
88 |
VCXLOGLO1("CIptvTestUtilModule:: Release locked file.");
|
|
89 |
iLockedFile.Close();
|
|
90 |
}
|
|
91 |
iFileIsLocked = EFalse;
|
|
92 |
|
|
93 |
delete iObservedServicePath;
|
|
94 |
iObservedServicePath = NULL;
|
|
95 |
iObservedFiles.ResetAndDestroy();
|
|
96 |
//iObservedFiles.Close();
|
|
97 |
VCXLOGLO1("CIptvTestUtilModule::Observed array deleted.");
|
|
98 |
|
|
99 |
iFileModifiedDates.Reset();
|
|
100 |
iFileModifiedDates.Close();
|
|
101 |
VCXLOGLO1("CIptvTestUtilModule::File date array deleted.");
|
|
102 |
|
|
103 |
iFs.Close();
|
|
104 |
|
|
105 |
TInt i;
|
|
106 |
for( i = 0; i < iToBeDeletedDestinations.Count(); i++ )
|
|
107 |
{
|
|
108 |
TPtr ptr = iToBeDeletedDestinations[i]->Des();
|
|
109 |
iTestUtilALR->DeleteDestinationL( ptr );
|
|
110 |
}
|
|
111 |
|
|
112 |
iToBeDeletedDestinations.ResetAndDestroy();
|
|
113 |
|
|
114 |
if( iTestUtilALR )
|
|
115 |
{
|
|
116 |
delete iTestUtilALR;
|
|
117 |
iTestUtilALR = NULL;
|
|
118 |
}
|
|
119 |
|
|
120 |
if( iCaseStarted )
|
|
121 |
{
|
|
122 |
VCXLOGLO1("<<< Case end.");
|
|
123 |
iCaseStarted = EFalse;
|
|
124 |
}
|
|
125 |
|
|
126 |
if( iDummyFilesCreated )
|
|
127 |
{
|
|
128 |
TRAP_IGNORE( iTestCommon->DeleteDummyFilesL( EDriveC ) );
|
|
129 |
TRAP_IGNORE( iTestCommon->DeleteDummyFilesL( EDriveE ) );
|
|
130 |
TRAP_IGNORE( iTestCommon->DeleteDummyFilesL( EDriveF ) );
|
|
131 |
TRAP_IGNORE( iTestCommon->DeleteDummyFilesL( EDriveG ) );
|
|
132 |
}
|
|
133 |
|
|
134 |
if(iIptvTestMobilecrashWatcher)
|
|
135 |
{
|
|
136 |
CStifItemParser* nullParser( NULL );
|
|
137 |
CheckMobilecrashesL( *nullParser );
|
|
138 |
|
|
139 |
delete iIptvTestMobilecrashWatcher;
|
|
140 |
iIptvTestMobilecrashWatcher = NULL;
|
|
141 |
}
|
|
142 |
|
|
143 |
|
|
144 |
VCXLOGLO1("<<<CIptvTestUtilModule::Delete");
|
|
145 |
}
|
|
146 |
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
// CIptvTestUtilModule::RunMethodL
|
|
149 |
// Run specified method. Contains also table of test mothods and their names.
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
TInt CIptvTestUtilModule::RunMethodL(
|
|
153 |
CStifItemParser& aItem )
|
|
154 |
{
|
|
155 |
|
|
156 |
static TStifFunctionInfo const KFunctions[] =
|
|
157 |
{
|
|
158 |
// Copy this line for every implemented function.
|
|
159 |
// First string is the function name used in TestScripter script file.
|
|
160 |
// Second is the actual implementation member function.
|
|
161 |
ENTRY( "IptvLogCaseStart", CIptvTestUtilModule::IptvLogCaseStart ),
|
|
162 |
ENTRY( "IptvLogCaseEnd", CIptvTestUtilModule::IptvLogCaseEnd ),
|
|
163 |
ENTRY( "IptvLogWrite", CIptvTestUtilModule::IptvLogWrite ),
|
|
164 |
|
|
165 |
ENTRY( "Connect", CIptvTestUtilModule::ConnectL ),
|
|
166 |
ENTRY( "Attach", CIptvTestUtilModule::AttachL ),
|
|
167 |
ENTRY( "Disconnect", CIptvTestUtilModule::DisconnectL ),
|
|
168 |
ENTRY( "Terminate", CIptvTestUtilModule::TerminateConnectionL ),
|
|
169 |
ENTRY( "WaitForConnectionActivity", CIptvTestUtilModule::WaitForConnectionActivityL ),
|
|
170 |
ENTRY( "WaitUntilConnectionIsClosed", CIptvTestUtilModule::WaitUntilConnectionIsClosed ),
|
|
171 |
ENTRY( "Download", CIptvTestUtilModule::DownloadL ),
|
|
172 |
ENTRY( "StopDownloads", CIptvTestUtilModule::StopDownloadsL ),
|
|
173 |
|
|
174 |
ENTRY( "CreateMobilecrashWatcher", CIptvTestUtilModule::CreateMobilecrashWatcherL ),
|
|
175 |
ENTRY( "CheckMobilecrashes", CIptvTestUtilModule::CheckMobilecrashesL ),
|
|
176 |
ENTRY( "CheckMobilecrashesZeroTolerance", CIptvTestUtilModule::CheckMobilecrashesZeroToleranceL ),
|
|
177 |
|
|
178 |
ENTRY( "SetDefaultIapCenrep", CIptvTestUtilModule::SetDefaultIapCenRepL ),
|
|
179 |
ENTRY( "DeleteUsedDestinationCenRep", CIptvTestUtilModule::DeleteUsedDestinationCenRepL ),
|
|
180 |
ENTRY( "SetUsedDestination", CIptvTestUtilModule::SetUsedDestinationL ),
|
|
181 |
ENTRY( "CreateDestination", CIptvTestUtilModule::CreateDestinationL ),
|
|
182 |
ENTRY( "SetConnectionMethodStringAttribute", CIptvTestUtilModule::SetConnectionMethodStringAttributeL ),
|
|
183 |
ENTRY( "SetConnectionMethodIntAttribute", CIptvTestUtilModule::SetConnectionMethodIntAttributeL ),
|
|
184 |
ENTRY( "SetConnectionMethodBoolAttribute", CIptvTestUtilModule::SetConnectionMethodBoolAttributeL ),
|
|
185 |
ENTRY( "DeleteDestination", CIptvTestUtilModule::DeleteDestinationL ),
|
|
186 |
ENTRY( "CopyMethod", CIptvTestUtilModule::CopyMethodL ),
|
|
187 |
ENTRY( "DeleteMethod", CIptvTestUtilModule::DeleteMethodL ),
|
|
188 |
ENTRY( "SetMethodPriority", CIptvTestUtilModule::SetMethodPriorityL ),
|
|
189 |
ENTRY( "DeleteDestinationAfterwards", CIptvTestUtilModule::DeleteDestinationAfterwardsL ),
|
|
190 |
|
|
191 |
ENTRY( "SetSystemTimeToday", CIptvTestUtilModule::SetSystemTimeToday ),
|
|
192 |
ENTRY( "SetSystemTime", CIptvTestUtilModule::SetSystemTime ),
|
|
193 |
ENTRY( "AdvanceSystemTime1Second", CIptvTestUtilModule::AdvanceSystemTime1Second ),
|
|
194 |
ENTRY( "AdvanceSystemTimeSeconds", CIptvTestUtilModule::AdvanceSystemTimeSeconds ),
|
|
195 |
ENTRY( "AdvanceSystemTimeMinutes", CIptvTestUtilModule::AdvanceSystemTimeMinutes ),
|
|
196 |
ENTRY( "AdvanceSystemTimeHours", CIptvTestUtilModule::AdvanceSystemTimeHours ),
|
|
197 |
ENTRY( "AdvanceSystemTimeDays", CIptvTestUtilModule::AdvanceSystemTimeDays ),
|
|
198 |
ENTRY( "SetTimeZone", CIptvTestUtilModule::SetTimeZone ),
|
|
199 |
|
|
200 |
ENTRY( "CreateFile", CIptvTestUtilModule::CreateFileL ),
|
|
201 |
ENTRY( "DeleteFile", CIptvTestUtilModule::DeleteFileL ),
|
|
202 |
ENTRY( "CreateFolder", CIptvTestUtilModule::CreateFolderL ),
|
|
203 |
ENTRY( "DeleteFolder", CIptvTestUtilModule::DeleteFolderL ),
|
|
204 |
ENTRY( "LockFile", CIptvTestUtilModule::LockFileL ),
|
|
205 |
ENTRY( "UnlockFile", CIptvTestUtilModule::UnlockFileL ),
|
|
206 |
ENTRY( "ExtractFile", CIptvTestUtilModule::ExtractFileL ),
|
|
207 |
ENTRY( "SetDriveFreeSpace", CIptvTestUtilModule::SetDriveFreeSpaceL ),
|
|
208 |
};
|
|
209 |
|
|
210 |
const TInt count = sizeof( KFunctions ) /
|
|
211 |
sizeof( TStifFunctionInfo );
|
|
212 |
|
|
213 |
return RunInternalL( KFunctions, count, aItem );
|
|
214 |
}
|
|
215 |
|
|
216 |
// -----------------------------------------------------------------------------
|
|
217 |
// CIptvTestUtilModule::IptvLogCaseStart
|
|
218 |
// -----------------------------------------------------------------------------
|
|
219 |
//
|
|
220 |
TInt CIptvTestUtilModule::IptvLogCaseStart( CStifItemParser& aItem )
|
|
221 |
{
|
|
222 |
//VCXLOGLO1(">>>CIptvTestUtilModule::IptvLogCaseStart");
|
|
223 |
|
|
224 |
_LIT( KIptvTestUtilModule, "IptvTestUtilModule" );
|
|
225 |
_LIT( KWhere, "In IptvLogCaseStart" );
|
|
226 |
TestModuleIf().Printf( 0, KIptvTestUtilModule, KWhere );
|
|
227 |
// Print to log file
|
|
228 |
iLog->Log( KWhere );
|
|
229 |
|
|
230 |
TPtrC string;
|
|
231 |
|
|
232 |
if( aItem.GetNextString ( string ) != KErrNone )
|
|
233 |
{
|
|
234 |
VCXLOGLO1("CIptvTestUtilModule::IptvLogCaseStart: Could not read parameter!");
|
|
235 |
return KErrGeneral;
|
|
236 |
}
|
|
237 |
|
|
238 |
VCXLOGLO2(">>> Case start: %S", &string);
|
|
239 |
|
|
240 |
iCaseStarted = ETrue;
|
|
241 |
|
|
242 |
return KErrNone;
|
|
243 |
//VCXLOGLO1("<<<CIptvTestUtilModule::IptvLogCaseStart");
|
|
244 |
}
|
|
245 |
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
// CIptvTestUtilModule::IptvLogCaseEnd
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
TInt CIptvTestUtilModule::IptvLogCaseEnd( CStifItemParser& /* aItem */ )
|
|
251 |
{
|
|
252 |
//VCXLOGLO1(">>>CIptvTestUtilModule::IptvLogCaseEnd");
|
|
253 |
|
|
254 |
_LIT( KIptvTestUtilModule, "IptvTestUtilModule" );
|
|
255 |
_LIT( KWhere, "In IptvLogCaseEnd" );
|
|
256 |
TestModuleIf().Printf( 0, KIptvTestUtilModule, KWhere );
|
|
257 |
// Print to log file
|
|
258 |
iLog->Log( KWhere );
|
|
259 |
|
|
260 |
VCXLOGLO1("<<< Case end.");
|
|
261 |
iCaseStarted = EFalse;
|
|
262 |
|
|
263 |
return KErrNone;
|
|
264 |
//VCXLOGLO1("<<<CIptvTestUtilModule::IptvLogCaseEnd");
|
|
265 |
}
|
|
266 |
|
|
267 |
// -----------------------------------------------------------------------------
|
|
268 |
// CIptvTestUtilModule::IptvLogWrite
|
|
269 |
// -----------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
TInt CIptvTestUtilModule::IptvLogWrite( CStifItemParser& aItem )
|
|
272 |
{
|
|
273 |
//VCXLOGLO1(">>>CIptvTestUtilModule::IptvLogWrite");
|
|
274 |
|
|
275 |
_LIT( KIptvTestUtilModule, "IptvTestUtilModule" );
|
|
276 |
_LIT( KWhere, "In IptvLogWrite" );
|
|
277 |
TestModuleIf().Printf( 0, KIptvTestUtilModule, KWhere );
|
|
278 |
// Print to log file
|
|
279 |
iLog->Log( KWhere );
|
|
280 |
|
|
281 |
TPtrC string;
|
|
282 |
|
|
283 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
284 |
|
|
285 |
if( aItem.GetNextString ( string ) != KErrNone )
|
|
286 |
{
|
|
287 |
VCXLOGLO1("CIptvTestUtilModule::IptvLogWrite: Could not read parameter!");
|
|
288 |
return KErrGeneral;
|
|
289 |
}
|
|
290 |
|
|
291 |
VCXLOGLO2("%S", &string);
|
|
292 |
|
|
293 |
return KErrNone;
|
|
294 |
//VCXLOGLO1("<<<CIptvTestUtilModule::IptvLogWrite");
|
|
295 |
}
|
|
296 |
|
|
297 |
// -----------------------------------------------------------------------------
|
|
298 |
// CIptvTestUtilModule::ConnectL
|
|
299 |
// -----------------------------------------------------------------------------
|
|
300 |
//
|
|
301 |
TInt CIptvTestUtilModule::ConnectL( CStifItemParser& aItem )
|
|
302 |
{
|
|
303 |
VCXLOGLO1(">>>CIptvTestUtilModule::ConnectL");
|
|
304 |
// Print to UI
|
|
305 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
306 |
_LIT( KWhere, "In ConnectL" );
|
|
307 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
308 |
// Print to log file
|
|
309 |
iLog->Log( KWhere );
|
|
310 |
|
|
311 |
if(iConnect)
|
|
312 |
{
|
|
313 |
VCXLOGLO1("CIptvTestUtilModule:: Connection already exists.");
|
|
314 |
return KErrAlreadyExists;
|
|
315 |
}
|
|
316 |
|
|
317 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
318 |
|
|
319 |
TInt err = KErrNone;
|
|
320 |
|
|
321 |
TPtrC iapName;
|
|
322 |
|
|
323 |
if(KErrNone != aItem.GetNextString(iapName) )
|
|
324 |
{
|
|
325 |
VCXLOGLO1("** FAIL ** Invalid testcase parameter! Iap name was not specified.");
|
|
326 |
iLog->Log( _L("** FAIL ** Invalid testcase parameter! Iap name was not specified.") );
|
|
327 |
VCXLOGLO1("<<<CIptvTestUtilModule::ConnectL");
|
|
328 |
return KErrGeneral;
|
|
329 |
}
|
|
330 |
|
|
331 |
TBufC<256> name(iapName);
|
|
332 |
TUint32 iapId;
|
|
333 |
if(!iTestCommon->GetIapIdL(name, iapId))
|
|
334 |
{
|
|
335 |
VCXLOGLO2("** FAIL ** Could not find iap with name %S.", &name);
|
|
336 |
iLog->Log( _L("** FAIL ** Could not find specified iap.") );
|
|
337 |
VCXLOGLO1("<<<CIptvTestUtilModule::ConnectL");
|
|
338 |
return KErrGeneral;
|
|
339 |
}
|
|
340 |
|
|
341 |
iRetryCount = 10;
|
|
342 |
|
|
343 |
iConnect = CTestUtilConnection::NewL(this);
|
|
344 |
|
|
345 |
iConnect->SetConnectionPreferences(KCommDbBearerUnknown, iapId);
|
|
346 |
iConnect->ConnectL();
|
|
347 |
|
|
348 |
if(!iTimer)
|
|
349 |
{
|
|
350 |
iTimer = CIptvTestTimer::NewL(*this, KConnectionTimerId);
|
|
351 |
}
|
|
352 |
iTimer->After(1000000 * 20);
|
|
353 |
|
|
354 |
VCXLOGLO1("<<<CIptvTestUtilModule::ConnectL");
|
|
355 |
return err;
|
|
356 |
}
|
|
357 |
|
|
358 |
// -----------------------------------------------------------------------------
|
|
359 |
// CIptvTestUtilModule::AttachL
|
|
360 |
// -----------------------------------------------------------------------------
|
|
361 |
//
|
|
362 |
TInt CIptvTestUtilModule::AttachL( CStifItemParser& aItem )
|
|
363 |
{
|
|
364 |
VCXLOGLO1(">>>CIptvTestUtilModule::AttachL");
|
|
365 |
// Print to UI
|
|
366 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
367 |
_LIT( KWhere, "In AttachL" );
|
|
368 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
369 |
// Print to log file
|
|
370 |
iLog->Log( KWhere );
|
|
371 |
|
|
372 |
if(iConnect)
|
|
373 |
{
|
|
374 |
VCXLOGLO1("<<<CIptvTestUtilModule:: Connection already exists.");
|
|
375 |
return KErrAlreadyExists;
|
|
376 |
}
|
|
377 |
|
|
378 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
379 |
|
|
380 |
TInt err = KErrNone;
|
|
381 |
|
|
382 |
TRAP(err, PrintIAPs() );
|
|
383 |
|
|
384 |
TPtrC iapName;
|
|
385 |
|
|
386 |
if(KErrNone != aItem.GetNextString(iapName) )
|
|
387 |
{
|
|
388 |
VCXLOGLO1("** FAIL ** Invalid testcase parameter! Iap name was not specified.");
|
|
389 |
iLog->Log( _L("** FAIL ** Invalid testcase parameter! Iap name was not specified.") );
|
|
390 |
VCXLOGLO1("<<<CIptvTestUtilModule::AttachL");
|
|
391 |
return KErrGeneral;
|
|
392 |
}
|
|
393 |
|
|
394 |
TBufC<256> name(iapName);
|
|
395 |
TUint32 iapId;
|
|
396 |
if(!iTestCommon->GetIapIdL(name, iapId))
|
|
397 |
{
|
|
398 |
VCXLOGLO2("** FAIL ** Could not find iap with name %S.", &name);
|
|
399 |
iLog->Log( _L("** FAIL ** Could not find specified iap.") );
|
|
400 |
VCXLOGLO1("<<<CIptvTestUtilModule::AttachL");
|
|
401 |
return KErrGeneral;
|
|
402 |
}
|
|
403 |
|
|
404 |
iConnect = CTestUtilConnection::NewL(this);
|
|
405 |
|
|
406 |
iConnect->SetConnectionPreferences(KCommDbBearerUnknown, iapId);
|
|
407 |
iConnect->AttachL();
|
|
408 |
|
|
409 |
if(!iTimer)
|
|
410 |
{
|
|
411 |
iTimer = CIptvTestTimer::NewL(*this, KConnectionTimerId);
|
|
412 |
}
|
|
413 |
iTimer->After(1000000 * 20);
|
|
414 |
|
|
415 |
VCXLOGLO1("<<<CIptvTestUtilModule::AttachL");
|
|
416 |
return err;
|
|
417 |
}
|
|
418 |
|
|
419 |
// -----------------------------------------------------------------------------
|
|
420 |
// CIptvTestUtilModule::DisconnectL
|
|
421 |
// -----------------------------------------------------------------------------
|
|
422 |
//
|
|
423 |
TInt CIptvTestUtilModule::DisconnectL( CStifItemParser& /* aItem */ )
|
|
424 |
{
|
|
425 |
VCXLOGLO1(">>>CIptvTestUtilModule::DisconnectL");
|
|
426 |
// Print to UI
|
|
427 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
428 |
_LIT( KWhere, "In DisconnectL" );
|
|
429 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
430 |
// Print to log file
|
|
431 |
iLog->Log( KWhere );
|
|
432 |
|
|
433 |
TInt err = KErrNone;
|
|
434 |
|
|
435 |
if(iTimer)
|
|
436 |
{
|
|
437 |
iTimer->CancelTimer();
|
|
438 |
}
|
|
439 |
|
|
440 |
delete iConnect;
|
|
441 |
iConnect = NULL;
|
|
442 |
|
|
443 |
VCXLOGLO1("<<<CIptvTestUtilModule::DisconnectL");
|
|
444 |
return err;
|
|
445 |
}
|
|
446 |
|
|
447 |
// -----------------------------------------------------------------------------
|
|
448 |
// CIptvTestUtilModule::TerminateConnectionL
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
//
|
|
451 |
TInt CIptvTestUtilModule::TerminateConnectionL( CStifItemParser& /* aItem */ )
|
|
452 |
{
|
|
453 |
VCXLOGLO1(">>>CIptvTestUtilModule::TerminateConnectionL");
|
|
454 |
// Print to UI
|
|
455 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
456 |
_LIT( KWhere, "In TerminateConnectionL" );
|
|
457 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
458 |
// Print to log file
|
|
459 |
iLog->Log( KWhere );
|
|
460 |
|
|
461 |
TInt err = KErrNone;
|
|
462 |
|
|
463 |
if(iConnect)
|
|
464 |
{
|
|
465 |
iConnect->TerminateConnectionL();
|
|
466 |
|
|
467 |
delete iConnect;
|
|
468 |
iConnect = NULL;
|
|
469 |
}
|
|
470 |
|
|
471 |
if(iTimer)
|
|
472 |
{
|
|
473 |
iTimer->CancelTimer();
|
|
474 |
}
|
|
475 |
|
|
476 |
VCXLOGLO1("<<<CIptvTestUtilModule::TerminateConnectionL");
|
|
477 |
return err;
|
|
478 |
}
|
|
479 |
|
|
480 |
// -----------------------------------------------------------------------------
|
|
481 |
// CIptvTestUtilModule::DownloadL
|
|
482 |
// -----------------------------------------------------------------------------
|
|
483 |
//
|
|
484 |
TInt CIptvTestUtilModule::DownloadL( CStifItemParser& aItem )
|
|
485 |
{
|
|
486 |
VCXLOGLO1(">>>CIptvTestUtilModule::DownloadL");
|
|
487 |
// Print to UI
|
|
488 |
_LIT( KIptvTestUtilModule, "IptvTestUtilModule" );
|
|
489 |
_LIT( KWhere, "In DownloadL" );
|
|
490 |
TestModuleIf().Printf( 0, KIptvTestUtilModule, KWhere );
|
|
491 |
// Print to log file
|
|
492 |
iLog->Log( KWhere );
|
|
493 |
|
|
494 |
TInt err = KErrNone;
|
|
495 |
|
|
496 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
497 |
|
|
498 |
TPtrC pAddress, pOutFile, pUserName, pPassword, pIapName;
|
|
499 |
|
|
500 |
if( aItem.GetNextString ( pAddress ) != KErrNone )
|
|
501 |
{
|
|
502 |
VCXLOGLO1("CIptvTestUtilModule::DownloadL: Could not read parameter address!");
|
|
503 |
return KErrGeneral;
|
|
504 |
}
|
|
505 |
|
|
506 |
HBufC* heapBuffer = HBufC::NewL(4000);
|
|
507 |
TPtr ptr( heapBuffer->Des() );
|
|
508 |
ptr.Copy( pAddress );
|
|
509 |
|
|
510 |
if( aItem.GetNextString ( pOutFile ) != KErrNone )
|
|
511 |
{
|
|
512 |
VCXLOGLO1("CIptvTestUtilModule::DownloadL: Could not read parameter outputfile!");
|
|
513 |
return KErrGeneral;
|
|
514 |
}
|
|
515 |
|
|
516 |
if( aItem.GetNextString ( pUserName ) != KErrNone )
|
|
517 |
{
|
|
518 |
VCXLOGLO1("CIptvTestUtilModule::DownloadL: no user name specified!");
|
|
519 |
}
|
|
520 |
|
|
521 |
if( aItem.GetNextString ( pPassword ) != KErrNone )
|
|
522 |
{
|
|
523 |
VCXLOGLO1("CIptvTestUtilModule::DownloadL: no password specified!");
|
|
524 |
}
|
|
525 |
|
|
526 |
if( aItem.GetNextString ( pIapName ) != KErrNone )
|
|
527 |
{
|
|
528 |
VCXLOGLO1("CIptvTestUtilModule::DownloadL: no iap specified!");
|
|
529 |
}
|
|
530 |
|
|
531 |
VCXLOGLO2("Address: %S", &pAddress);
|
|
532 |
VCXLOGLO2("OutFile: %S", &pOutFile);
|
|
533 |
VCXLOGLO2("name: %S", &pUserName);
|
|
534 |
VCXLOGLO2("Password: %S", &pPassword);
|
|
535 |
VCXLOGLO2("Iap: %S", &pIapName);
|
|
536 |
|
|
537 |
if(!iDownload)
|
|
538 |
{
|
|
539 |
iDownload = CIptvTestDownloadManager::NewL(this);
|
|
540 |
}
|
|
541 |
|
|
542 |
TUint32 iapId(0);
|
|
543 |
GetIap(pIapName, iapId);
|
|
544 |
|
|
545 |
err = iDownload->DownloadL(ptr, pOutFile, pUserName, pPassword, iapId);
|
|
546 |
if(err != KErrNone)
|
|
547 |
{
|
|
548 |
VCXLOGLO2("iDownload returned: %d", err);
|
|
549 |
}
|
|
550 |
|
|
551 |
VCXLOGLO1("<<<CIptvTestUtilModule::DownloadL");
|
|
552 |
return err;
|
|
553 |
}
|
|
554 |
|
|
555 |
// -----------------------------------------------------------------------------
|
|
556 |
// CIptvTestUtilModule::StopDownloadsL
|
|
557 |
// -----------------------------------------------------------------------------
|
|
558 |
//
|
|
559 |
TInt CIptvTestUtilModule::StopDownloadsL( CStifItemParser& /* aItem */ )
|
|
560 |
{
|
|
561 |
|
|
562 |
VCXLOGLO1(">>>CIptvTestUtilModule::StopDownloads");
|
|
563 |
// Print to UI
|
|
564 |
_LIT( KIptvTestUtilModule, "IptvTestUtilModule" );
|
|
565 |
_LIT( KWhere, "In StopDownloadsL" );
|
|
566 |
TestModuleIf().Printf( 0, KIptvTestUtilModule, KWhere );
|
|
567 |
// Print to log file
|
|
568 |
iLog->Log( KWhere );
|
|
569 |
|
|
570 |
TInt err = KErrNone;
|
|
571 |
|
|
572 |
if(iDownload)
|
|
573 |
{
|
|
574 |
delete iDownload;
|
|
575 |
iDownload = NULL;
|
|
576 |
}
|
|
577 |
|
|
578 |
VCXLOGLO1("<<<CIptvTestUtilModule::StopDownloads");
|
|
579 |
return err;
|
|
580 |
}
|
|
581 |
|
|
582 |
// -----------------------------------------------------------------------------
|
|
583 |
// CIptvTestUtilModule::ConnectionCreated
|
|
584 |
// -----------------------------------------------------------------------------
|
|
585 |
//
|
|
586 |
void CIptvTestUtilModule::ConnectionCreated()
|
|
587 |
{
|
|
588 |
VCXLOGLO1("CIptvTestUtilModule:: Connection created.");
|
|
589 |
if(iTimer)
|
|
590 |
{
|
|
591 |
iTimer->CancelTimer();
|
|
592 |
}
|
|
593 |
Signal();
|
|
594 |
}
|
|
595 |
|
|
596 |
// -----------------------------------------------------------------------------
|
|
597 |
// CIptvTestUtilModule::ConnectionClosed
|
|
598 |
// -----------------------------------------------------------------------------
|
|
599 |
//
|
|
600 |
void CIptvTestUtilModule::ConnectionClosed()
|
|
601 |
{
|
|
602 |
VCXLOGLO1("CIptvTestUtilModule:: Connection closed.");
|
|
603 |
Signal();
|
|
604 |
if(iTimer)
|
|
605 |
{
|
|
606 |
iTimer->CancelTimer();
|
|
607 |
}
|
|
608 |
|
|
609 |
}
|
|
610 |
|
|
611 |
// -----------------------------------------------------------------------------
|
|
612 |
// CIptvTestUtilModule::ConnectionTimeout
|
|
613 |
// -----------------------------------------------------------------------------
|
|
614 |
//
|
|
615 |
void CIptvTestUtilModule::ConnectionTimeout()
|
|
616 |
{
|
|
617 |
VCXLOGLO1("CIptvTestUtilModule:: Connection timeout!");
|
|
618 |
Signal(KErrTimedOut);
|
|
619 |
if(iTimer)
|
|
620 |
{
|
|
621 |
iTimer->CancelTimer();
|
|
622 |
}
|
|
623 |
|
|
624 |
}
|
|
625 |
|
|
626 |
// -----------------------------------------------------------------------------
|
|
627 |
// CIptvTestUtilModule::ConnectionFailed
|
|
628 |
// -----------------------------------------------------------------------------
|
|
629 |
//
|
|
630 |
void CIptvTestUtilModule::ConnectionFailed()
|
|
631 |
{
|
|
632 |
if(--iRetryCount <= 0)
|
|
633 |
{
|
|
634 |
Signal(KErrGeneral);
|
|
635 |
VCXLOGLO1("CIptvTestUtilModule:: Connection failed!");
|
|
636 |
}
|
|
637 |
else
|
|
638 |
{
|
|
639 |
VCXLOGLO1("CIptvTestUtilModule:: retrying");
|
|
640 |
iConnect->ConnectL();
|
|
641 |
}
|
|
642 |
if(iTimer)
|
|
643 |
{
|
|
644 |
iTimer->CancelTimer();
|
|
645 |
}
|
|
646 |
}
|
|
647 |
|
|
648 |
// -----------------------------------------------------------------------------
|
|
649 |
// CIptvTestUtilModule::ConnectionAlreadyExists
|
|
650 |
// -----------------------------------------------------------------------------
|
|
651 |
//
|
|
652 |
void CIptvTestUtilModule::ConnectionAlreadyExists()
|
|
653 |
{
|
|
654 |
VCXLOGLO1("CIptvTestUtilModule:: Connection already exists.");
|
|
655 |
if(iTimer)
|
|
656 |
{
|
|
657 |
iTimer->CancelTimer();
|
|
658 |
}
|
|
659 |
Signal();
|
|
660 |
}
|
|
661 |
|
|
662 |
// -----------------------------------------------------------------------------
|
|
663 |
// CIptvTestUtilModule::DownloadFinished
|
|
664 |
// -----------------------------------------------------------------------------
|
|
665 |
//
|
|
666 |
void CIptvTestUtilModule::DownloadFinished(TInt aError)
|
|
667 |
{
|
|
668 |
VCXLOGLO1("CIptvTestUtilModule:: Download finished.");
|
|
669 |
Signal(aError);
|
|
670 |
}
|
|
671 |
|
|
672 |
// -----------------------------------------------------------------------------
|
|
673 |
// CIptvTestUtilModule::PrintIAPs
|
|
674 |
// -----------------------------------------------------------------------------
|
|
675 |
//
|
|
676 |
void CIptvTestUtilModule::PrintIAPs()
|
|
677 |
{
|
|
678 |
RArray<TUint32> idArray;
|
|
679 |
CleanupClosePushL( idArray );
|
|
680 |
|
|
681 |
CDesCArrayFlat* nameArray = new (ELeave) CDesCArrayFlat(16);
|
|
682 |
CleanupStack::PushL( nameArray );
|
|
683 |
|
|
684 |
// Get IAP names and ids from the database
|
|
685 |
CCommsDatabase* TheDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
|
|
686 |
CleanupStack::PushL( TheDb );
|
|
687 |
|
|
688 |
TheDb->ShowHiddenRecords();
|
|
689 |
|
|
690 |
CCommsDbTableView* view = TheDb->OpenTableLC( TPtrC(IAP) );
|
|
691 |
//Ethernet with Daemon Dynamic IP
|
|
692 |
TBuf<40> name;
|
|
693 |
TUint32 id;
|
|
694 |
TInt res = view->GotoFirstRecord();
|
|
695 |
while( res == KErrNone )
|
|
696 |
{
|
|
697 |
view->ReadTextL( TPtrC(COMMDB_NAME), name );
|
|
698 |
view->ReadUintL( TPtrC(COMMDB_ID), id );
|
|
699 |
|
|
700 |
idArray.Insert( id, 0 );
|
|
701 |
nameArray->InsertL( 0, name );
|
|
702 |
|
|
703 |
res = view->GotoNextRecord();
|
|
704 |
VCXLOGLO3("IAP name, id: %S, %d", &name, id);
|
|
705 |
}
|
|
706 |
|
|
707 |
CleanupStack::PopAndDestroy( view ); // view
|
|
708 |
CleanupStack::PopAndDestroy( TheDb ); // TheDb
|
|
709 |
|
|
710 |
CleanupStack::PopAndDestroy( 2, &idArray ); // nameArray, idArray
|
|
711 |
}
|
|
712 |
|
|
713 |
// -----------------------------------------------------------------------------
|
|
714 |
// CIptvTestUtilModule::GetIap
|
|
715 |
// -----------------------------------------------------------------------------
|
|
716 |
//
|
|
717 |
void CIptvTestUtilModule::GetIap(TDesC& aIapName, TUint32& aIapId)
|
|
718 |
{
|
|
719 |
VCXLOGLO1(">>>CIptvTestUtilModule::GetIap");
|
|
720 |
RArray<TUint32> idArray;
|
|
721 |
CleanupClosePushL( idArray );
|
|
722 |
|
|
723 |
CDesCArrayFlat* nameArray = new (ELeave) CDesCArrayFlat(16);
|
|
724 |
CleanupStack::PushL( nameArray );
|
|
725 |
|
|
726 |
// Get IAP names and ids from the database
|
|
727 |
CCommsDatabase* TheDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
|
|
728 |
CleanupStack::PushL( TheDb );
|
|
729 |
|
|
730 |
TheDb->ShowHiddenRecords();
|
|
731 |
|
|
732 |
CCommsDbTableView* view = TheDb->OpenTableLC( TPtrC(IAP) );
|
|
733 |
//Ethernet with Daemon Dynamic IP
|
|
734 |
TBuf<40> name;
|
|
735 |
TUint32 id;
|
|
736 |
TInt res = view->GotoFirstRecord();
|
|
737 |
while( res == KErrNone )
|
|
738 |
{
|
|
739 |
view->ReadTextL( TPtrC(COMMDB_NAME), name );
|
|
740 |
view->ReadUintL( TPtrC(COMMDB_ID), id );
|
|
741 |
|
|
742 |
#ifdef __WINSCW__
|
|
743 |
if(_L("Ethernet with Daemon Dynamic IP") == name)
|
|
744 |
{
|
|
745 |
aIapId = id;
|
|
746 |
VCXLOGLO3("CIptvTestUtilModule:: Found IAP: %d, %S", _L("Ethernet with Daemon Dynamic IP"), &aIapName);
|
|
747 |
}
|
|
748 |
#else
|
|
749 |
if(aIapName == name)
|
|
750 |
{
|
|
751 |
aIapId = id;
|
|
752 |
VCXLOGLO3("CIptvTestUtilModule:: Found IAP: %d, %S", aIapId, &aIapName);
|
|
753 |
}
|
|
754 |
#endif
|
|
755 |
|
|
756 |
idArray.Insert( id, 0 );
|
|
757 |
nameArray->InsertL( 0, name );
|
|
758 |
|
|
759 |
res = view->GotoNextRecord();
|
|
760 |
}
|
|
761 |
|
|
762 |
CleanupStack::PopAndDestroy( view ); // view
|
|
763 |
CleanupStack::PopAndDestroy( TheDb ); // TheDb
|
|
764 |
|
|
765 |
CleanupStack::PopAndDestroy( 2, &idArray ); // nameArray, idArray
|
|
766 |
VCXLOGLO1("<<<CIptvTestUtilModule::GetIap");
|
|
767 |
}
|
|
768 |
|
|
769 |
// -----------------------------------------------------------------------------
|
|
770 |
// CIptvTestUtilModule::WaitForConnectionActivityL
|
|
771 |
// -----------------------------------------------------------------------------
|
|
772 |
//
|
|
773 |
TInt CIptvTestUtilModule::WaitForConnectionActivityL(CStifItemParser& aItem )
|
|
774 |
{
|
|
775 |
VCXLOGLO1(">>>CIptvTestUtilModule::WaitForConnectionActivityL");
|
|
776 |
// Print to UI
|
|
777 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
778 |
_LIT( KWhere, "In WaitForConnectionActivityL" );
|
|
779 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
780 |
// Print to log file
|
|
781 |
iLog->Log( KWhere );
|
|
782 |
|
|
783 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
784 |
|
|
785 |
TInt err = KErrNone;
|
|
786 |
|
|
787 |
TPtrC iapName;
|
|
788 |
|
|
789 |
if( KErrNone != aItem.GetNextString(iapName) )
|
|
790 |
{
|
|
791 |
VCXLOGLO1("** FAIL ** Invalid testcase parameter! Iap name was not specified.");
|
|
792 |
iLog->Log( _L("** FAIL ** Invalid testcase parameter! Iap name was not specified.") );
|
|
793 |
VCXLOGLO1("<<<CIptvTestUtilModule::WaitForConnectionActivityL");
|
|
794 |
return KErrGeneral;
|
|
795 |
}
|
|
796 |
|
|
797 |
if( iConnectionWaiter == NULL )
|
|
798 |
{
|
|
799 |
iConnectionWaiter = CTestUtilConnectionWaiter::NewL(this);
|
|
800 |
}
|
|
801 |
|
|
802 |
TUint32 iapId;
|
|
803 |
if( !iTestCommon->GetIapIdL( iapName, iapId ) )
|
|
804 |
{
|
|
805 |
VCXLOGLO2("** FAIL ** Could not find iap with name %S.", &iapName);
|
|
806 |
iLog->Log( _L("** FAIL ** Could not find specified iap.") );
|
|
807 |
VCXLOGLO1("<<<CIptvTestUtilModule::WaitForConnectionActivityL");
|
|
808 |
return KErrArgument;
|
|
809 |
}
|
|
810 |
|
|
811 |
iConnectionWaiter->WaitForConnection(iapId);
|
|
812 |
|
|
813 |
VCXLOGLO1("<<<CIptvTestUtilModule::WaitForConnectionActivityL");
|
|
814 |
return err;
|
|
815 |
}
|
|
816 |
|
|
817 |
// -----------------------------------------------------------------------------
|
|
818 |
// CIptvTestUtilModule::WaitUntilConnectionIsClosed
|
|
819 |
// -----------------------------------------------------------------------------
|
|
820 |
//
|
|
821 |
TInt CIptvTestUtilModule::WaitUntilConnectionIsClosed(CStifItemParser& aItem )
|
|
822 |
{
|
|
823 |
VCXLOGLO1(">>>CIptvTestUtilModule::WaitUntilConnectionIsClosed");
|
|
824 |
// Print to UI
|
|
825 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
826 |
_LIT( KWhere, "In WaitForConnectionActivityL" );
|
|
827 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
828 |
// Print to log file
|
|
829 |
iLog->Log( KWhere );
|
|
830 |
|
|
831 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
832 |
|
|
833 |
TInt err = KErrNone;
|
|
834 |
|
|
835 |
TRAP(err, PrintIAPs() );
|
|
836 |
|
|
837 |
TPtrC iapName;
|
|
838 |
|
|
839 |
if(KErrNone != aItem.GetNextString(iapName) )
|
|
840 |
{
|
|
841 |
VCXLOGLO1("** FAIL ** Invalid testcase parameter! Iap name was not specified.");
|
|
842 |
iLog->Log( _L("** FAIL ** Invalid testcase parameter! Iap name was not specified.") );
|
|
843 |
VCXLOGLO1("<<<CIptvTestUtilModule::WaitUntilConnectionIsClosed");
|
|
844 |
return KErrGeneral;
|
|
845 |
}
|
|
846 |
|
|
847 |
if(iConnectionWaiter == NULL)
|
|
848 |
{
|
|
849 |
iConnectionWaiter = CTestUtilConnectionWaiter::NewL(this);
|
|
850 |
}
|
|
851 |
|
|
852 |
TUint32 iapId;
|
|
853 |
if(!iTestCommon->GetIapIdL(iapName, iapId))
|
|
854 |
{
|
|
855 |
VCXLOGLO2("** FAIL ** Could not find iap with name %S.", &iapName);
|
|
856 |
iLog->Log( _L("** FAIL ** Could not find specified iap.") );
|
|
857 |
VCXLOGLO1("<<<CIptvTestUtilModule::WaitUntilConnectionIsClosed");
|
|
858 |
return KErrArgument;
|
|
859 |
}
|
|
860 |
|
|
861 |
iConnectionWaiter->WaitUntilConnectionIsClosed(iapId);
|
|
862 |
|
|
863 |
VCXLOGLO1("<<<CIptvTestUtilModule::WaitUntilConnectionIsClosed");
|
|
864 |
return KErrNone;
|
|
865 |
}
|
|
866 |
|
|
867 |
// -----------------------------------------------------------------------------
|
|
868 |
// CIptvTestUtilModule::TimerComplete
|
|
869 |
// -----------------------------------------------------------------------------
|
|
870 |
//
|
|
871 |
void CIptvTestUtilModule::TimerComplete(TInt aTimerId, TInt aError )
|
|
872 |
{
|
|
873 |
VCXLOGLO1(">>>CIptvTestUtilModule::TimerComplete");
|
|
874 |
VCXLOGLO2(">>>CIptvTestUtilModule:: aError: %d", aError);
|
|
875 |
|
|
876 |
if(aError == KErrNone && aTimerId == KConnectionTimerId)
|
|
877 |
{
|
|
878 |
VCXLOGLO1("* ERROR * Connection timedout!");
|
|
879 |
Signal(KErrTimedOut);
|
|
880 |
}
|
|
881 |
|
|
882 |
VCXLOGLO1("<<<CIptvTestUtilModule::TimerComplete");
|
|
883 |
}
|
|
884 |
|
|
885 |
// -----------------------------------------------------------------------------
|
|
886 |
// CIptvTestUtilModule::AdvanceSystemTime1Second
|
|
887 |
// -----------------------------------------------------------------------------
|
|
888 |
//
|
|
889 |
TInt CIptvTestUtilModule::AdvanceSystemTime1Second(CStifItemParser& /* aItem */ )
|
|
890 |
{
|
|
891 |
VCXLOGLO1(">>>CIptvTestUtilModule::AdvanceSystemTime1Second");
|
|
892 |
// Print to UI
|
|
893 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
894 |
_LIT( KWhere, "In AdvanceSystemTime1Second" );
|
|
895 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
896 |
// Print to log file
|
|
897 |
iLog->Log( KWhere );
|
|
898 |
|
|
899 |
TInt err = CVCXTestCommon::AdvanceSystemTimeSeconds(1);
|
|
900 |
|
|
901 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTime1Second");
|
|
902 |
return err;
|
|
903 |
}
|
|
904 |
|
|
905 |
// -----------------------------------------------------------------------------
|
|
906 |
// CIptvTestUtilModule::AdvanceSystemTimeSeconds
|
|
907 |
// -----------------------------------------------------------------------------
|
|
908 |
//
|
|
909 |
TInt CIptvTestUtilModule::AdvanceSystemTimeSeconds(CStifItemParser& aItem )
|
|
910 |
{
|
|
911 |
VCXLOGLO1(">>>CIptvTestUtilModule::AdvanceSystemTimeSeconds");
|
|
912 |
// Print to UI
|
|
913 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
914 |
_LIT( KWhere, "In AdvanceSystemTimeSeconds" );
|
|
915 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
916 |
// Print to log file
|
|
917 |
iLog->Log( KWhere );
|
|
918 |
|
|
919 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
920 |
|
|
921 |
TInt count;
|
|
922 |
if(aItem.GetNextInt(count) != KErrNone)
|
|
923 |
{
|
|
924 |
VCXLOGLO1("* ERROR * Parameter missing.");
|
|
925 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeDays");
|
|
926 |
return KErrArgument;
|
|
927 |
}
|
|
928 |
|
|
929 |
TInt err = CVCXTestCommon::AdvanceSystemTimeSeconds(count);
|
|
930 |
|
|
931 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeSeconds");
|
|
932 |
return err;
|
|
933 |
}
|
|
934 |
|
|
935 |
// -----------------------------------------------------------------------------
|
|
936 |
// CIptvTestUtilModule::AdvanceSystemTimeMinutes
|
|
937 |
// -----------------------------------------------------------------------------
|
|
938 |
//
|
|
939 |
TInt CIptvTestUtilModule::AdvanceSystemTimeMinutes(CStifItemParser& aItem )
|
|
940 |
{
|
|
941 |
VCXLOGLO1(">>>CIptvTestUtilModule::AdvanceSystemTimeMinutes");
|
|
942 |
// Print to UI
|
|
943 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
944 |
_LIT( KWhere, "In AdvanceSystemTimeMinutes" );
|
|
945 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
946 |
// Print to log file
|
|
947 |
iLog->Log( KWhere );
|
|
948 |
|
|
949 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
950 |
|
|
951 |
TInt count;
|
|
952 |
if(aItem.GetNextInt(count) != KErrNone)
|
|
953 |
{
|
|
954 |
VCXLOGLO1("* ERROR * Parameter missing.");
|
|
955 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeDays");
|
|
956 |
return KErrArgument;
|
|
957 |
}
|
|
958 |
|
|
959 |
TInt err = CVCXTestCommon::AdvanceSystemTimeMinutes(count);
|
|
960 |
|
|
961 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeMinutes");
|
|
962 |
return err;
|
|
963 |
}
|
|
964 |
|
|
965 |
// -----------------------------------------------------------------------------
|
|
966 |
// CIptvTestUtilModule::AdvanceSystemTimeHours
|
|
967 |
// -----------------------------------------------------------------------------
|
|
968 |
//
|
|
969 |
TInt CIptvTestUtilModule::AdvanceSystemTimeHours(CStifItemParser& aItem )
|
|
970 |
{
|
|
971 |
VCXLOGLO1(">>>CIptvTestUtilModule::AdvanceSystemTimeHours");
|
|
972 |
// Print to UI
|
|
973 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
974 |
_LIT( KWhere, "In AdvanceSystemTimeHours" );
|
|
975 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
976 |
// Print to log file
|
|
977 |
iLog->Log( KWhere );
|
|
978 |
|
|
979 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
980 |
|
|
981 |
TInt count;
|
|
982 |
if(aItem.GetNextInt(count) != KErrNone)
|
|
983 |
{
|
|
984 |
VCXLOGLO1("* ERROR * Parameter missing.");
|
|
985 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeDays");
|
|
986 |
return KErrArgument;
|
|
987 |
}
|
|
988 |
|
|
989 |
TInt err = CVCXTestCommon::AdvanceSystemTimeHours(count);
|
|
990 |
|
|
991 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeHours");
|
|
992 |
return err;
|
|
993 |
}
|
|
994 |
|
|
995 |
// -----------------------------------------------------------------------------
|
|
996 |
// CIptvTestUtilModule::AdvanceSystemTimeDays
|
|
997 |
// -----------------------------------------------------------------------------
|
|
998 |
//
|
|
999 |
TInt CIptvTestUtilModule::AdvanceSystemTimeDays(CStifItemParser& aItem )
|
|
1000 |
{
|
|
1001 |
VCXLOGLO1(">>>CIptvTestUtilModule::AdvanceSystemTimeDays");
|
|
1002 |
// Print to UI
|
|
1003 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1004 |
_LIT( KWhere, "In AdvanceSystemTimeDays" );
|
|
1005 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1006 |
// Print to log file
|
|
1007 |
iLog->Log( KWhere );
|
|
1008 |
|
|
1009 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1010 |
|
|
1011 |
TInt daysInt;
|
|
1012 |
if(aItem.GetNextInt(daysInt) != KErrNone)
|
|
1013 |
{
|
|
1014 |
VCXLOGLO1("* ERROR * Parameter days missing.");
|
|
1015 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeDays");
|
|
1016 |
return KErrArgument;
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
TTime now;
|
|
1020 |
now.HomeTime();
|
|
1021 |
|
|
1022 |
TTimeIntervalDays days(daysInt);
|
|
1023 |
now += days;
|
|
1024 |
|
|
1025 |
TInt err = CVCXTestCommon::SetSystemTime(now);
|
|
1026 |
|
|
1027 |
VCXLOGLO1("<<<CIptvTestUtilModule::AdvanceSystemTimeDays");
|
|
1028 |
|
|
1029 |
return err;
|
|
1030 |
}
|
|
1031 |
|
|
1032 |
// -----------------------------------------------------------------------------
|
|
1033 |
// CIptvTestUtilModule::SetSystemTime
|
|
1034 |
// -----------------------------------------------------------------------------
|
|
1035 |
//
|
|
1036 |
TInt CIptvTestUtilModule::SetSystemTime(CStifItemParser& aItem )
|
|
1037 |
{
|
|
1038 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetSystemTime");
|
|
1039 |
// Print to UI
|
|
1040 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1041 |
_LIT( KWhere, "In SetSystemTime" );
|
|
1042 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1043 |
// Print to log file
|
|
1044 |
iLog->Log( KWhere );
|
|
1045 |
|
|
1046 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1047 |
|
|
1048 |
TPtrC dayString;
|
|
1049 |
if(aItem.GetNextString(dayString) != KErrNone)
|
|
1050 |
{
|
|
1051 |
VCXLOGLO1("* ERROR * Parameter missing.");
|
|
1052 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetSystemTime");
|
|
1053 |
return KErrArgument;
|
|
1054 |
}
|
|
1055 |
|
|
1056 |
TTime time( dayString );
|
|
1057 |
TInt err = CVCXTestCommon::SetSystemTime(time);
|
|
1058 |
|
|
1059 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetSystemTime");
|
|
1060 |
return err;
|
|
1061 |
}
|
|
1062 |
|
|
1063 |
// -----------------------------------------------------------------------------
|
|
1064 |
// CIptvTestUtilModule::SetSystemTimeToday
|
|
1065 |
// -----------------------------------------------------------------------------
|
|
1066 |
//
|
|
1067 |
TInt CIptvTestUtilModule::SetSystemTimeToday(CStifItemParser& aItem )
|
|
1068 |
{
|
|
1069 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetSystemTimeToday");
|
|
1070 |
// Print to UI
|
|
1071 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1072 |
_LIT( KWhere, "In SetSystemTimeToday" );
|
|
1073 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1074 |
// Print to log file
|
|
1075 |
iLog->Log( KWhere );
|
|
1076 |
|
|
1077 |
TInt hour( 0 );
|
|
1078 |
TInt minute( 0 );
|
|
1079 |
|
|
1080 |
aItem.GetNextInt( hour );
|
|
1081 |
aItem.GetNextInt( minute );
|
|
1082 |
|
|
1083 |
TTime time;
|
|
1084 |
TBuf<256> timeString;
|
|
1085 |
time.HomeTime();
|
|
1086 |
time.FormatL( timeString, KDateTimeString );
|
|
1087 |
VCXLOGLO2("CIptvTestUtilModule::SetSystemTimeToday -- HomeTime() %S", &timeString);
|
|
1088 |
|
|
1089 |
TDateTime dateTime( time.DateTime() );
|
|
1090 |
dateTime = time.DateTime();
|
|
1091 |
dateTime.SetHour( hour );
|
|
1092 |
dateTime.SetMinute( minute );
|
|
1093 |
|
|
1094 |
time = dateTime;
|
|
1095 |
time.FormatL( timeString, KDateTimeString );
|
|
1096 |
VCXLOGLO2("CIptvTestUtilModule::SetSystemTimeToday -- System time set to: %S", &timeString);
|
|
1097 |
|
|
1098 |
/*
|
|
1099 |
time.UniversalTime();
|
|
1100 |
time.FormatL( timeString, KDateTimeString );
|
|
1101 |
VCXLOGLO2("CIptvTestUtilModule::SetSystemTimeToday -- Universal time: %S", &timeString);
|
|
1102 |
*/
|
|
1103 |
|
|
1104 |
TInt err = CVCXTestCommon::SetSystemTime(time);
|
|
1105 |
|
|
1106 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetSystemTimeToday");
|
|
1107 |
return err;
|
|
1108 |
}
|
|
1109 |
|
|
1110 |
// -----------------------------------------------------------------------------
|
|
1111 |
// CIptvTestUtilModule::SetTimeZone
|
|
1112 |
// -----------------------------------------------------------------------------
|
|
1113 |
//
|
|
1114 |
TInt CIptvTestUtilModule::SetTimeZone(CStifItemParser& aItem )
|
|
1115 |
{
|
|
1116 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetTimeZone");
|
|
1117 |
// Print to UI
|
|
1118 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1119 |
_LIT( KWhere, "In SetTimeZone" );
|
|
1120 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1121 |
// Print to log file
|
|
1122 |
iLog->Log( KWhere );
|
|
1123 |
|
|
1124 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1125 |
|
|
1126 |
TPtrC timeZone;
|
|
1127 |
if(aItem.GetNextString(timeZone) != KErrNone)
|
|
1128 |
{
|
|
1129 |
VCXLOGLO1("* ERROR * Parameter missing.");
|
|
1130 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetTimeZone");
|
|
1131 |
return KErrArgument;
|
|
1132 |
}
|
|
1133 |
|
|
1134 |
TInt err = CVCXTestCommon::SetTimeZone(timeZone);
|
|
1135 |
|
|
1136 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetTimeZone");
|
|
1137 |
return err;
|
|
1138 |
}
|
|
1139 |
|
|
1140 |
// -----------------------------------------------------------------------------
|
|
1141 |
// CIptvTestUtilModule::CreateMobilecrashWatcherL
|
|
1142 |
// -----------------------------------------------------------------------------
|
|
1143 |
//
|
|
1144 |
TInt CIptvTestUtilModule::CreateMobilecrashWatcherL(CStifItemParser& /* aItem */ )
|
|
1145 |
{
|
|
1146 |
VCXLOGLO1(">>>CIptvTestUtilModule::CreateMobilecrashWatcherL");
|
|
1147 |
// Print to UI
|
|
1148 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1149 |
_LIT( KWhere, "In CreateMobilecrashWatcherL" );
|
|
1150 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1151 |
// Print to log file
|
|
1152 |
iLog->Log( KWhere );
|
|
1153 |
|
|
1154 |
if(iIptvTestMobilecrashWatcher)
|
|
1155 |
{
|
|
1156 |
delete iIptvTestMobilecrashWatcher;
|
|
1157 |
iIptvTestMobilecrashWatcher = NULL;
|
|
1158 |
}
|
|
1159 |
|
|
1160 |
iIptvTestMobilecrashWatcher = CIptvTestMobilecrashWatcher::NewL(EFalse);
|
|
1161 |
|
|
1162 |
VCXLOGLO1("<<<CIptvTestUtilModule::CreateMobilecrashWatcherL");
|
|
1163 |
return KErrNone;
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
// -----------------------------------------------------------------------------
|
|
1167 |
// CIptvTestUtilModule::CheckMobilecrashesL
|
|
1168 |
// -----------------------------------------------------------------------------
|
|
1169 |
//
|
|
1170 |
TInt CIptvTestUtilModule::CheckMobilecrashesL(CStifItemParser& /* aItem */ )
|
|
1171 |
{
|
|
1172 |
VCXLOGLO1(">>>CIptvTestUtilModule::CheckMobilecrashesL");
|
|
1173 |
// Print to UI
|
|
1174 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1175 |
_LIT( KWhere, "In CheckMobilecrashesl" );
|
|
1176 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1177 |
// Print to log file
|
|
1178 |
iLog->Log( KWhere );
|
|
1179 |
|
|
1180 |
if(!iIptvTestMobilecrashWatcher)
|
|
1181 |
{
|
|
1182 |
VCXLOGLO1("<<<CIptvTestUtilModule::CheckMobilecrashesL");
|
|
1183 |
return KErrNotReady;
|
|
1184 |
}
|
|
1185 |
|
|
1186 |
RPointerArray<HBufC> crashes;
|
|
1187 |
if(iIptvTestMobilecrashWatcher->ReturnNewCrashes(crashes))
|
|
1188 |
{
|
|
1189 |
VCXLOGLO1("<<<CIptvTestUtilModule::CheckMobilecrashesL");
|
|
1190 |
crashes.ResetAndDestroy();
|
|
1191 |
return KErrAbort;
|
|
1192 |
}
|
|
1193 |
crashes.ResetAndDestroy();
|
|
1194 |
|
|
1195 |
VCXLOGLO1("<<<CIptvTestUtilModule::CheckMobilecrashesL");
|
|
1196 |
return KErrNone;
|
|
1197 |
}
|
|
1198 |
|
|
1199 |
// -----------------------------------------------------------------------------
|
|
1200 |
// CIptvTestUtilModule::CheckMobilecrashesZeroToleranceL
|
|
1201 |
// -----------------------------------------------------------------------------
|
|
1202 |
//
|
|
1203 |
TInt CIptvTestUtilModule::CheckMobilecrashesZeroToleranceL(CStifItemParser& /* aItem */ )
|
|
1204 |
{
|
|
1205 |
VCXLOGLO1(">>>CIptvTestUtilModule::CheckMobilecrashesZeroToleranceL");
|
|
1206 |
// Print to UI
|
|
1207 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1208 |
_LIT( KWhere, "In CheckMobilecrashesl" );
|
|
1209 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1210 |
// Print to log file
|
|
1211 |
iLog->Log( KWhere );
|
|
1212 |
|
|
1213 |
if(!iIptvTestMobilecrashWatcher)
|
|
1214 |
{
|
|
1215 |
iIptvTestMobilecrashWatcher = CIptvTestMobilecrashWatcher::NewL(EFalse);
|
|
1216 |
}
|
|
1217 |
|
|
1218 |
TInt ret = KErrNone;
|
|
1219 |
if(iIptvTestMobilecrashWatcher->ReturnMobileCrashCount() > 0)
|
|
1220 |
{
|
|
1221 |
ret = KErrAbort;
|
|
1222 |
}
|
|
1223 |
|
|
1224 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1225 |
VCXLOGLO1("<<<CIptvTestUtilModule::CheckMobilecrashesZeroToleranceL");
|
|
1226 |
return ret;
|
|
1227 |
}
|
|
1228 |
|
|
1229 |
// -----------------------------------------------------------------------------
|
|
1230 |
// CIptvTestUtilModule::DeleteUsedDestinationCenRepL
|
|
1231 |
// -----------------------------------------------------------------------------
|
|
1232 |
//
|
|
1233 |
TInt CIptvTestUtilModule::DeleteUsedDestinationCenRepL(CStifItemParser& aItem )
|
|
1234 |
{
|
|
1235 |
VCXLOGLO1(">>>CIptvTestUtilModule::DeleteUsedDestinationCenRepL");
|
|
1236 |
// Print to UI
|
|
1237 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1238 |
_LIT( KWhere, "In DeleteUsedDestinationCenRepL" );
|
|
1239 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1240 |
// Print to log file
|
|
1241 |
iLog->Log( KWhere );
|
|
1242 |
|
|
1243 |
TInt ret( KErrNone );
|
|
1244 |
|
|
1245 |
if( !iTestUtilALR )
|
|
1246 |
{
|
|
1247 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1248 |
}
|
|
1249 |
|
|
1250 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1251 |
|
|
1252 |
TRAP( ret, iTestUtilALR->RemoveUsedDestinationCenRepL() );
|
|
1253 |
|
|
1254 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1255 |
VCXLOGLO1("<<<CIptvTestUtilModule::DeleteUsedDestinationCenRepL");
|
|
1256 |
return ret;
|
|
1257 |
}
|
|
1258 |
|
|
1259 |
// -----------------------------------------------------------------------------
|
|
1260 |
// CIptvTestUtilModule::SetDefaultIapCenRep
|
|
1261 |
// -----------------------------------------------------------------------------
|
|
1262 |
//
|
|
1263 |
TInt CIptvTestUtilModule::SetDefaultIapCenRepL(CStifItemParser& aItem )
|
|
1264 |
{
|
|
1265 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetDefaultIapCenRep");
|
|
1266 |
// Print to UI
|
|
1267 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1268 |
_LIT( KWhere, "In SetDefaultIapCenRep" );
|
|
1269 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1270 |
// Print to log file
|
|
1271 |
iLog->Log( KWhere );
|
|
1272 |
|
|
1273 |
TInt ret( KErrNone );
|
|
1274 |
|
|
1275 |
if( !iTestUtilALR )
|
|
1276 |
{
|
|
1277 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1278 |
}
|
|
1279 |
|
|
1280 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1281 |
|
|
1282 |
TRAP( ret, iTestUtilALR->SetDefaultIapCenRep() );
|
|
1283 |
|
|
1284 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1285 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetDefaultIapCenRep");
|
|
1286 |
return ret;
|
|
1287 |
}
|
|
1288 |
|
|
1289 |
// -----------------------------------------------------------------------------
|
|
1290 |
// CIptvTestUtilModule::SetUsedDestinationL
|
|
1291 |
// -----------------------------------------------------------------------------
|
|
1292 |
//
|
|
1293 |
TInt CIptvTestUtilModule::SetUsedDestinationL(CStifItemParser& aItem )
|
|
1294 |
{
|
|
1295 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetUsedDestinationL");
|
|
1296 |
// Print to UI
|
|
1297 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1298 |
_LIT( KWhere, "In SetUsedDestinationL" );
|
|
1299 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1300 |
// Print to log file
|
|
1301 |
iLog->Log( KWhere );
|
|
1302 |
|
|
1303 |
TInt ret( KErrNone );
|
|
1304 |
|
|
1305 |
if( !iTestUtilALR )
|
|
1306 |
{
|
|
1307 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1308 |
}
|
|
1309 |
|
|
1310 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1311 |
|
|
1312 |
TPtrC destinationName;
|
|
1313 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1314 |
|
|
1315 |
TRAP( ret, iTestUtilALR->SetUsedDestinationL( destinationName ) );
|
|
1316 |
|
|
1317 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1318 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetUsedDestinationL");
|
|
1319 |
return ret;
|
|
1320 |
}
|
|
1321 |
|
|
1322 |
// -----------------------------------------------------------------------------
|
|
1323 |
// CIptvTestUtilModule::CreateDestinationL
|
|
1324 |
// -----------------------------------------------------------------------------
|
|
1325 |
//
|
|
1326 |
TInt CIptvTestUtilModule::CreateDestinationL(CStifItemParser& aItem )
|
|
1327 |
{
|
|
1328 |
VCXLOGLO1(">>>CIptvTestUtilModule::CreateDestinationL");
|
|
1329 |
// Print to UI
|
|
1330 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1331 |
_LIT( KWhere, "In CreateDestinationL" );
|
|
1332 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1333 |
// Print to log file
|
|
1334 |
iLog->Log( KWhere );
|
|
1335 |
|
|
1336 |
TInt ret( KErrNotSupported );
|
|
1337 |
|
|
1338 |
if( !iTestUtilALR )
|
|
1339 |
{
|
|
1340 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1341 |
}
|
|
1342 |
|
|
1343 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1344 |
|
|
1345 |
TPtrC destinationName;
|
|
1346 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1347 |
|
|
1348 |
TRAP(ret, iTestUtilALR->CreateDestinationL( destinationName ) );
|
|
1349 |
|
|
1350 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1351 |
VCXLOGLO1("<<<CIptvTestUtilModule::CreateDestinationL");
|
|
1352 |
return ret;
|
|
1353 |
}
|
|
1354 |
|
|
1355 |
// -----------------------------------------------------------------------------
|
|
1356 |
// CIptvTestUtilModule::DeleteDestinationL
|
|
1357 |
// -----------------------------------------------------------------------------
|
|
1358 |
//
|
|
1359 |
TInt CIptvTestUtilModule::DeleteDestinationL(CStifItemParser& aItem )
|
|
1360 |
{
|
|
1361 |
VCXLOGLO1(">>>CIptvTestUtilModule::DeleteDestinationL");
|
|
1362 |
// Print to UI
|
|
1363 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1364 |
_LIT( KWhere, "In DeleteDestinationL" );
|
|
1365 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1366 |
// Print to log file
|
|
1367 |
iLog->Log( KWhere );
|
|
1368 |
|
|
1369 |
TInt ret( KErrNotSupported );
|
|
1370 |
|
|
1371 |
if( !iTestUtilALR )
|
|
1372 |
{
|
|
1373 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1374 |
}
|
|
1375 |
|
|
1376 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1377 |
|
|
1378 |
TPtrC destinationName;
|
|
1379 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1380 |
|
|
1381 |
TRAP(ret, iTestUtilALR->DeleteDestinationL( destinationName ) );
|
|
1382 |
|
|
1383 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1384 |
VCXLOGLO1("<<<CIptvTestUtilModule::DeleteDestinationL");
|
|
1385 |
return ret;
|
|
1386 |
}
|
|
1387 |
|
|
1388 |
// -----------------------------------------------------------------------------
|
|
1389 |
// CIptvTestUtilModule::CopyMethodL
|
|
1390 |
// -----------------------------------------------------------------------------
|
|
1391 |
//
|
|
1392 |
TInt CIptvTestUtilModule::CopyMethodL(CStifItemParser& aItem )
|
|
1393 |
{
|
|
1394 |
VCXLOGLO1(">>>CIptvTestUtilModule::CopyMethodL");
|
|
1395 |
// Print to UI
|
|
1396 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1397 |
_LIT( KWhere, "In CopyMethodL" );
|
|
1398 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1399 |
// Print to log file
|
|
1400 |
iLog->Log( KWhere );
|
|
1401 |
|
|
1402 |
TInt ret( KErrNotSupported );
|
|
1403 |
|
|
1404 |
if( !iTestUtilALR )
|
|
1405 |
{
|
|
1406 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1407 |
}
|
|
1408 |
|
|
1409 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1410 |
|
|
1411 |
TPtrC sourceMethodName;
|
|
1412 |
TPtrC targetMethodName;
|
|
1413 |
TPtrC targetDestinationName;
|
|
1414 |
|
|
1415 |
User::LeaveIfError( aItem.GetNextString( sourceMethodName ) );
|
|
1416 |
User::LeaveIfError( aItem.GetNextString( targetMethodName ) );
|
|
1417 |
User::LeaveIfError( aItem.GetNextString( targetDestinationName ) );
|
|
1418 |
|
|
1419 |
TRAP(ret, iTestUtilALR->CopyMethodL( sourceMethodName, targetMethodName, targetDestinationName ) );
|
|
1420 |
|
|
1421 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1422 |
VCXLOGLO1("<<<CIptvTestUtilModule::CopyMethodL");
|
|
1423 |
return ret;
|
|
1424 |
}
|
|
1425 |
|
|
1426 |
// -----------------------------------------------------------------------------
|
|
1427 |
// CIptvTestUtilModule::DeleteMethodL
|
|
1428 |
// -----------------------------------------------------------------------------
|
|
1429 |
//
|
|
1430 |
TInt CIptvTestUtilModule::DeleteMethodL(CStifItemParser& aItem )
|
|
1431 |
{
|
|
1432 |
VCXLOGLO1(">>>CIptvTestUtilModule::DeleteMethodL");
|
|
1433 |
// Print to UI
|
|
1434 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1435 |
_LIT( KWhere, "In DeleteMethodL" );
|
|
1436 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1437 |
// Print to log file
|
|
1438 |
iLog->Log( KWhere );
|
|
1439 |
|
|
1440 |
TInt ret( KErrNotSupported );
|
|
1441 |
|
|
1442 |
if( !iTestUtilALR )
|
|
1443 |
{
|
|
1444 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1445 |
}
|
|
1446 |
|
|
1447 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1448 |
|
|
1449 |
TPtrC destinationName;
|
|
1450 |
TPtrC methodName;
|
|
1451 |
|
|
1452 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1453 |
User::LeaveIfError( aItem.GetNextString( methodName ) );
|
|
1454 |
|
|
1455 |
TRAP(ret, iTestUtilALR->DeleteMethodL( destinationName, methodName ) );
|
|
1456 |
|
|
1457 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1458 |
VCXLOGLO1("<<<CIptvTestUtilModule::DeleteMethodL");
|
|
1459 |
return ret;
|
|
1460 |
}
|
|
1461 |
|
|
1462 |
// -----------------------------------------------------------------------------
|
|
1463 |
// CIptvTestUtilModule::SetMethodPriorityL
|
|
1464 |
// -----------------------------------------------------------------------------
|
|
1465 |
//
|
|
1466 |
TInt CIptvTestUtilModule::SetMethodPriorityL(CStifItemParser& aItem )
|
|
1467 |
{
|
|
1468 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetMethodPriorityL");
|
|
1469 |
// Print to UI
|
|
1470 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1471 |
_LIT( KWhere, "In SetMethodPriorityL" );
|
|
1472 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1473 |
// Print to log file
|
|
1474 |
iLog->Log( KWhere );
|
|
1475 |
|
|
1476 |
TInt ret( KErrNotSupported );
|
|
1477 |
|
|
1478 |
if( !iTestUtilALR )
|
|
1479 |
{
|
|
1480 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1481 |
}
|
|
1482 |
|
|
1483 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1484 |
|
|
1485 |
TPtrC destinationName;
|
|
1486 |
TPtrC methodName;
|
|
1487 |
TInt priority;
|
|
1488 |
|
|
1489 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1490 |
User::LeaveIfError( aItem.GetNextString( methodName ) );
|
|
1491 |
User::LeaveIfError( aItem.GetNextInt( priority ) );
|
|
1492 |
|
|
1493 |
TRAP(ret, iTestUtilALR->SetMethodPriorityL( destinationName, methodName, priority ) );
|
|
1494 |
|
|
1495 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1496 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetMethodPriorityL");
|
|
1497 |
return ret;
|
|
1498 |
}
|
|
1499 |
|
|
1500 |
// -----------------------------------------------------------------------------
|
|
1501 |
// CIptvTestUtilModule::DeleteDestinationAfterwardsL
|
|
1502 |
// -----------------------------------------------------------------------------
|
|
1503 |
//
|
|
1504 |
TInt CIptvTestUtilModule::DeleteDestinationAfterwardsL(CStifItemParser& aItem )
|
|
1505 |
{
|
|
1506 |
VCXLOGLO1(">>>CIptvTestUtilModule::DeleteDestinationAfterwardsL");
|
|
1507 |
// Print to UI
|
|
1508 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1509 |
_LIT( KWhere, "In DeleteDestinationAfterwardsL" );
|
|
1510 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1511 |
// Print to log file
|
|
1512 |
iLog->Log( KWhere );
|
|
1513 |
|
|
1514 |
TInt ret( KErrNotSupported );
|
|
1515 |
|
|
1516 |
if( !iTestUtilALR )
|
|
1517 |
{
|
|
1518 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1519 |
}
|
|
1520 |
|
|
1521 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1522 |
|
|
1523 |
TPtrC destinationName;
|
|
1524 |
|
|
1525 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1526 |
|
|
1527 |
iToBeDeletedDestinations.AppendL( destinationName.AllocL() );
|
|
1528 |
|
|
1529 |
ret = KErrNone;
|
|
1530 |
|
|
1531 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1532 |
VCXLOGLO1("<<<CIptvTestUtilModule::DeleteDestinationAfterwardsL");
|
|
1533 |
return ret;
|
|
1534 |
}
|
|
1535 |
|
|
1536 |
// -----------------------------------------------------------------------------
|
|
1537 |
// CIptvTestUtilModule::SetConnectionMethodStringAttributeL
|
|
1538 |
// -----------------------------------------------------------------------------
|
|
1539 |
//
|
|
1540 |
TInt CIptvTestUtilModule::SetConnectionMethodStringAttributeL( CStifItemParser& aItem )
|
|
1541 |
{
|
|
1542 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetConnectionMethodStringAttributeL");
|
|
1543 |
// Print to UI
|
|
1544 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1545 |
_LIT( KWhere, "In SetConnectionMethodStringAttributeL" );
|
|
1546 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1547 |
// Print to log file
|
|
1548 |
iLog->Log( KWhere );
|
|
1549 |
|
|
1550 |
TInt ret( KErrNotSupported );
|
|
1551 |
|
|
1552 |
if( !iTestUtilALR )
|
|
1553 |
{
|
|
1554 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1555 |
}
|
|
1556 |
|
|
1557 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1558 |
|
|
1559 |
TPtrC destinationName;
|
|
1560 |
TPtrC methodName;
|
|
1561 |
TInt attribute;
|
|
1562 |
TPtrC value;
|
|
1563 |
|
|
1564 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1565 |
User::LeaveIfError( aItem.GetNextString( methodName ) );
|
|
1566 |
User::LeaveIfError( aItem.GetNextInt( attribute ) );
|
|
1567 |
User::LeaveIfError( aItem.GetNextString( value ) );
|
|
1568 |
|
|
1569 |
TRAP(ret, iTestUtilALR->SetMethodStringAttributeL( destinationName, methodName, attribute, value ) );
|
|
1570 |
|
|
1571 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1572 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetConnectionMethodStringAttributeL");
|
|
1573 |
return ret;
|
|
1574 |
}
|
|
1575 |
|
|
1576 |
// -----------------------------------------------------------------------------
|
|
1577 |
// CIptvTestUtilModule::SetConnectionMethodIntAttributeL
|
|
1578 |
// -----------------------------------------------------------------------------
|
|
1579 |
//
|
|
1580 |
TInt CIptvTestUtilModule::SetConnectionMethodIntAttributeL( CStifItemParser& aItem )
|
|
1581 |
{
|
|
1582 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetConnectionMethodIntAttributeL");
|
|
1583 |
// Print to UI
|
|
1584 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1585 |
_LIT( KWhere, "In SetConnectionMethodIntAttributeL" );
|
|
1586 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1587 |
// Print to log file
|
|
1588 |
iLog->Log( KWhere );
|
|
1589 |
|
|
1590 |
TInt ret( KErrNotSupported );
|
|
1591 |
|
|
1592 |
if( !iTestUtilALR )
|
|
1593 |
{
|
|
1594 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1595 |
}
|
|
1596 |
|
|
1597 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1598 |
|
|
1599 |
TPtrC destinationName;
|
|
1600 |
TPtrC methodName;
|
|
1601 |
TInt attribute;
|
|
1602 |
TInt value;
|
|
1603 |
|
|
1604 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1605 |
User::LeaveIfError( aItem.GetNextString( methodName ) );
|
|
1606 |
User::LeaveIfError( aItem.GetNextInt( attribute ) );
|
|
1607 |
User::LeaveIfError( aItem.GetNextInt( value ) );
|
|
1608 |
|
|
1609 |
TRAP(ret, iTestUtilALR->SetMethodIntAttributeL( destinationName, methodName, attribute, value ) );
|
|
1610 |
|
|
1611 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1612 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetConnectionMethodIntAttributeL");
|
|
1613 |
return ret;
|
|
1614 |
}
|
|
1615 |
// -----------------------------------------------------------------------------
|
|
1616 |
// CIptvTestUtilModule::DeleteDestinationL
|
|
1617 |
// -----------------------------------------------------------------------------
|
|
1618 |
//
|
|
1619 |
TInt CIptvTestUtilModule::SetConnectionMethodBoolAttributeL( CStifItemParser& aItem )
|
|
1620 |
{
|
|
1621 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetConnectionMethodBoolAttributeL");
|
|
1622 |
// Print to UI
|
|
1623 |
_LIT( KIptvTestUtilConnect, "IptvTestUtilModule" );
|
|
1624 |
_LIT( KWhere, "In SetConnectionMethodBoolAttributeL" );
|
|
1625 |
TestModuleIf().Printf( 0, KIptvTestUtilConnect, KWhere );
|
|
1626 |
// Print to log file
|
|
1627 |
iLog->Log( KWhere );
|
|
1628 |
|
|
1629 |
TInt ret( KErrNotSupported );
|
|
1630 |
|
|
1631 |
if( !iTestUtilALR )
|
|
1632 |
{
|
|
1633 |
iTestUtilALR = CIptvTestUtilALR::NewL();
|
|
1634 |
}
|
|
1635 |
|
|
1636 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1637 |
|
|
1638 |
TPtrC destinationName;
|
|
1639 |
TPtrC methodName;
|
|
1640 |
TInt attribute;
|
|
1641 |
TInt value;
|
|
1642 |
|
|
1643 |
User::LeaveIfError( aItem.GetNextString( destinationName ) );
|
|
1644 |
User::LeaveIfError( aItem.GetNextString( methodName ) );
|
|
1645 |
User::LeaveIfError( aItem.GetNextInt( attribute ) );
|
|
1646 |
User::LeaveIfError( aItem.GetNextInt( value ) );
|
|
1647 |
|
|
1648 |
TRAP(ret, iTestUtilALR->SetMethodBoolAttributeL( destinationName, methodName, attribute, static_cast<TBool>(value) ) );
|
|
1649 |
|
|
1650 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", ret);
|
|
1651 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetConnectionMethodBoolAttributeL");
|
|
1652 |
return ret;
|
|
1653 |
}
|
|
1654 |
|
|
1655 |
// -----------------------------------------------------------------------------
|
|
1656 |
// CIptvTestUtilModule::CreateFileL
|
|
1657 |
// -----------------------------------------------------------------------------
|
|
1658 |
//
|
|
1659 |
TInt CIptvTestUtilModule::CreateFileL(CStifItemParser& aItem )
|
|
1660 |
{
|
|
1661 |
VCXLOGLO1(">>>CIptvTestUtilModule::CreateFileL");
|
|
1662 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1663 |
TPtrC fileName;
|
|
1664 |
User::LeaveIfError( aItem.GetNextString( fileName ) );
|
|
1665 |
|
|
1666 |
RFile file;
|
|
1667 |
CleanupClosePushL(file);
|
|
1668 |
TInt err = file.Replace(iFs, fileName, EFileWrite);
|
|
1669 |
CleanupStack::PopAndDestroy( &file );
|
|
1670 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", err);
|
|
1671 |
VCXLOGLO1("<<<CIptvTestUtilModule::CreateFileL");
|
|
1672 |
return err;
|
|
1673 |
}
|
|
1674 |
|
|
1675 |
// -----------------------------------------------------------------------------
|
|
1676 |
// CIptvTestUtilModule::DeleteFileL
|
|
1677 |
// -----------------------------------------------------------------------------
|
|
1678 |
//
|
|
1679 |
TInt CIptvTestUtilModule::DeleteFileL(CStifItemParser& aItem )
|
|
1680 |
{
|
|
1681 |
VCXLOGLO1(">>>CIptvTestUtilModule::DeleteFileL");
|
|
1682 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1683 |
TPtrC fileName;
|
|
1684 |
User::LeaveIfError( aItem.GetNextString( fileName ) );
|
|
1685 |
TInt err = iFs.Delete( fileName );
|
|
1686 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", err);
|
|
1687 |
VCXLOGLO1("<<<CIptvTestUtilModule::DeleteFileL");
|
|
1688 |
return err;
|
|
1689 |
}
|
|
1690 |
|
|
1691 |
// -----------------------------------------------------------------------------
|
|
1692 |
// CIptvTestUtilModule::CreateFolderL
|
|
1693 |
// -----------------------------------------------------------------------------
|
|
1694 |
//
|
|
1695 |
TInt CIptvTestUtilModule::CreateFolderL(CStifItemParser& aItem )
|
|
1696 |
{
|
|
1697 |
VCXLOGLO1(">>>CIptvTestUtilModule::CreateFolderL");
|
|
1698 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1699 |
TPtrC path;
|
|
1700 |
User::LeaveIfError( aItem.GetNextString( path ) );
|
|
1701 |
BaflUtils::EnsurePathExistsL(iFs, path);
|
|
1702 |
VCXLOGLO1("<<<CIptvTestUtilModule::CreateFolderL");
|
|
1703 |
return KErrNone;
|
|
1704 |
}
|
|
1705 |
|
|
1706 |
// -----------------------------------------------------------------------------
|
|
1707 |
// CIptvTestUtilModule::DeleteFolderL
|
|
1708 |
// -----------------------------------------------------------------------------
|
|
1709 |
//
|
|
1710 |
TInt CIptvTestUtilModule::DeleteFolderL(CStifItemParser& aItem )
|
|
1711 |
{
|
|
1712 |
VCXLOGLO1(">>>CIptvTestUtilModule::DeleteFolderL");
|
|
1713 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1714 |
TPtrC path;
|
|
1715 |
User::LeaveIfError( aItem.GetNextString( path ) );
|
|
1716 |
CFileMan* fileMan = CFileMan::NewL(iFs);
|
|
1717 |
CleanupStack::PushL(fileMan);
|
|
1718 |
fileMan->RmDir( path );
|
|
1719 |
CleanupStack::PopAndDestroy( fileMan );
|
|
1720 |
VCXLOGLO1("<<<CIptvTestUtilModule::DeleteFolderL");
|
|
1721 |
return KErrNone;
|
|
1722 |
}
|
|
1723 |
|
|
1724 |
// -----------------------------------------------------------------------------
|
|
1725 |
// CIptvTestUtilModule::LockFileL
|
|
1726 |
// -----------------------------------------------------------------------------
|
|
1727 |
//
|
|
1728 |
TInt CIptvTestUtilModule::LockFileL(CStifItemParser& aItem )
|
|
1729 |
{
|
|
1730 |
VCXLOGLO1(">>>CIptvTestUtilModule::LockFileL");
|
|
1731 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1732 |
TPtrC fileName;
|
|
1733 |
User::LeaveIfError( aItem.GetNextString( fileName ) );
|
|
1734 |
|
|
1735 |
TInt err( KErrInUse );
|
|
1736 |
if( !iFileIsLocked )
|
|
1737 |
{
|
|
1738 |
err = iLockedFile.Open(iFs, fileName, EFileShareExclusive | EFileOpen);
|
|
1739 |
iFileIsLocked = ETrue;
|
|
1740 |
}
|
|
1741 |
VCXLOGLO2("<<<CIptvTestUtilModule:: returning: %d", err);
|
|
1742 |
VCXLOGLO1("<<<CIptvTestUtilModule::LockFileL");
|
|
1743 |
return err;
|
|
1744 |
}
|
|
1745 |
|
|
1746 |
// -----------------------------------------------------------------------------
|
|
1747 |
// CIptvTestUtilModule::LockFileL
|
|
1748 |
// -----------------------------------------------------------------------------
|
|
1749 |
//
|
|
1750 |
TInt CIptvTestUtilModule::UnlockFileL(CStifItemParser& /* aItem */ )
|
|
1751 |
{
|
|
1752 |
VCXLOGLO1(">>>CIptvTestUtilModule::UnlockFileL");
|
|
1753 |
if( iFileIsLocked )
|
|
1754 |
{
|
|
1755 |
iLockedFile.Close();
|
|
1756 |
}
|
|
1757 |
iFileIsLocked = EFalse;
|
|
1758 |
VCXLOGLO1("<<<CIptvTestUtilModule::UnlockFileL");
|
|
1759 |
return KErrNone;
|
|
1760 |
}
|
|
1761 |
|
|
1762 |
// -----------------------------------------------------------------------------
|
|
1763 |
// CIptvTestUtilModule::SetDriveFreeSpaceL(TUint size in bytes)
|
|
1764 |
//
|
|
1765 |
// Creates dummy file so that the remaining disk space equals to given parameter
|
|
1766 |
//
|
|
1767 |
// OLD INFO???
|
|
1768 |
// Note that the videocenter considers C: drive to be full when there is 10% left,
|
|
1769 |
// so if "free space" param is 0, this leaves actually 10% of drive space free.
|
|
1770 |
// -----------------------------------------------------------------------------
|
|
1771 |
//
|
|
1772 |
TInt CIptvTestUtilModule::SetDriveFreeSpaceL( CStifItemParser& aItem )
|
|
1773 |
{
|
|
1774 |
VCXLOGLO1(">>>CIptvTestUtilModule::SetDriveFreeSpaceL");
|
|
1775 |
// Print to UI
|
|
1776 |
_LIT( KWhere, "IptvTestUtilModule" );
|
|
1777 |
_LIT( KSetCFreeSpace, "In SetDriveFreeSpaceL" );
|
|
1778 |
TestModuleIf().Printf( 0, KWhere, KSetCFreeSpace );
|
|
1779 |
// Print to log file
|
|
1780 |
iLog->Log( KSetCFreeSpace );
|
|
1781 |
|
|
1782 |
TPtrC driveLetter;
|
|
1783 |
User::LeaveIfError(aItem.GetNextString( driveLetter ));
|
|
1784 |
|
|
1785 |
VCXLOGLO2("CVCXTestCommon:: drive: %S", &driveLetter);
|
|
1786 |
|
|
1787 |
TInt driveNumber(0);
|
|
1788 |
User::LeaveIfError( iFs.CharToDrive( driveLetter[0], driveNumber ) );
|
|
1789 |
|
|
1790 |
TUint desiredSpace(0);
|
|
1791 |
User::LeaveIfError(aItem.GetNextInt( desiredSpace ));
|
|
1792 |
|
|
1793 |
VCXLOGLO2("CVCXTestCommon:: desired space: %d", desiredSpace);
|
|
1794 |
|
|
1795 |
iDummyFilesCreated = ETrue;
|
|
1796 |
|
|
1797 |
iTestCommon->SetDriveFreeSpaceL( driveNumber, desiredSpace );
|
|
1798 |
|
|
1799 |
VCXLOGLO1("<<<CIptvTestUtilModule::SetDriveFreeSpaceL");
|
|
1800 |
return KErrNone;
|
|
1801 |
}
|
|
1802 |
|
|
1803 |
|
|
1804 |
// -----------------------------------------------------------------------------
|
|
1805 |
// CIptvTestVerifyData::ExtractFile()
|
|
1806 |
// -----------------------------------------------------------------------------
|
|
1807 |
//
|
|
1808 |
TInt CIptvTestUtilModule::ExtractFileL( CStifItemParser& aItem )
|
|
1809 |
{
|
|
1810 |
VCXLOGLO1(">>>CIptvTestUtilModule::ExtractFile");
|
|
1811 |
|
|
1812 |
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
|
|
1813 |
|
|
1814 |
TPtrC zipFileName;
|
|
1815 |
User::LeaveIfError(aItem.GetNextString( zipFileName ));
|
|
1816 |
|
|
1817 |
TPtrC sourceFileName;
|
|
1818 |
User::LeaveIfError(aItem.GetNextString( sourceFileName ));
|
|
1819 |
|
|
1820 |
TPtrC destFileName;
|
|
1821 |
User::LeaveIfError(aItem.GetNextString( destFileName ));
|
|
1822 |
|
|
1823 |
iFs.Delete( sourceFileName );
|
|
1824 |
|
|
1825 |
CZipFile* zipFile;
|
|
1826 |
TRAPD(err, zipFile = CZipFile::NewL( iFs, zipFileName ) );
|
|
1827 |
|
|
1828 |
if( err != KErrNone )
|
|
1829 |
{
|
|
1830 |
VCXLOGLO2("CIptvTestUtilModule:: error %d", err);
|
|
1831 |
delete zipFile;
|
|
1832 |
return err;
|
|
1833 |
}
|
|
1834 |
|
|
1835 |
VCXLOGLO2("CIptvTestUtilModule:: zipFileName: %S", &zipFileName);
|
|
1836 |
VCXLOGLO2("CIptvTestUtilModule:: sourceFileName: %S", &sourceFileName);
|
|
1837 |
VCXLOGLO2("CIptvTestUtilModule:: destFileName: %S", &destFileName);
|
|
1838 |
|
|
1839 |
if( !FileExistsInZip( zipFile, sourceFileName ) )
|
|
1840 |
{
|
|
1841 |
VCXLOGLO1("CIptvTestUtilModule:: No such file in zip! Leaving..");
|
|
1842 |
delete zipFile;
|
|
1843 |
User::Leave( KErrNotFound );
|
|
1844 |
}
|
|
1845 |
|
|
1846 |
// Get zip file member from the archive
|
|
1847 |
VCXLOGLO1("CIptvTestUtilModule:: Get zip file member from the archive");
|
|
1848 |
CZipFileMember* member = zipFile->CaseInsensitiveMemberL( sourceFileName );
|
|
1849 |
if( member == NULL )
|
|
1850 |
{
|
|
1851 |
VCXLOGLO1("CIptvTestUtilModule:: zip member is null. Leaving..");
|
|
1852 |
delete zipFile;
|
|
1853 |
User::Leave(KErrGeneral);
|
|
1854 |
}
|
|
1855 |
CleanupStack::PushL( member );
|
|
1856 |
|
|
1857 |
// Get read stream for the file
|
|
1858 |
VCXLOGLO1("CIptvTestUtilModule:: Get read stream for the file");
|
|
1859 |
RZipFileMemberReaderStream* stream;
|
|
1860 |
zipFile->GetInputStreamL( member, stream );
|
|
1861 |
CleanupStack::PushL( stream );
|
|
1862 |
|
|
1863 |
// Alloc buffer and read the archived file
|
|
1864 |
VCXLOGLO1("CIptvTestUtilModule:: Alloc buffer and read the archived file");
|
|
1865 |
HBufC8* buffer = HBufC8::NewLC( member->UncompressedSize() );
|
|
1866 |
TPtr8 bufferPtr( buffer->Des() );
|
|
1867 |
User::LeaveIfError( stream->Read( bufferPtr, member->UncompressedSize() ) );
|
|
1868 |
|
|
1869 |
// Write the file to the filesystem
|
|
1870 |
VCXLOGLO1("CIptvTestUtilModule:: Write the file to the filesystem");
|
|
1871 |
RFile file;
|
|
1872 |
User::LeaveIfError( file.Replace( iFs, destFileName, EFileWrite ) );
|
|
1873 |
CleanupClosePushL( file );
|
|
1874 |
User::LeaveIfError( file.Write(*buffer) );
|
|
1875 |
|
|
1876 |
delete zipFile;
|
|
1877 |
CleanupStack::PopAndDestroy( &file );
|
|
1878 |
CleanupStack::PopAndDestroy( buffer );
|
|
1879 |
CleanupStack::PopAndDestroy( stream );
|
|
1880 |
CleanupStack::PopAndDestroy( member );
|
|
1881 |
|
|
1882 |
VCXLOGLO1("<<<CIptvTestUtilModule::ExtractFile");
|
|
1883 |
return 0;
|
|
1884 |
}
|
|
1885 |
|
|
1886 |
|
|
1887 |
// -----------------------------------------------------------------------------
|
|
1888 |
// CIptvTestVerifyData::FileExistsInZip()
|
|
1889 |
// -----------------------------------------------------------------------------
|
|
1890 |
//
|
|
1891 |
TBool CIptvTestUtilModule::FileExistsInZip( CZipFile* aZipFile, const TDesC& aFileName )
|
|
1892 |
{
|
|
1893 |
VCXLOGLO1(">>>CIptvTestVerifyData::FileExistsInZip");
|
|
1894 |
|
|
1895 |
CZipFileMember* member = NULL;
|
|
1896 |
|
|
1897 |
VCXLOGLO1("CIptvTestVerifyData:: list of members");
|
|
1898 |
CZipFileMemberIterator* members = aZipFile->GetMembersL();
|
|
1899 |
|
|
1900 |
VCXLOGLO1("CIptvTestVerifyData:: loop all members");
|
|
1901 |
|
|
1902 |
while ((member = members->NextL()) != 0)
|
|
1903 |
{
|
|
1904 |
VCXLOGLO3("CIptvTestVerifyData:: member %S, size: %d", &(*member->Name()), member->CompressedSize());
|
|
1905 |
|
|
1906 |
if( aFileName == (*member->Name()) )
|
|
1907 |
{
|
|
1908 |
delete member;
|
|
1909 |
delete members;
|
|
1910 |
VCXLOGLO1("<<<CIptvTestVerifyData::FileExistsInZip");
|
|
1911 |
return ETrue;
|
|
1912 |
}
|
|
1913 |
|
|
1914 |
delete member;
|
|
1915 |
}
|
|
1916 |
|
|
1917 |
delete members;
|
|
1918 |
VCXLOGLO1("<<<CIptvTestVerifyData::FileExistsInZip");
|
|
1919 |
return EFalse;
|
|
1920 |
}
|
|
1921 |
|
|
1922 |
|
|
1923 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
1924 |
// None
|
|
1925 |
|
|
1926 |
// End of File
|