722
|
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
|
872
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
722
|
6 |
* which accompanies this distribution, and is available
|
872
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
722
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: This file contains testclass implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// [INCLUDE FILES] - do not remove
|
|
19 |
#include <e32svr.h>
|
|
20 |
#include <StifParser.h>
|
|
21 |
#include <Stiftestinterface.h>
|
|
22 |
#include <MProEngEngine.h>
|
|
23 |
#include <MProEngProfile.h>
|
739
|
24 |
#include <MProEngProfileName.h>
|
|
25 |
#include <MProEngToneSettings.h>
|
722
|
26 |
#include <ProEngFactory.h>
|
|
27 |
#include <Profile.hrh>
|
|
28 |
#include "ProfileSmokeTestModule.h"
|
|
29 |
|
|
30 |
// EXTERNAL DATA STRUCTURES
|
|
31 |
//extern ?external_data;
|
|
32 |
|
|
33 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
34 |
//extern ?external_function( ?arg_type,?arg_type );
|
|
35 |
|
|
36 |
// CONSTANTS
|
|
37 |
//const ?type ?constant_var = ?constant;
|
|
38 |
_LIT( KProfileSmokeTestModule, "ProfileSmokeTestModule" );
|
|
39 |
_LIT( KProfile, "Profile: %S" );
|
739
|
40 |
_LIT( KRingingVolume, "Ringing Volume: %d");
|
722
|
41 |
|
739
|
42 |
_LIT(KGeneral, "General");
|
|
43 |
_LIT(KSilent, "Silent");
|
|
44 |
_LIT(KMeeting, "Meeting");
|
|
45 |
_LIT(KOutdoor, "Outdoor");
|
722
|
46 |
|
|
47 |
// MACROS
|
|
48 |
//#define ?macro ?macro_def
|
|
49 |
|
|
50 |
// LOCAL CONSTANTS AND MACROS
|
|
51 |
//const ?type ?constant_var = ?constant;
|
|
52 |
//#define ?macro_name ?macro_def
|
|
53 |
|
|
54 |
// MODULE DATA STRUCTURES
|
|
55 |
//enum ?declaration
|
|
56 |
//typedef ?declaration
|
|
57 |
|
|
58 |
// LOCAL FUNCTION PROTOTYPES
|
|
59 |
//?type ?function_name( ?arg_type, ?arg_type );
|
|
60 |
|
|
61 |
// FORWARD DECLARATIONS
|
|
62 |
//class ?FORWARD_CLASSNAME;
|
|
63 |
|
|
64 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
65 |
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
// ?function_name ?description.
|
|
68 |
// ?description
|
|
69 |
// Returns: ?value_1: ?description
|
|
70 |
// ?value_n: ?description_line1
|
|
71 |
// ?description_line2
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
/*
|
|
75 |
?type ?function_name(
|
|
76 |
?arg_type arg, // ?description
|
|
77 |
?arg_type arg) // ?description
|
|
78 |
{
|
|
79 |
|
|
80 |
?code // ?comment
|
|
81 |
|
|
82 |
// ?comment
|
|
83 |
?code
|
|
84 |
}
|
|
85 |
*/
|
|
86 |
|
|
87 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
88 |
|
|
89 |
// -----------------------------------------------------------------------------
|
|
90 |
// CProfileSmokeTestModule::Delete
|
|
91 |
// Delete here all resources allocated and opened from test methods.
|
|
92 |
// Called from destructor.
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
void CProfileSmokeTestModule::Delete()
|
|
96 |
{
|
|
97 |
}
|
|
98 |
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
// CProfileSmokeTestModule::RunMethodL
|
|
101 |
// Run specified method. Contains also table of test mothods and their names.
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
TInt CProfileSmokeTestModule::RunMethodL(
|
|
105 |
CStifItemParser& aItem )
|
|
106 |
{
|
|
107 |
|
|
108 |
static TStifFunctionInfo const KFunctions[] =
|
|
109 |
{
|
|
110 |
// Copy this line for every implemented function.
|
|
111 |
// First string is the function name used in TestScripter script file.
|
|
112 |
// Second is the actual implementation member function.
|
739
|
113 |
ENTRY( "CheckActiveProfile", CProfileSmokeTestModule::CheckActiveProfileL),
|
|
114 |
ENTRY( "SetActiveProfile", CProfileSmokeTestModule::SetActiveProfileL ),
|
722
|
115 |
//ADD NEW ENTRY HERE
|
|
116 |
// [test cases entries] - Do not remove
|
|
117 |
};
|
|
118 |
|
|
119 |
const TInt count = sizeof( KFunctions ) /
|
|
120 |
sizeof( TStifFunctionInfo );
|
|
121 |
|
|
122 |
return RunInternalL( KFunctions, count, aItem );
|
|
123 |
|
|
124 |
}
|
|
125 |
|
|
126 |
// -----------------------------------------------------------------------------
|
739
|
127 |
// CProfileSmokeTestModule::CheckActiveProfileL
|
|
128 |
// Changes the current active profile according to the parameter
|
|
129 |
// -----------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
TInt CProfileSmokeTestModule::CheckActiveProfileL( CStifItemParser& aItem )
|
|
132 |
{
|
|
133 |
// Print to UI
|
|
134 |
_LIT( KSetProfile, "In CheckActiveProfile" );
|
|
135 |
TestModuleIf().Printf( 0, KProfileSmokeTestModule, KSetProfile );
|
|
136 |
// Print to log file
|
|
137 |
iLog->Log( KSetProfile );
|
|
138 |
|
|
139 |
MProEngEngine* engine = ProEngFactory::NewEngineLC( iFs );
|
|
140 |
MProEngProfile* active = engine->ActiveProfileLC();
|
|
141 |
|
|
142 |
TPtrC expectedName;
|
|
143 |
if ( aItem.GetNextString( expectedName ) == KErrNone )
|
|
144 |
{
|
|
145 |
TL( active->ProfileName().Name() == expectedName)
|
|
146 |
}
|
|
147 |
|
|
148 |
TInt expectedRingVol;
|
|
149 |
if ( aItem.GetNextInt( expectedRingVol ) == KErrNone )
|
|
150 |
{
|
|
151 |
TL(active->ToneSettings().RingingVolume() == expectedRingVol);
|
|
152 |
}
|
|
153 |
|
|
154 |
TInt expectedRingType;
|
|
155 |
if ( aItem.GetNextInt( expectedRingType ) == KErrNone )
|
|
156 |
{
|
|
157 |
TL(active->ToneSettings().RingingType() == expectedRingType);
|
|
158 |
}
|
|
159 |
|
|
160 |
TPtrC vibrate;
|
|
161 |
if ( aItem.GetNextString(vibrate) == KErrNone )
|
|
162 |
{
|
|
163 |
TBool expectedVibrate;
|
|
164 |
if ( vibrate == _L("true"))
|
|
165 |
{
|
|
166 |
expectedVibrate = ETrue;
|
|
167 |
}
|
|
168 |
else if ( vibrate == _L("false"))
|
|
169 |
{
|
|
170 |
expectedVibrate = EFalse;
|
|
171 |
}
|
|
172 |
else
|
|
173 |
{
|
|
174 |
User::Leave(KErrArgument);
|
|
175 |
}
|
|
176 |
|
|
177 |
TL(expectedVibrate == active->ToneSettings().VibratingAlert());
|
|
178 |
}
|
|
179 |
|
|
180 |
CleanupStack::PopAndDestroy(2);
|
|
181 |
|
|
182 |
return KErrNone;
|
|
183 |
}
|
|
184 |
|
|
185 |
// -----------------------------------------------------------------------------
|
722
|
186 |
// CProfileSmokeTestModule::SetProfileL
|
|
187 |
// Changes the current active profile according to the parameter
|
|
188 |
// -----------------------------------------------------------------------------
|
|
189 |
//
|
739
|
190 |
TInt CProfileSmokeTestModule::SetActiveProfileL( CStifItemParser& aItem )
|
722
|
191 |
{
|
|
192 |
// Print to UI
|
739
|
193 |
_LIT( KSetProfile, "In SetActiveProfile" );
|
722
|
194 |
TestModuleIf().Printf( 0, KProfileSmokeTestModule, KSetProfile );
|
|
195 |
// Print to log file
|
|
196 |
iLog->Log( KSetProfile );
|
|
197 |
|
|
198 |
TPtrC profile;
|
|
199 |
if ( aItem.GetNextString( profile ) == KErrNone )
|
|
200 |
{
|
|
201 |
MProEngEngine* engine = ProEngFactory::NewEngineLC( iFs );
|
|
202 |
|
|
203 |
// create the profile engine and set to the correct profile
|
|
204 |
if ( profile == KSilent)
|
|
205 |
{
|
|
206 |
//set to silent
|
|
207 |
engine->SetActiveProfileL( EProfileSilentId );
|
|
208 |
}
|
|
209 |
else if ( profile == KMeeting )
|
|
210 |
{
|
|
211 |
// set to meeting
|
|
212 |
engine->SetActiveProfileL( EProfileMeetingId );
|
|
213 |
}
|
|
214 |
else if ( profile == KGeneral )
|
|
215 |
{
|
|
216 |
// set to general
|
|
217 |
engine->SetActiveProfileL( EProfileGeneralId );
|
|
218 |
}
|
739
|
219 |
else if (profile == KOutdoor)
|
|
220 |
{
|
|
221 |
// set to outdoors
|
|
222 |
engine->SetActiveProfileL( EProfileOutdoorId );
|
|
223 |
}
|
722
|
224 |
|
|
225 |
CleanupStack::PopAndDestroy();
|
|
226 |
}
|
|
227 |
|
|
228 |
return KErrNone;
|
|
229 |
}
|
|
230 |
|
739
|
231 |
|
722
|
232 |
// -----------------------------------------------------------------------------
|
|
233 |
// CProfileSmokeTestModule::?member_function
|
|
234 |
// ?implementation_description
|
|
235 |
// (other items were commented in a header).
|
|
236 |
// -----------------------------------------------------------------------------
|
|
237 |
//
|
|
238 |
/*
|
|
239 |
TInt CProfileSmokeTestModule::?member_function(
|
|
240 |
CItemParser& aItem )
|
|
241 |
{
|
|
242 |
|
|
243 |
?code
|
|
244 |
|
|
245 |
}
|
|
246 |
*/
|
|
247 |
|
|
248 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
249 |
// None
|
|
250 |
|
|
251 |
// [End of File] - Do not remove
|