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