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