|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <symbianunittestsuite.h> |
|
19 #include "symbianunittestresult.h" |
|
20 #include "sutlogger.h" |
|
21 |
|
22 // ----------------------------------------------------------------------------- |
|
23 // |
|
24 // ----------------------------------------------------------------------------- |
|
25 // |
|
26 EXPORT_C CSymbianUnitTestSuite* CSymbianUnitTestSuite::NewLC( |
|
27 const TDesC& aName ) |
|
28 { |
|
29 CSymbianUnitTestSuite* self = new( ELeave )CSymbianUnitTestSuite(); |
|
30 CleanupStack::PushL( self ); |
|
31 self->ConstructL( aName ); |
|
32 return self; |
|
33 } |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 EXPORT_C CSymbianUnitTestSuite* CSymbianUnitTestSuite::NewL( |
|
40 const TDesC& aName ) |
|
41 { |
|
42 CSymbianUnitTestSuite* self = CSymbianUnitTestSuite::NewLC( aName ); |
|
43 CleanupStack::Pop( self ); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 void CSymbianUnitTestSuite::ConstructL( const TDesC& aName ) |
|
52 { |
|
53 iName = aName.AllocL(); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CSymbianUnitTestSuite::CSymbianUnitTestSuite() |
|
61 { |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C CSymbianUnitTestSuite::~CSymbianUnitTestSuite() |
|
69 { |
|
70 iTests.ResetAndDestroy(); |
|
71 delete iName; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C void CSymbianUnitTestSuite::AddL( |
|
79 MSymbianUnitTestInterface* aTest ) |
|
80 { |
|
81 iTests.AppendL( aTest ); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C void CSymbianUnitTestSuite::ExecuteL( |
|
89 MSymbianUnitTestObserver& aObserver, |
|
90 CSymbianUnitTestResult& aResult, |
|
91 MSymbianUnitTestInterface::TFailureSimulation aFailureSimulation, |
|
92 const CDesCArray& aTestCaseNames, |
|
93 TInt aTimeout ) |
|
94 { |
|
95 for ( TInt i=0; i < iTests.Count(); i++ ) |
|
96 { |
|
97 iTests[i]->ExecuteL( aObserver, aResult, aFailureSimulation, aTestCaseNames, aTimeout); |
|
98 } |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C TInt CSymbianUnitTestSuite::TestCaseCount() |
|
106 { |
|
107 TInt count = 0; |
|
108 for ( TInt i=0; i < iTests.Count(); i++ ) |
|
109 { |
|
110 count += iTests[i]->TestCaseCount(); |
|
111 } |
|
112 return count; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C const TDesC& CSymbianUnitTestSuite::Name() const |
|
120 { |
|
121 return *iName; |
|
122 } |