|
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 "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <Stiftestinterface.h> |
|
21 #include "ContentListingFrameworkTest.h" |
|
22 #include <SettingServerClient.h> |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CContentListingFrameworkTest::CContentListingFrameworkTest |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CContentListingFrameworkTest::CContentListingFrameworkTest( |
|
33 CTestModuleIf& aTestModuleIf ): |
|
34 CScriptBase( aTestModuleIf ) |
|
35 { |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CContentListingFrameworkTest::ConstructL |
|
40 // Symbian 2nd phase constructor can leave. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 void CContentListingFrameworkTest::ConstructL() |
|
44 { |
|
45 //Read logger settings to check whether test case name is to be |
|
46 //appended to log file name. |
|
47 RSettingServer settingServer; |
|
48 TInt ret = settingServer.Connect(); |
|
49 if(ret != KErrNone) |
|
50 { |
|
51 User::Leave(ret); |
|
52 } |
|
53 // Struct to StifLogger settigs. |
|
54 TLoggerSettings loggerSettings; |
|
55 // Parse StifLogger defaults from STIF initialization file. |
|
56 ret = settingServer.GetLoggerSettings(loggerSettings); |
|
57 if(ret != KErrNone) |
|
58 { |
|
59 User::Leave(ret); |
|
60 } |
|
61 // Close Setting server session |
|
62 settingServer.Close(); |
|
63 |
|
64 TFileName logFileName; |
|
65 |
|
66 if(loggerSettings.iAddTestCaseTitle) |
|
67 { |
|
68 TName title; |
|
69 TestModuleIf().GetTestCaseTitleL(title); |
|
70 logFileName.Format(KContentListingFrameworkTestLogFileWithTitle, &title); |
|
71 } |
|
72 else |
|
73 { |
|
74 logFileName.Copy(KContentListingFrameworkTestLogFile); |
|
75 } |
|
76 |
|
77 iLog = CStifLogger::NewL( KContentListingFrameworkTestLogPath, |
|
78 logFileName, |
|
79 CStifLogger::ETxt, |
|
80 CStifLogger::EFile, |
|
81 EFalse ); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CContentListingFrameworkTest::NewL |
|
86 // Two-phased constructor. |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 CContentListingFrameworkTest* CContentListingFrameworkTest::NewL( |
|
90 CTestModuleIf& aTestModuleIf ) |
|
91 { |
|
92 CContentListingFrameworkTest* self = new (ELeave) CContentListingFrameworkTest( aTestModuleIf ); |
|
93 |
|
94 CleanupStack::PushL( self ); |
|
95 self->ConstructL(); |
|
96 CleanupStack::Pop( self ); |
|
97 |
|
98 return self; |
|
99 } |
|
100 |
|
101 // Destructor |
|
102 CContentListingFrameworkTest::~CContentListingFrameworkTest() |
|
103 { |
|
104 // Delete resources allocated from test methods |
|
105 Delete(); |
|
106 |
|
107 // Delete logger |
|
108 delete iLog; |
|
109 } |
|
110 |
|
111 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // LibEntryL is a polymorphic Dll entry point. |
|
115 // Returns: CScriptBase: New CScriptBase derived object |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 EXPORT_C CScriptBase* LibEntryL( |
|
119 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
120 { |
|
121 return ( CScriptBase* ) CContentListingFrameworkTest::NewL( aTestModuleIf ); |
|
122 } |
|
123 |
|
124 // End of File |