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