|
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: tactile_feedback_client_api |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <stiftestinterface.h> |
|
22 #include <settingserverclient.h> |
|
23 #include <screensaverinternalpskeys.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 #include "testsdktfc.h" |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CTestSDKTFC::CTestSDKTFC |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CTestSDKTFC::CTestSDKTFC( CTestModuleIf& aTestModuleIf ): |
|
37 CScriptBase( aTestModuleIf ) |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CTestSDKTFC::ConstructL |
|
43 // Symbian 2nd phase constructor can leave. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void CTestSDKTFC::ConstructL() |
|
47 { |
|
48 //Read logger settings to check whether test case name is to be |
|
49 //appended to log file name. |
|
50 RSettingServer settingServer; |
|
51 TInt ret = settingServer.Connect(); |
|
52 if(ret != KErrNone) |
|
53 { |
|
54 User::Leave(ret); |
|
55 } |
|
56 // Struct to StifLogger settigs. |
|
57 TLoggerSettings loggerSettings; |
|
58 // Parse StifLogger defaults from STIF initialization file. |
|
59 ret = settingServer.GetLoggerSettings(loggerSettings); |
|
60 if(ret != KErrNone) |
|
61 { |
|
62 User::Leave(ret); |
|
63 } |
|
64 // Close Setting server session |
|
65 settingServer.Close(); |
|
66 |
|
67 TFileName logFileName; |
|
68 |
|
69 if(loggerSettings.iAddTestCaseTitle) |
|
70 { |
|
71 TName title; |
|
72 TestModuleIf().GetTestCaseTitleL(title); |
|
73 logFileName.Format(KtestsdktfcLogFileWithTitle, &title); |
|
74 } |
|
75 else |
|
76 { |
|
77 logFileName.Copy(KtestsdktfcLogFile); |
|
78 } |
|
79 |
|
80 iLog = CStifLogger::NewL( KtestsdktfcLogPath, |
|
81 logFileName, |
|
82 CStifLogger::ETxt, |
|
83 CStifLogger::EFile, |
|
84 EFalse ); |
|
85 |
|
86 SendTestClassVersion(); |
|
87 |
|
88 TurnOffScreenSaver(); |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CTestSDKTFC::NewL |
|
93 // Two-phased constructor. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CTestSDKTFC* CTestSDKTFC::NewL( CTestModuleIf& aTestModuleIf ) |
|
97 { |
|
98 CTestSDKTFC* self = new( ELeave ) CTestSDKTFC( aTestModuleIf ); |
|
99 |
|
100 CleanupStack::PushL( self ); |
|
101 self->ConstructL(); |
|
102 CleanupStack::Pop(); |
|
103 |
|
104 return self; |
|
105 |
|
106 } |
|
107 |
|
108 // Destructor |
|
109 CTestSDKTFC::~CTestSDKTFC() |
|
110 { |
|
111 |
|
112 // Delete resources allocated from test methods |
|
113 Delete(); |
|
114 |
|
115 // Delete logger |
|
116 delete iLog; |
|
117 |
|
118 } |
|
119 |
|
120 //----------------------------------------------------------------------------- |
|
121 // CTestSDKTFC::SendTestClassVersion |
|
122 // Method used to send version of test class |
|
123 //----------------------------------------------------------------------------- |
|
124 // |
|
125 void CTestSDKTFC::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( "testsdktfc.dll" ); |
|
134 |
|
135 TBool newVersionOfMethod = ETrue; |
|
136 TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName, |
|
137 newVersionOfMethod ); |
|
138 } |
|
139 |
|
140 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // LibEntryL is a polymorphic Dll entry point. |
|
144 // Returns: CScriptBase: New CScriptBase derived object |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 EXPORT_C CScriptBase* LibEntryL( |
|
148 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
149 { |
|
150 return ( CScriptBase* ) CTestSDKTFC::NewL( aTestModuleIf ); |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // Turn off ScreenSaver |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 void CTestSDKTFC::TurnOffScreenSaver() |
|
158 { |
|
159 //TInt Get(TUid aCategory, TUint aKey, TInt &aValue); |
|
160 TInt err1 = RProperty::Get( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, |
|
161 iOldScreenSaverProperty ); |
|
162 TInt err2 = RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, |
|
163 KScreenSaverAllowScreenSaver ); |
|
164 RDebug::Printf( "screensaver property=%d err1=%d err2=%d\n", |
|
165 iOldScreenSaverProperty, err1, err2 ); |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // Restore ScreenSaver |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 void CTestSDKTFC::RestoreScreenSaver() |
|
173 { |
|
174 RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, |
|
175 iOldScreenSaverProperty ); |
|
176 User::ResetInactivityTime(); |
|
177 } |
|
178 |
|
179 |
|
180 // End of File |