|
1 /* |
|
2 * Copyright (c) 2002 - 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: mpxplaybackutilitytest blocks implementation for STIF Test Framework TestScripter. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] - do not remove |
|
21 #include <e32svr.h> |
|
22 #include <StifParser.h> |
|
23 #include <Stiftestinterface.h> |
|
24 #include "mpxplaybackutilitytest.h" |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 // --------------------------------------------------------------------------- |
|
27 // From MMPXPlaybackObserver |
|
28 // Handle playback message. |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 void Cmpxplaybackutilitytest::HandlePlaybackMessage( |
|
32 CMPXMessage* /*aMessage*/, TInt aError ) |
|
33 { |
|
34 iLog->Log(_L("Cmpxharvestertest::HandlePlaybackMessage: %d"), aError); |
|
35 } |
|
36 // ----------------------------------------------------------------------------- |
|
37 // Cmpxplaybackutilitytest::Delete |
|
38 // Delete here all resources allocated and opened from test methods. |
|
39 // Called from destructor. |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 void Cmpxplaybackutilitytest::Delete() |
|
43 { |
|
44 iMPXPlaybackUtility->Close(); |
|
45 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
46 iFile64.Close(); |
|
47 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
48 iFs.Close(); |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // Cmpxplaybackutilitytest::RunMethodL |
|
53 // Run specified method. Contains also table of test mothods and their names. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 TInt Cmpxplaybackutilitytest::RunMethodL( |
|
57 CStifItemParser& aItem ) |
|
58 { |
|
59 |
|
60 static TStifFunctionInfo const KFunctions[] = |
|
61 { |
|
62 // Copy this line for every implemented function. |
|
63 // First string is the function name used in TestScripter script file. |
|
64 // Second is the actual implementation member function. |
|
65 |
|
66 ENTRY( "MMPXPlaybackUtilityNewL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL ), |
|
67 ENTRY( "MMPXPlaybackUtilityUtilityL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL ), |
|
68 ENTRY( "MMPXPlaybackUtilityInit64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L ), |
|
69 ENTRY( "MMPXPlaybackUtilityInitStreaming64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L ), |
|
70 ENTRY( "MMPXPlaybackUtilityFile64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L ), |
|
71 |
|
72 //ADD NEW ENTRY HERE |
|
73 // [test cases entries] - Do not remove |
|
74 |
|
75 }; |
|
76 |
|
77 const TInt count = sizeof( KFunctions ) / |
|
78 sizeof( TStifFunctionInfo ); |
|
79 |
|
80 return RunInternalL( KFunctions, count, aItem ); |
|
81 |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL |
|
86 // NewL test method function. |
|
87 // (other items were commented in a header). |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL(CStifItemParser& /*aItem*/) |
|
91 { |
|
92 TInt err = KErrNone; |
|
93 |
|
94 TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL(KPbModeDefault,this )); |
|
95 |
|
96 if (err!= KErrNone) |
|
97 { |
|
98 iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewL: %d"), err); |
|
99 } |
|
100 |
|
101 return err; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL |
|
106 // UtilityL test method function. |
|
107 // (other items were commented in a header). |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL(CStifItemParser& /*aItem*/) |
|
111 { |
|
112 TInt err = KErrNone; |
|
113 |
|
114 TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL()); |
|
115 |
|
116 if (err!= KErrNone) |
|
117 { |
|
118 iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityL: %d"), err); |
|
119 } |
|
120 |
|
121 return err; |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L |
|
126 // Init64L test method function. |
|
127 // (other items were commented in a header). |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L(CStifItemParser& aItem) |
|
131 { |
|
132 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() begin")); |
|
133 TInt err = KErrNone; |
|
134 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
135 err = KErrNotSupported; |
|
136 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err); |
|
137 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
138 TPtrC string; |
|
139 |
|
140 if( aItem.GetNextString( string ) == KErrNone ) |
|
141 { |
|
142 TBuf<120> KFrom; |
|
143 KFrom.Append(KmpxplaybackutilityTestFilePath); |
|
144 KFrom.Append(string); |
|
145 if ( iFile64.SubSessionHandle() ) |
|
146 { |
|
147 iFile64.Close(); |
|
148 } |
|
149 err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters); |
|
150 if ( err == KErrNone ) |
|
151 { |
|
152 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() Open passed.")); |
|
153 TRAP(err,iMPXPlaybackUtility->Init64L(iFile64)); |
|
154 } |
|
155 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err); |
|
156 } |
|
157 else |
|
158 { |
|
159 iLog->Log(_L("MMPXPlaybackUtilityInit64L - Missing file name.")); |
|
160 err = KErrArgument; |
|
161 } |
|
162 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
163 return err; |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L |
|
168 // InitStreaming64L test method function. |
|
169 // (other items were commented in a header). |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L(CStifItemParser& aItem) |
|
173 { |
|
174 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() begin")); |
|
175 TInt err = KErrNone; |
|
176 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
177 err = KErrNotSupported; |
|
178 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() error=%d"),err); |
|
179 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
180 TPtrC string; |
|
181 TInt accessPoint = 1; |
|
182 |
|
183 if( aItem.GetNextString( string ) == KErrNone ) |
|
184 { |
|
185 TBuf<120> KFrom; |
|
186 KFrom.Append(KmpxplaybackutilityTestFilePath); |
|
187 KFrom.Append(string); |
|
188 if ( iFile64.SubSessionHandle() ) |
|
189 { |
|
190 iFile64.Close(); |
|
191 } |
|
192 err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters); |
|
193 if ( err == KErrNone ) |
|
194 { |
|
195 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() Open passed.")); |
|
196 TRAP(err,iMPXPlaybackUtility->InitStreaming64L(iFile64, accessPoint)); |
|
197 } |
|
198 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() error=%d"),err); |
|
199 } |
|
200 else |
|
201 { |
|
202 iLog->Log(_L("MMPXPlaybackUtilityInitStreaming64L - Missing file name.")); |
|
203 err = KErrArgument; |
|
204 } |
|
205 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
206 return err; |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L |
|
211 // File64L test method function. |
|
212 // (other items were commented in a header). |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L(CStifItemParser& /*aItem*/) |
|
216 { |
|
217 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L testing File64L() begin")); |
|
218 TInt err = KErrNone; |
|
219 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
220 err = KErrNotSupported; |
|
221 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L testing File64L() error=%d"),err); |
|
222 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
223 RFile64* file64Ptr; |
|
224 TRAP(err, file64Ptr=iMPXPlaybackUtility->Source()->File64L()); |
|
225 if ( !file64Ptr->SubSessionHandle() ) |
|
226 { |
|
227 iLog->Log(_L("MMPXPlaybackUtilityFile64L - file64 = NULL.")); |
|
228 } |
|
229 iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L testing File64L() error=%d"),err); |
|
230 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
231 return err; |
|
232 } |
|
233 |