|
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: Implementation of CTFAStifEntryPoint class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <stiftestinterface.h> |
|
21 #include "dsytesttooltrace.h" |
|
22 #include "tfastifentrypoint.h" |
|
23 #include "tfastiftestsuiteadapter.h" |
|
24 #include "tfastiftestsuiteadapterroot.h" |
|
25 #include "tfastiftestcaseadapter.h" |
|
26 #include "tfastiftestenvironment.h" |
|
27 #include "tfastiftestlog.h" |
|
28 |
|
29 |
|
30 // ================= TRACE FUNCTIONS ============== |
|
31 #ifdef _DEBUG |
|
32 |
|
33 const TInt KTFAssertDateSize = 32; |
|
34 |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // TraceAssertFunc |
|
38 // ----------------------------------------------------------------------------- |
|
39 void TraceAssertFunc( const TDesC8& aFile, TInt aLine ) |
|
40 { |
|
41 HBufC* buffer = HBufC::New( aFile.Length() + 1 ); |
|
42 HBufC* date = HBufC::New( KTFAssertDateSize ); |
|
43 HBufC* time = HBufC::New( KTFAssertDateSize ); |
|
44 if ( buffer != NULL && date != NULL && time != NULL ) |
|
45 { |
|
46 buffer->Des().Copy( aFile ); |
|
47 date->Des().Copy( _L8( __DATE__ ) ); |
|
48 time->Des().Copy( _L8( __TIME__ ) ); |
|
49 RDebug::Print( _L( "Assertion failed: file=%s, line=%d, compiled=%s %s" ), buffer->Des().PtrZ(), aLine, date->Des().PtrZ(), time->Des().PtrZ() ); |
|
50 } |
|
51 else |
|
52 { |
|
53 RDebug::Print( _L( "Assertion and memory allocation failed" ) ); |
|
54 } |
|
55 delete buffer; |
|
56 delete date; |
|
57 delete time; |
|
58 } |
|
59 #endif |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // LibEntryL |
|
63 // ----------------------------------------------------------------------------- |
|
64 EXPORT_C CTestModuleBase* LibEntryL( void ) |
|
65 { |
|
66 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::LibEntryL()" ) ) ); |
|
67 CTFAStifEntryPoint* entry = CTFAStifEntryPoint::NewL(); |
|
68 // Stif framework deletes the CTestModuleBase-derived object |
|
69 // which deletes the entry point object. |
|
70 CTestModuleBase* retval = STATIC_CAST( CTFAStifTestSuiteAdapterRoot*, entry->RootSuiteAdapter() ); |
|
71 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::LibEntryL - return 0x%x" ), retval ) ); |
|
72 return retval; |
|
73 } |
|
74 |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CTFAStifEntryPoint::NewL |
|
78 // ----------------------------------------------------------------------------- |
|
79 CTFAStifEntryPoint* CTFAStifEntryPoint::NewL( void ) |
|
80 { |
|
81 CTFAStifEntryPoint* entry = new ( ELeave ) CTFAStifEntryPoint(); |
|
82 CleanupStack::PushL( entry ); |
|
83 entry->ConstructL(); |
|
84 CleanupStack::Pop( entry ); |
|
85 return entry; |
|
86 } |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CTFAStifEntryPoint::CTFAStifEntryPoint |
|
91 // ----------------------------------------------------------------------------- |
|
92 CTFAStifEntryPoint::CTFAStifEntryPoint( void ) |
|
93 { |
|
94 } |
|
95 |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CTFAStifEntryPoint::~CTFAStifEntryPoint |
|
99 // ----------------------------------------------------------------------------- |
|
100 CTFAStifEntryPoint::~CTFAStifEntryPoint( void ) |
|
101 { |
|
102 } |
|
103 |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CTFAStifEntryPoint::ConstructL |
|
107 // ----------------------------------------------------------------------------- |
|
108 void CTFAStifEntryPoint::ConstructL( void ) |
|
109 { |
|
110 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::ConstructL()" ) ) ); |
|
111 CTFAEntryPoint::ConstructL(); |
|
112 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::ConstructL - return void" ) ) ); |
|
113 } |
|
114 |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CTFAStifEntryPoint::CreateSuiteAdapterLC |
|
118 // ----------------------------------------------------------------------------- |
|
119 MTFATestSuiteAdapter* CTFAStifEntryPoint::CreateSuiteAdapterLC( CTFATestSuite& aSuite, TBool aRoot ) |
|
120 { |
|
121 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateSuiteAdapterLC(0x%x, %d )" ), &aSuite, aRoot ) ); |
|
122 MTFATestSuiteAdapter* adapter; |
|
123 if ( aRoot ) |
|
124 { |
|
125 adapter = CTFAStifTestSuiteAdapterRoot::NewLC( aSuite, this ); |
|
126 } |
|
127 else |
|
128 { |
|
129 adapter = CTFAStifTestSuiteAdapter::NewLC( aSuite, NULL ); |
|
130 } |
|
131 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateSuiteAdapterLC - return 0x%x" ), adapter ) ); |
|
132 return adapter; |
|
133 } |
|
134 |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CTFAStifEntryPoint::CreateTestAdapterLC |
|
138 // ----------------------------------------------------------------------------- |
|
139 MTFATestCaseAdapter* CTFAStifEntryPoint::CreateTestAdapterLC( CTFATestCase& aCase ) |
|
140 { |
|
141 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateTestAdapterLC(0x%x)" ), &aCase ) ); |
|
142 CTFAStifTestCaseAdapter* adapter = CTFAStifTestCaseAdapter::NewLC( aCase, |
|
143 STATIC_CAST( CTFAStifTestSuiteAdapterRoot*, RootSuiteAdapter() ) ); |
|
144 STATIC_CAST( CTFAStifTestSuiteAdapterRoot*, RootSuiteAdapter() )->AddTestL( *adapter ); |
|
145 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateTestAdapterLC - return 0x%x" ), adapter ) ); |
|
146 return adapter; |
|
147 } |
|
148 |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CTFAStifEntryPoint::CreateEnvironmentL |
|
152 // ----------------------------------------------------------------------------- |
|
153 CTFATestEnvironment* CTFAStifEntryPoint::CreateEnvironmentL( void ) |
|
154 { |
|
155 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateEnvironmentL()" ) ) ); |
|
156 CTFAStifTestLog* log = CTFAStifTestLog::NewLC(); |
|
157 CTFAStifTestEnvironment* env = new ( ELeave ) CTFAStifTestEnvironment( *log ); |
|
158 CleanupStack::Pop( log ); |
|
159 COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateEnvironmentL - return 0x%x" ), env ) ); |
|
160 return env; |
|
161 } |
|
162 |