45
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 - 2007 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: Test queries_api
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <stiftestinterface.h>
|
|
22 |
#include <settingserverclient.h>
|
|
23 |
#include <e32property.h>
|
|
24 |
|
|
25 |
#include "testsdkqueries.h"
|
|
26 |
#include "testsdkqueriesview.h"
|
|
27 |
#include "testsdkqueriescontainer.h"
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
_LIT( KModuleName, "testsdkqueries.dll" );
|
|
31 |
|
|
32 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
33 |
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
// Ctestsdkqueries::Ctestsdkqueries
|
|
36 |
// C++ default constructor can NOT contain any code, that
|
|
37 |
// might leave.
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CTestSDKQueries::CTestSDKQueries( CTestModuleIf& aTestModuleIf ):
|
|
41 |
CScriptBase( aTestModuleIf )
|
|
42 |
{
|
|
43 |
}
|
|
44 |
|
|
45 |
// -----------------------------------------------------------------------------
|
|
46 |
// Ctestsdkqueries::ConstructL
|
|
47 |
// Symbian 2nd phase constructor can leave.
|
|
48 |
// -----------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
void CTestSDKQueries::ConstructL()
|
|
51 |
{
|
|
52 |
|
|
53 |
iView = CTestSDKQueriesView::NewL();
|
|
54 |
iContainer = CTestSDKQueriesContainer::NewL( iView->ClientRect(), iContainer );
|
|
55 |
|
|
56 |
|
|
57 |
//Read logger settings to check whether test case name is to be
|
|
58 |
//appended to log file name.
|
|
59 |
RSettingServer settingServer;
|
|
60 |
CleanupClosePushL( settingServer );
|
|
61 |
TInt ret = settingServer.Connect();
|
|
62 |
if ( ret != KErrNone )
|
|
63 |
{
|
|
64 |
User::Leave(ret);
|
|
65 |
}
|
|
66 |
// Struct to StifLogger settigs.
|
|
67 |
TLoggerSettings loggerSettings;
|
|
68 |
// Parse StifLogger defaults from STIF initialization file.
|
|
69 |
ret = settingServer.GetLoggerSettings( loggerSettings );
|
|
70 |
if ( ret != KErrNone )
|
|
71 |
{
|
|
72 |
User::Leave( ret );
|
|
73 |
}
|
|
74 |
// Close Setting server session
|
|
75 |
settingServer.Close();
|
|
76 |
CleanupStack::PopAndDestroy( &settingServer );
|
|
77 |
|
|
78 |
TFileName logFileName;
|
|
79 |
|
|
80 |
if ( loggerSettings.iAddTestCaseTitle )
|
|
81 |
{
|
|
82 |
TName title;
|
|
83 |
TestModuleIf().GetTestCaseTitleL( title );
|
|
84 |
logFileName.Format( KtestsdkqueriesLogFileWithTitle, &title );
|
|
85 |
}
|
|
86 |
else
|
|
87 |
{
|
|
88 |
logFileName.Copy( KtestsdkqueriesLogFile );
|
|
89 |
}
|
|
90 |
|
|
91 |
iLog = CStifLogger::NewL( KtestsdkqueriesLogPath,
|
|
92 |
logFileName,
|
|
93 |
CStifLogger::ETxt,
|
|
94 |
CStifLogger::EFile,
|
|
95 |
EFalse );
|
|
96 |
|
|
97 |
iOffset = CCoeEnv::Static()->AddResourceFileL(_L("C:\\resource\\testsdkqueries.rsc"));
|
|
98 |
|
|
99 |
SendTestClassVersion();
|
|
100 |
}
|
|
101 |
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
// Ctestsdkqueries::NewL
|
|
104 |
// Two-phased constructor.
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
CTestSDKQueries* CTestSDKQueries::NewL( CTestModuleIf& aTestModuleIf )
|
|
108 |
{
|
|
109 |
CTestSDKQueries* self = new( ELeave ) CTestSDKQueries( aTestModuleIf );
|
|
110 |
|
|
111 |
CleanupStack::PushL( self );
|
|
112 |
self->ConstructL();
|
|
113 |
CleanupStack::Pop( self );
|
|
114 |
|
|
115 |
return self;
|
|
116 |
|
|
117 |
}
|
|
118 |
|
|
119 |
// Destructor
|
|
120 |
CTestSDKQueries::~CTestSDKQueries()
|
|
121 |
{
|
|
122 |
|
|
123 |
// Delete resources allocated from test methods
|
|
124 |
Delete();
|
|
125 |
|
|
126 |
// Delete logger
|
|
127 |
delete iLog;
|
|
128 |
|
|
129 |
CCoeEnv::Static()->DeleteResourceFile( iOffset );
|
|
130 |
}
|
|
131 |
|
|
132 |
//-----------------------------------------------------------------------------
|
|
133 |
// Ctestsdkqueries::SendTestClassVersion
|
|
134 |
// Method used to send version of test class
|
|
135 |
//-----------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
void CTestSDKQueries::SendTestClassVersion()
|
|
138 |
{
|
|
139 |
TVersion moduleVersion;
|
|
140 |
moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
|
|
141 |
moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
|
|
142 |
moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
|
|
143 |
|
|
144 |
TFileName moduleName;
|
|
145 |
moduleName = KModuleName;
|
|
146 |
|
|
147 |
TBool newVersionOfMethod = ETrue;
|
|
148 |
TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName,
|
|
149 |
newVersionOfMethod );
|
|
150 |
}
|
|
151 |
|
|
152 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
153 |
|
|
154 |
// -----------------------------------------------------------------------------
|
|
155 |
// LibEntryL is a polymorphic Dll entry point.
|
|
156 |
// Returns: CScriptBase: New CScriptBase derived object
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
EXPORT_C CScriptBase* LibEntryL(
|
|
160 |
CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
|
|
161 |
{
|
|
162 |
return ( CScriptBase* ) CTestSDKQueries::NewL( aTestModuleIf );
|
|
163 |
}
|
|
164 |
// End of File
|
|
165 |
|
|
166 |
|
|
167 |
|