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