|
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 "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: NAT FW SDP Provider test console tests result collector |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <badesca.h> |
|
19 #include <e32std.h> |
|
20 #include <e32cons.h> |
|
21 #include <s32mem.h> |
|
22 #include "nspresultcollector.h" |
|
23 |
|
24 const TUint KDefaultGranularity = 6; |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CResultCollector::NewL |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CResultCollector* CResultCollector::NewL( CConsoleBase& aConsole ) |
|
30 { |
|
31 CResultCollector* self = CResultCollector::NewLC( aConsole ); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CResultCollector::NewLC |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CResultCollector* CResultCollector::NewLC( CConsoleBase& aConsole ) |
|
41 { |
|
42 CResultCollector* self = new ( ELeave ) CResultCollector( aConsole ); |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CResultCollector::CResultCollector |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CResultCollector::CResultCollector( CConsoleBase& aConsole ) |
|
53 : iConsole( aConsole ) |
|
54 { |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CResultCollector::ConstructL |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 void CResultCollector::ConstructL() |
|
62 { |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CResultCollector::~CResultCollector |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CResultCollector::~CResultCollector() |
|
70 { |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CResultCollector::VisitL |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CResultCollector::VisitL( MNSPTest& /*aTest*/ ) |
|
78 { |
|
79 User::Leave( KErrTotalLossOfPrecision ); |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CResultCollector::VisitL |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CResultCollector::VisitL( CNSPTest& aTest ) |
|
87 { |
|
88 CBufFlat* buffer = CBufFlat::NewL( 300 ); |
|
89 CleanupStack::PushL( buffer ); |
|
90 RBufWriteStream stream; |
|
91 stream.Open( *buffer ); |
|
92 CleanupClosePushL( stream ); |
|
93 aTest.ExternalizeL( stream ); |
|
94 |
|
95 TPckgBuf<TResult> pkgIn; |
|
96 pkgIn.Copy( buffer->Ptr(0) ); |
|
97 PrintResult( pkgIn() ); |
|
98 |
|
99 CleanupStack::PopAndDestroy(); |
|
100 CleanupStack::PopAndDestroy( buffer ); |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CResultCollector::VisitL |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 void CResultCollector::VisitL( CNSPReleaseTest& /*aTest*/ ) |
|
108 { |
|
109 |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CResultCollector::PrintResult |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 void CResultCollector::PrintResult( TResult& aResult ) |
|
117 { |
|
118 iConsole.Write( aResult.iDescription ); |
|
119 |
|
120 switch ( aResult.iState ) |
|
121 { |
|
122 case TResult::ECreated: |
|
123 { |
|
124 iConsole.Printf( _L( " Created\n") ); |
|
125 break; |
|
126 } |
|
127 |
|
128 case TResult::ERunning: |
|
129 { |
|
130 iConsole.Printf( _L( " Running\n") ); |
|
131 break; |
|
132 } |
|
133 |
|
134 case TResult::EPass: |
|
135 { |
|
136 iConsole.Printf( _L( " PASS\n") ); |
|
137 break; |
|
138 } |
|
139 |
|
140 case TResult::EFail: |
|
141 { |
|
142 iConsole.Printf( _L( " FAIL\n") ); |
|
143 break; |
|
144 } |
|
145 |
|
146 default: |
|
147 { |
|
148 iConsole.Printf( _L( " %d\n" ), aResult.iState ) ; |
|
149 } |
|
150 } |
|
151 } |