|
1 /* |
|
2 * Copyright (c) 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: STIF testing for MPX Harvester |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MPXHARVESTERTEST_H |
|
20 #define MPXHARVESTERTEST_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <StifLogger.h> |
|
24 #include <TestScripterInternal.h> |
|
25 #include <StifTestModule.h> |
|
26 |
|
27 #include <mpxmedia.h> |
|
28 #include <mpxharvesterutilityobserver.h> |
|
29 #include <mpxcollectionobserver.h> |
|
30 #include <f32file.h> |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KErrBadTestParameter= -1000; // Error on configuration file |
|
34 |
|
35 // MACROS |
|
36 // Logging path |
|
37 #ifdef __WINSCW__ |
|
38 _LIT( KmpxharvestertestLogPath, "\\testing\\log\\" ); |
|
39 _LIT( Kmpxharvester_testPath, "\\testing\\data\\" ); |
|
40 _LIT( Kmpxharvester_soundsPath, "c:\\data\\sounds\\" ); |
|
41 _LIT( Kmpxharvester_digitalPath, "c:\\data\\sounds\\digital\\" ); |
|
42 #else |
|
43 _LIT( KmpxharvestertestLogPath, "e:\\testing\\log\\" ); |
|
44 _LIT( Kmpxharvester_testPath, "e:\\testing\\data\\" ); |
|
45 _LIT( Kmpxharvester_soundsPath, "e:\\sounds\\" ); |
|
46 _LIT( Kmpxharvester_digitalPath, "e:\\sounds\\digital\\" ); |
|
47 #endif |
|
48 // Log file |
|
49 _LIT( KmpxharvestertestLogFile, "mpxharvestertest.txt" ); |
|
50 |
|
51 _LIT( KTagTestfile1, "mpxtest1.mp3" ); |
|
52 _LIT( KTagTestfile2, "mpxtest2.mp3" ); |
|
53 _LIT( KTagAll, "all" ); |
|
54 _LIT( KTagSync, "sync" ); |
|
55 _LIT( KTagAsync, "async" ); |
|
56 _LIT( KTagTrue, "true" ); |
|
57 _LIT( KTagFalse, "false" ); |
|
58 _LIT( KTagM3U, "M3U" ); |
|
59 _LIT( KTagPLA, "PLA" ); |
|
60 _LIT( KTagMPV, "MPV" ); |
|
61 _LIT( KTagXSPF, "XSPF" ); |
|
62 _LIT( KTagXML, "XML" ); |
|
63 |
|
64 // FORWARD DECLARATIONS |
|
65 class Cmpxharvestertest; |
|
66 class MMPXHarvesterUtility; |
|
67 class MMPXCollectionUtility; |
|
68 |
|
69 // CLASS DECLARATION |
|
70 |
|
71 /** |
|
72 * Cmpxharvestertest test class for STIF Test Framework TestScripter. |
|
73 * |
|
74 * @lib mpxharvestertest.lib |
|
75 * @since s60 5.0 |
|
76 */ |
|
77 NONSHARABLE_CLASS(Cmpxharvestertest) : public CScriptBase, |
|
78 public MMPXHarvesterUtilityObserver, |
|
79 public MMPXCollectionObserver |
|
80 { |
|
81 private: |
|
82 enum TExpectedEvents |
|
83 { |
|
84 EEventHandlePlaylistExportCompletedL, |
|
85 EEventHandlePlaylistImportCompletedL, |
|
86 EEventHandleFileAddCompletedL, |
|
87 EEventHandleDeleteCompletedL, |
|
88 EEventHandleFileImportCompletedL, |
|
89 EEventHandleFileGetMediaCompletedL |
|
90 }; |
|
91 |
|
92 public: // Constructors and destructor |
|
93 |
|
94 /** |
|
95 * Two-phased constructor. |
|
96 */ |
|
97 static Cmpxharvestertest* NewL( CTestModuleIf& aTestModuleIf ); |
|
98 |
|
99 /** |
|
100 * Destructor. |
|
101 */ |
|
102 virtual ~Cmpxharvestertest(); |
|
103 |
|
104 public: // Functions from base classes |
|
105 |
|
106 /** |
|
107 * From CScriptBase Runs a script line. |
|
108 * @since s60 5.0 |
|
109 * @param aItem Script line containing method name and parameters |
|
110 * @return Symbian OS error code |
|
111 */ |
|
112 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
113 |
|
114 /** |
|
115 * From MMPXHarvesterUtilityObserver. |
|
116 * @since s60 5.0 |
|
117 */ |
|
118 virtual void HandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ); |
|
119 virtual void HandlePlaylistImportCompletedL( CMPXMedia* aMedia, TInt aErr ); |
|
120 virtual void HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ); |
|
121 virtual void HandleDeleteCompletedL( TInt aErr ); |
|
122 virtual void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ); |
|
123 virtual void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ); |
|
124 |
|
125 /** |
|
126 * From MMPXCollectionObserver. |
|
127 * @since s60 5.0 |
|
128 */ |
|
129 virtual void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
130 virtual void HandleCollectionMessage( CMPXMessage* aMsg, TInt aError ); |
|
131 virtual void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, TInt aError ); |
|
132 virtual void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError ); |
|
133 |
|
134 private: |
|
135 |
|
136 /** |
|
137 * C++ default constructor. |
|
138 */ |
|
139 Cmpxharvestertest( CTestModuleIf& aTestModuleIf ); |
|
140 |
|
141 /** |
|
142 * By default Symbian 2nd phase constructor is private. |
|
143 */ |
|
144 void ConstructL(); |
|
145 |
|
146 /** |
|
147 * Frees all resources allocated from test methods. |
|
148 * @since s60 5.0 |
|
149 */ |
|
150 void Delete(); |
|
151 |
|
152 /** |
|
153 * Add event to the expected event list |
|
154 * @since S60 5.0 |
|
155 */ |
|
156 void AddExpectedEvent( TExpectedEvents aEvent ); |
|
157 |
|
158 /** |
|
159 * Remove event from the expected event list |
|
160 * @since S60 5.0 |
|
161 */ |
|
162 TBool RemoveExpectedEvent( TExpectedEvents aEvent ); |
|
163 |
|
164 /** |
|
165 * Test methods are listed below. |
|
166 */ |
|
167 |
|
168 /** |
|
169 * Example test method. |
|
170 * @since s60 5.0 |
|
171 * @param aItem Script line containing parameters. |
|
172 * @return Symbian OS error code. |
|
173 */ |
|
174 TInt ExampleL( CStifItemParser& aItem ); |
|
175 //ADD NEW METHOD DEC HERE |
|
176 |
|
177 TInt CreateUtility( CStifItemParser& aItem ); |
|
178 TInt CopyTestFile( CStifItemParser& aItem ); |
|
179 TInt DeleteTestFile( CStifItemParser& aItem ); |
|
180 TInt VerifyEvents( CStifItemParser& aItem ); |
|
181 TInt Scan( CStifItemParser& aItem ); |
|
182 TInt CancelScan( CStifItemParser& aItem ); |
|
183 TInt AddFileByPath( CStifItemParser& aItem ); |
|
184 // TInt AddFileByMedia( CStifItemParser& aItem ); |
|
185 TInt RemoveFile( CStifItemParser& aItem ); |
|
186 TInt RemoveFiles( CStifItemParser& aItem ); |
|
187 TInt RecreateDatabases( CStifItemParser& aItem ); |
|
188 TInt DeleteFile( CStifItemParser& aItem ); |
|
189 TInt DeleteFiles( CStifItemParser& aItem ); |
|
190 // TInt UpdateFile( CStifItemParser& aItem ); |
|
191 TInt FindCollectionId( CStifItemParser& aItem ); |
|
192 // TInt RenameFileByMedia( CStifItemParser& aItem ); |
|
193 TInt RenameFileByPath( CStifItemParser& aItem ); |
|
194 // TInt ExportPlaylist( CStifItemParser& aItem ); |
|
195 TInt ImportPlaylist( CStifItemParser& aItem ); |
|
196 TInt ImportFile( CStifItemParser& aItem ); |
|
197 TInt RequiredAttributes( CStifItemParser& aItem ); |
|
198 TInt OptionalAttributes( CStifItemParser& aItem ); |
|
199 TInt PlaylistFileExtension( CStifItemParser& aItem ); |
|
200 TInt IsPlaylist( CStifItemParser& aItem ); |
|
201 TInt CheckForSystemEvents( CStifItemParser& aItem ); |
|
202 |
|
203 private: // Data |
|
204 MMPXHarvesterUtility* iHarvester; |
|
205 MMPXCollectionUtility* iCollection; |
|
206 RFs iFs; |
|
207 CFileMan* iFileMan; |
|
208 TInt iResult; |
|
209 // List of expected events |
|
210 RArray<TExpectedEvents> iExpectedEvents; |
|
211 }; |
|
212 |
|
213 #endif // MPXHARVESTERTEST_H |