|
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: UI_NewFileServiceTest test class for STIF Test Framework TestScripter. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <Stiftestinterface.h> |
|
25 #include "UI_NewFileServiceTest.h" |
|
26 #include <SettingServerClient.h> |
|
27 |
|
28 |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CUI_NewFileServiceTest::CUI_NewFileServiceTest |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CUI_NewFileServiceTest::CUI_NewFileServiceTest( |
|
39 CTestModuleIf& aTestModuleIf ): |
|
40 CScriptBase( aTestModuleIf ) |
|
41 { |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CUI_NewFileServiceTest::ConstructL |
|
46 // Symbian 2nd phase constructor can leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 void CUI_NewFileServiceTest::ConstructL() |
|
50 { |
|
51 //Read logger settings to check whether test case name is to be |
|
52 //appended to log file name. |
|
53 RSettingServer 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 |
|
70 TFileName logFileName; |
|
71 |
|
72 if(loggerSettings.iAddTestCaseTitle) |
|
73 { |
|
74 TName title; |
|
75 TestModuleIf().GetTestCaseTitleL(title); |
|
76 logFileName.Format(KUI_NewFileServiceTestLogFileWithTitle, &title); |
|
77 } |
|
78 else |
|
79 { |
|
80 logFileName.Copy(KUI_NewFileServiceTestLogFile); |
|
81 } |
|
82 |
|
83 iLog = CStifLogger::NewL( KUI_NewFileServiceTestLogPath, |
|
84 logFileName, |
|
85 CStifLogger::ETxt, |
|
86 CStifLogger::EFile, |
|
87 EFalse ); |
|
88 |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CUI_NewFileServiceTest::NewL |
|
93 // Two-phased constructor. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CUI_NewFileServiceTest* CUI_NewFileServiceTest::NewL( |
|
97 CTestModuleIf& aTestModuleIf ) |
|
98 { |
|
99 CUI_NewFileServiceTest* self = new (ELeave) CUI_NewFileServiceTest( aTestModuleIf ); |
|
100 |
|
101 CleanupStack::PushL( self ); |
|
102 self->ConstructL(); |
|
103 CleanupStack::Pop(); |
|
104 |
|
105 return self; |
|
106 |
|
107 } |
|
108 |
|
109 // Destructor |
|
110 CUI_NewFileServiceTest::~CUI_NewFileServiceTest() |
|
111 { |
|
112 |
|
113 // Delete resources allocated from test methods |
|
114 Delete(); |
|
115 |
|
116 if ( iNewFileServiceClient != NULL ) |
|
117 { |
|
118 delete iNewFileServiceClient; |
|
119 iNewFileServiceClient=NULL; |
|
120 } |
|
121 |
|
122 // Delete logger |
|
123 delete iLog; |
|
124 |
|
125 } |
|
126 |
|
127 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // LibEntryL is a polymorphic Dll entry point. |
|
131 // Returns: CScriptBase: New CScriptBase derived object |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C CScriptBase* LibEntryL( |
|
135 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
136 { |
|
137 |
|
138 return ( CScriptBase* ) CUI_NewFileServiceTest::NewL( aTestModuleIf ); |
|
139 |
|
140 } |
|
141 |
|
142 |
|
143 // End of File |