|
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 #include <eunitmacros.h> |
|
25 #include "prfwtestprocessmaster.h" |
|
26 #include "userafter.h" |
|
27 #include "prfwtestfiletool.h" |
|
28 |
|
29 //MACROS |
|
30 |
|
31 |
|
32 // CLASS DESCRIPTION |
|
33 |
|
34 /** |
|
35 * PE test robustness handler. |
|
36 */ |
|
37 class PrfwTestRobustness |
|
38 { |
|
39 public: //Robustness handling |
|
40 static inline void DoPreCleaning(); |
|
41 |
|
42 private: //Helpers |
|
43 static inline void HandleKill( TInt aErr, |
|
44 TInt aWaitTime, |
|
45 const TDesC& aDescription ); |
|
46 |
|
47 private: //Prohibited constructor / destructor |
|
48 PrfwTestRobustness() {} |
|
49 ~PrfwTestRobustness() {} |
|
50 }; |
|
51 |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // PrfwTestRobustness public functions |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 inline void PrfwTestRobustness::DoPreCleaning() |
|
59 { |
|
60 TInt err = PrfwTestProcessMaster::KillPscServers(); |
|
61 HandleKill( err, 0, _L("PSC srv processes - Pre") ); |
|
62 |
|
63 err = PrfwTestProcessMaster::KillRootServer(); |
|
64 HandleKill( err, 0, _L("ROOT srv processes - pre") ); |
|
65 |
|
66 TRAPD( ignore, CXIMPTestFileTool::CleanAllL() ); |
|
67 } |
|
68 |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // PrfwTestRobustness functions |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 inline void PrfwTestRobustness::HandleKill( TInt aErr, |
|
75 TInt aWaitTime, |
|
76 const TDesC& aDescription ) |
|
77 { |
|
78 if( aErr > 0 ) |
|
79 { |
|
80 if( aWaitTime > 0 ) |
|
81 { |
|
82 TRAPD( ignore, CUserAfter::AfterL( aWaitTime ) ); |
|
83 } |
|
84 |
|
85 EUNIT_PRINT( _L("ProcessKill: %S, %d instance(s)"), &aDescription, aErr ); |
|
86 } |
|
87 } |
|
88 |
|
89 |
|
90 #endif // PRWFWTESTROBUSTNESSTOOLS_H__ |
|
91 |
|
92 // End of File |
|
93 |