|
51
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* This component and the accompanying materials are made available
|
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
|
6 |
* which accompanies this distribution, and is available
|
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
|
8 |
*
|
|
|
9 |
* Initial Contributors:
|
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
|
11 |
*
|
|
|
12 |
* Contributors:
|
|
|
13 |
*
|
|
|
14 |
* Description: Tools to increase Presence Engine tests robustness.
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
#ifndef PENGTSTROBUSTNESSTOOLS_H__
|
|
|
19 |
#define PENGTSTROBUSTNESSTOOLS_H__
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
// INCLUDES
|
|
|
23 |
#include <e32std.h>
|
|
|
24 |
|
|
|
25 |
#include <platform/digia/eunit/eunitmacros.h>
|
|
|
26 |
#include <platform/digia/eunit/teunitassertioninfo.h>
|
|
|
27 |
#include "prfwtestprocessmaster.h"
|
|
|
28 |
#include "userafter.h"
|
|
|
29 |
#include "prfwtestfiletool.h"
|
|
|
30 |
|
|
|
31 |
//MACROS
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
// CLASS DESCRIPTION
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* PE test robustness handler.
|
|
|
38 |
*/
|
|
|
39 |
class PrfwTestRobustness
|
|
|
40 |
{
|
|
|
41 |
public: //Robustness handling
|
|
|
42 |
static inline void DoPreCleaning();
|
|
|
43 |
|
|
|
44 |
private: //Helpers
|
|
|
45 |
static inline void HandleKill( TInt aErr,
|
|
|
46 |
TInt aWaitTime,
|
|
|
47 |
const TDesC& aDescription );
|
|
|
48 |
|
|
|
49 |
private: //Prohibited constructor / destructor
|
|
|
50 |
PrfwTestRobustness() {}
|
|
|
51 |
~PrfwTestRobustness() {}
|
|
|
52 |
};
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
// -----------------------------------------------------------------------------
|
|
|
57 |
// PrfwTestRobustness public functions
|
|
|
58 |
// -----------------------------------------------------------------------------
|
|
|
59 |
//
|
|
|
60 |
inline void PrfwTestRobustness::DoPreCleaning()
|
|
|
61 |
{
|
|
|
62 |
TInt err = PrfwTestProcessMaster::KillPscServers();
|
|
|
63 |
HandleKill( err, 0, _L("PSC srv processes - Pre") );
|
|
|
64 |
|
|
|
65 |
err = PrfwTestProcessMaster::KillRootServer();
|
|
|
66 |
HandleKill( err, 0, _L("ROOT srv processes - pre") );
|
|
|
67 |
|
|
|
68 |
TRAPD( ignore, CXIMPTestFileTool::CleanAllL() );
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
// -----------------------------------------------------------------------------
|
|
|
73 |
// PrfwTestRobustness functions
|
|
|
74 |
// -----------------------------------------------------------------------------
|
|
|
75 |
//
|
|
|
76 |
inline void PrfwTestRobustness::HandleKill( TInt aErr,
|
|
|
77 |
TInt aWaitTime,
|
|
|
78 |
const TDesC& aDescription )
|
|
|
79 |
{
|
|
|
80 |
if( aErr > 0 )
|
|
|
81 |
{
|
|
|
82 |
if( aWaitTime > 0 )
|
|
|
83 |
{
|
|
|
84 |
TRAPD( ignore, CUserAfter::AfterL( aWaitTime ) );
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
EUNIT_PRINT( _L("ProcessKill: %S, %d instance(s)"), &aDescription, aErr );
|
|
|
88 |
}
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
#endif // PRWFWTESTROBUSTNESSTOOLS_H__
|
|
|
93 |
|
|
|
94 |
// End of File
|
|
|
95 |
|