13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
18 // INCLUDE FILES |
22 #include <Stiftestinterface.h> |
19 #include <Stiftestinterface.h> |
23 #include "UsbUiNotifApiTest.h" |
20 #include "usbuinotifapitest.h" |
24 #include <SettingServerClient.h> |
21 #include <SettingServerClient.h> |
25 |
22 |
26 // EXTERNAL DATA STRUCTURES |
23 // EXTERNAL DATA STRUCTURES |
27 //extern ?external_data; |
|
28 |
24 |
29 // EXTERNAL FUNCTION PROTOTYPES |
25 // EXTERNAL FUNCTION PROTOTYPES |
30 //extern ?external_function( ?arg_type,?arg_type ); |
|
31 |
26 |
32 // CONSTANTS |
27 // CONSTANTS |
33 //const ?type ?constant_var = ?constant; |
|
34 |
28 |
35 // MACROS |
29 // MACROS |
36 //#define ?macro ?macro_def |
|
37 |
30 |
38 // LOCAL CONSTANTS AND MACROS |
31 // LOCAL CONSTANTS AND MACROS |
39 //const ?type ?constant_var = ?constant; |
|
40 //#define ?macro_name ?macro_def |
|
41 |
32 |
42 // MODULE DATA STRUCTURES |
33 // MODULE DATA STRUCTURES |
43 //enum ?declaration |
|
44 //typedef ?declaration |
|
45 |
34 |
46 // LOCAL FUNCTION PROTOTYPES |
35 // LOCAL FUNCTION PROTOTYPES |
47 //?type ?function_name( ?arg_type, ?arg_type ); |
|
48 |
36 |
49 // FORWARD DECLARATIONS |
37 // FORWARD DECLARATIONS |
50 //class ?FORWARD_CLASSNAME; |
|
51 |
38 |
52 // ============================= LOCAL FUNCTIONS =============================== |
39 // ============================= LOCAL FUNCTIONS =============================== |
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // ?function_name ?description. |
|
56 // ?description |
|
57 // Returns: ?value_1: ?description |
|
58 // ?value_n: ?description_line1 |
|
59 // ?description_line2 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 /* |
|
63 ?type ?function_name( |
|
64 ?arg_type arg, // ?description |
|
65 ?arg_type arg) // ?description |
|
66 { |
|
67 |
|
68 ?code // ?comment |
|
69 |
|
70 // ?comment |
|
71 ?code |
|
72 } |
|
73 */ |
|
74 |
40 |
75 // ============================ MEMBER FUNCTIONS =============================== |
41 // ============================ MEMBER FUNCTIONS =============================== |
76 |
42 |
77 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
78 // CUsbUiNotifApiTest::CUsbUiNotifApiTest |
44 // CUSBUiNotifApiTest::CUSBUiNotifApiTest |
79 // C++ default constructor can NOT contain any code, that |
45 // C++ default constructor can NOT contain any code, that |
80 // might leave. |
46 // might leave. |
81 // ----------------------------------------------------------------------------- |
47 // ----------------------------------------------------------------------------- |
82 // |
48 // |
83 CUsbUiNotifApiTest::CUsbUiNotifApiTest( |
49 CUSBUiNotifApiTest::CUSBUiNotifApiTest( |
84 CTestModuleIf& aTestModuleIf ): |
50 CTestModuleIf& aTestModuleIf ): |
85 CScriptBase( aTestModuleIf ), |
51 CScriptBase( aTestModuleIf ), |
86 iRes(0) |
52 iRes(0) |
|
53 |
87 { |
54 { |
88 } |
55 } |
89 |
56 |
90 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
91 // CUsbUiNotifApiTest::ConstructL |
58 // CUSBUiNotifApiTest::ConstructL |
92 // Symbian 2nd phase constructor can leave. |
59 // Symbian 2nd phase constructor can leave. |
93 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
94 // |
61 // |
95 void CUsbUiNotifApiTest::ConstructL() |
62 void CUSBUiNotifApiTest::ConstructL() |
96 { |
63 { |
97 //Read logger settings to check whether test case name is to be |
64 //Read logger settings to check whether test case name is to be |
98 //appended to log file name. |
65 //appended to log file name. |
|
66 |
99 RSettingServer settingServer; |
67 RSettingServer settingServer; |
|
68 CleanupClosePushL(settingServer); |
100 TInt ret = settingServer.Connect(); |
69 TInt ret = settingServer.Connect(); |
101 if(ret != KErrNone) |
70 if(ret != KErrNone) |
102 { |
71 { |
103 User::Leave(ret); |
72 User::Leave(ret); |
104 } |
73 } |
109 if(ret != KErrNone) |
78 if(ret != KErrNone) |
110 { |
79 { |
111 User::Leave(ret); |
80 User::Leave(ret); |
112 } |
81 } |
113 // Close Setting server session |
82 // Close Setting server session |
114 settingServer.Close(); |
83 CleanupStack::PopAndDestroy(&settingServer); |
115 |
84 |
116 TFileName logFileName; |
85 TFileName logFileName; |
117 |
86 |
118 if(loggerSettings.iAddTestCaseTitle) |
87 if(loggerSettings.iAddTestCaseTitle) |
119 { |
88 { |
120 TName title; |
89 TName title; |
121 TestModuleIf().GetTestCaseTitleL(title); |
90 TestModuleIf().GetTestCaseTitleL(title); |
122 logFileName.Format(KUsbUiNotifApiTestLogFileWithTitle, &title); |
91 logFileName.Format(KUSBUiNotifApiTestLogFileWithTitle, &title); |
123 } |
92 } |
124 else |
93 else |
125 { |
94 { |
126 logFileName.Copy(KUsbUiNotifApiTestLogFile); |
95 logFileName.Copy(KUSBUiNotifApiTestLogFile); |
127 } |
96 } |
128 |
97 |
129 iLog = CStifLogger::NewL( KUsbUiNotifApiTestLogPath, |
98 iLog = CStifLogger::NewL( KUSBUiNotifApiTestLogPath, |
130 logFileName, |
99 logFileName, |
131 CStifLogger::ETxt, |
100 CStifLogger::ETxt, |
132 CStifLogger::EFile, |
101 CStifLogger::EFile, |
133 EFalse ); |
102 EFalse ); |
134 |
103 |
135 SendTestClassVersion(); |
104 SendTestClassVersion(); |
136 |
105 |
137 iNotifier = new ( ELeave ) RNotifier(); |
106 iNotifier = new ( ELeave ) RNotifier(); |
|
107 /* |
138 iUsbWatcher = new ( ELeave ) RUsbWatcher(); |
108 iUsbWatcher = new ( ELeave ) RUsbWatcher(); |
139 iRepository = CRepository::NewL( KCRUidUsbWatcher ); |
109 iRepository = CRepository::NewL( KCRUidUsbWatcher ); |
|
110 */ |
140 } |
111 } |
141 |
112 |
142 // ----------------------------------------------------------------------------- |
113 // ----------------------------------------------------------------------------- |
143 // CUsbUiNotifApiTest::NewL |
114 // CUSBUiNotifApiTest::NewL |
144 // Two-phased constructor. |
115 // Two-phased constructor. |
145 // ----------------------------------------------------------------------------- |
116 // ----------------------------------------------------------------------------- |
146 // |
117 // |
147 CUsbUiNotifApiTest* CUsbUiNotifApiTest::NewL( |
118 CUSBUiNotifApiTest* CUSBUiNotifApiTest::NewL( |
148 CTestModuleIf& aTestModuleIf ) |
119 CTestModuleIf& aTestModuleIf ) |
149 { |
120 { |
150 CUsbUiNotifApiTest* self = new (ELeave) CUsbUiNotifApiTest( aTestModuleIf ); |
121 CUSBUiNotifApiTest* self = new (ELeave) CUSBUiNotifApiTest( aTestModuleIf ); |
151 |
122 |
152 CleanupStack::PushL( self ); |
123 CleanupStack::PushL( self ); |
153 self->ConstructL(); |
124 self->ConstructL(); |
154 CleanupStack::Pop(); |
125 CleanupStack::Pop( self ); |
155 |
126 |
156 return self; |
127 return self; |
157 |
128 |
158 } |
129 } |
159 |
130 |
160 // Destructor |
131 // Destructor |
161 CUsbUiNotifApiTest::~CUsbUiNotifApiTest() |
132 CUSBUiNotifApiTest::~CUSBUiNotifApiTest() |
162 { |
133 { |
163 |
134 |
164 // Delete resources allocated from test methods |
135 // Delete resources allocated from test methods |
165 Delete(); |
136 Delete(); |
166 |
137 |
168 delete iLog; |
139 delete iLog; |
169 |
140 |
170 } |
141 } |
171 |
142 |
172 //----------------------------------------------------------------------------- |
143 //----------------------------------------------------------------------------- |
173 // CUsbUiNotifApiTest::SendTestClassVersion |
144 // CUSBUiNotifApiTest::SendTestClassVersion |
174 // Method used to send version of test class |
145 // Method used to send version of test class |
175 //----------------------------------------------------------------------------- |
146 //----------------------------------------------------------------------------- |
176 // |
147 // |
177 void CUsbUiNotifApiTest::SendTestClassVersion() |
148 void CUSBUiNotifApiTest::SendTestClassVersion() |
178 { |
149 { |
179 TVersion moduleVersion; |
150 TVersion moduleVersion; |
180 moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; |
151 moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; |
181 moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; |
152 moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; |
182 moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; |
153 moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; |
183 |
154 |
184 TFileName moduleName; |
155 TFileName moduleName; |
185 moduleName = _L("UsbUiNotifApiTest.dll"); |
156 moduleName = _L("USBUiNotifApiTest.dll"); |
186 |
157 |
187 TBool newVersionOfMethod = ETrue; |
158 TBool newVersionOfMethod = ETrue; |
188 TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); |
159 TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); |
189 } |
160 } |
190 |
161 |