|
1 /* |
|
2 * Copyright (c) 2008 - 2009 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 the License "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: For Stiff framework related functions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <StifTestInterface.h> |
|
24 #include "telepathygabbletest.h" |
|
25 #include <SettingServerClient.h> |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 // ============================= LOCAL FUNCTIONS =============================== |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CTelepathyGabbleTest::CTelepathyGabbleTest |
|
37 // C++ default constructor can NOT contain any code, that |
|
38 // might leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CTelepathyGabbleTest::CTelepathyGabbleTest( |
|
42 CTestModuleIf& aTestModuleIf ): |
|
43 CScriptBase( aTestModuleIf ) |
|
44 { |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CTelepathyGabbleTest::ConstructL |
|
49 // Symbian 2nd phase constructor can leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CTelepathyGabbleTest::ConstructL() |
|
53 { |
|
54 //Read logger settings to check whether test case name is to be |
|
55 //appended to log file name. |
|
56 RSettingServer 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 TFileName logFileName; |
|
73 |
|
74 if(loggerSettings.iAddTestCaseTitle) |
|
75 { |
|
76 TName title; |
|
77 TestModuleIf().GetTestCaseTitleL(title); |
|
78 logFileName.Format(KTelepathyGabbleTestLogFileWithTitle, &title); |
|
79 } |
|
80 else |
|
81 { |
|
82 logFileName.Copy(KTelepathyGabbleTestLogFile); |
|
83 } |
|
84 iLog = CStifLogger::NewL( KTelepathyGabbleTestLogPath, |
|
85 logFileName, |
|
86 CStifLogger::ETxt, |
|
87 CStifLogger::EFile, |
|
88 EFalse ); |
|
89 iLog->Log( _L("CTelepathyGabbleTest::Constructl after CStifLogger::NewL") ); |
|
90 TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksMem ); |
|
91 |
|
92 TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); |
|
93 TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); |
|
94 iLog->Log( _L("CTelepathyGabbleTest::Constructl out") ); |
|
95 |
|
96 |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CTelepathyGabbleTest::NewL |
|
101 // Two-phased constructor. |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 CTelepathyGabbleTest* CTelepathyGabbleTest::NewL( |
|
105 CTestModuleIf& aTestModuleIf ) |
|
106 { |
|
107 CTelepathyGabbleTest* self = new (ELeave) CTelepathyGabbleTest( aTestModuleIf ); |
|
108 |
|
109 CleanupStack::PushL( self ); |
|
110 self->ConstructL(); |
|
111 CleanupStack::Pop(); |
|
112 |
|
113 return self; |
|
114 |
|
115 } |
|
116 |
|
117 // Destructor |
|
118 CTelepathyGabbleTest::~CTelepathyGabbleTest() |
|
119 { |
|
120 iLog->Log( _L("CTelepathyGabbleTest::~CTelepathyGabbleTest in") ); |
|
121 // Delete resources allocated from test methods |
|
122 Delete(); |
|
123 |
|
124 iLog->Log( _L("CTelepathyGabbleTest::~CTelepathyGabbleTest out") ); |
|
125 // Delete logger |
|
126 delete iLog; |
|
127 |
|
128 } |
|
129 |
|
130 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // LibEntryL is a polymorphic Dll entry point. |
|
134 // Returns: CScriptBase: New CScriptBase derived object |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 EXPORT_C CScriptBase* LibEntryL( |
|
138 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
139 { |
|
140 |
|
141 return ( CScriptBase* ) CTelepathyGabbleTest::NewL( aTestModuleIf ); |
|
142 |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // E32Dll is a DLL entry point function. |
|
147 // Returns: KErrNone |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 #ifndef EKA2 // Hide Dll entry point to EKA2 |
|
151 GLDEF_C TInt E32Dll( |
|
152 TDllReason /*aReason*/) // Reason code |
|
153 { |
|
154 return(KErrNone); |
|
155 |
|
156 } |
|
157 #endif // EKA2 |
|
158 // End of File |