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