|
57
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2009 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: This file contains testclass implementation.
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
// [INCLUDE FILES] - do not remove
|
|
|
19 |
#include <e32svr.h>
|
|
|
20 |
#include <StifParser.h>
|
|
|
21 |
#include <StifTestInterface.h>
|
|
|
22 |
#include <vcxmyvideosdefs.h>
|
|
|
23 |
#include <mpxmedia.h>
|
|
|
24 |
#include <mpxattribute.h>
|
|
|
25 |
#include <mpxmediaarray.h>
|
|
|
26 |
#include <mpxmediacontainerdefs.h>
|
|
|
27 |
#include <mpxmediageneraldefs.h>
|
|
|
28 |
#include <mpxmediavideodefs.h>
|
|
|
29 |
#include "VcxMyVideosCollectionUtilTest.h"
|
|
|
30 |
#include "vcxmyvideoscollectionutil.h"
|
|
|
31 |
|
|
|
32 |
// EXTERNAL DATA STRUCTURES
|
|
|
33 |
//extern ?external_data;
|
|
|
34 |
|
|
|
35 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
|
36 |
//extern ?external_function( ?arg_type,?arg_type );
|
|
|
37 |
|
|
|
38 |
// CONSTANTS
|
|
|
39 |
//const ?type ?constant_var = ?constant;
|
|
|
40 |
|
|
|
41 |
// MACROS
|
|
|
42 |
//#define ?macro ?macro_def
|
|
|
43 |
|
|
|
44 |
// LOCAL CONSTANTS AND MACROS
|
|
|
45 |
//const ?type ?constant_var = ?constant;
|
|
|
46 |
//#define ?macro_name ?macro_def
|
|
|
47 |
|
|
|
48 |
// MODULE DATA STRUCTURES
|
|
|
49 |
//enum ?declaration
|
|
|
50 |
//typedef ?declaration
|
|
|
51 |
|
|
|
52 |
// LOCAL FUNCTION PROTOTYPES
|
|
|
53 |
//?type ?function_name( ?arg_type, ?arg_type );
|
|
|
54 |
|
|
|
55 |
// FORWARD DECLARATIONS
|
|
|
56 |
//class ?FORWARD_CLASSNAME;
|
|
|
57 |
|
|
|
58 |
const TMPXAttributeData KMPXMediaFail={0xC0FFEE,0xBADBEEF};
|
|
|
59 |
|
|
|
60 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
|
61 |
|
|
|
62 |
// -----------------------------------------------------------------------------
|
|
|
63 |
// CVcxMyVideosCollectionUtilTest::Delete
|
|
|
64 |
// Delete here all resources allocated and opened from test methods.
|
|
|
65 |
// Called from destructor.
|
|
|
66 |
// -----------------------------------------------------------------------------
|
|
|
67 |
//
|
|
|
68 |
void CVcxMyVideosCollectionUtilTest::Delete()
|
|
|
69 |
{
|
|
|
70 |
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
// -----------------------------------------------------------------------------
|
|
|
74 |
// CVcxMyVideosCollectionUtilTest::RunMethodL
|
|
|
75 |
// Run specified method. Contains also table of test mothods and their names.
|
|
|
76 |
// -----------------------------------------------------------------------------
|
|
|
77 |
//
|
|
|
78 |
TInt CVcxMyVideosCollectionUtilTest::RunMethodL(
|
|
|
79 |
CStifItemParser& aItem )
|
|
|
80 |
{
|
|
|
81 |
|
|
|
82 |
static TStifFunctionInfo const KFunctions[] =
|
|
|
83 |
{
|
|
|
84 |
// Copy this line for every implemented function.
|
|
|
85 |
// First string is the function name used in TestScripter script file.
|
|
|
86 |
// Second is the actual implementation member function.
|
|
|
87 |
ENTRY( "CreateEmptyMediaList", CVcxMyVideosCollectionUtilTest::CreateEmptyMediaListL ),
|
|
|
88 |
ENTRY( "CreateEmptyMessageList", CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL ),
|
|
|
89 |
ENTRY( "CopyFromListToList", CVcxMyVideosCollectionUtilTest::CopyFromListToListL ),
|
|
|
90 |
ENTRY( "CopyFromListToList2", CVcxMyVideosCollectionUtilTest::CopyFromListToListL2 ),
|
|
|
91 |
ENTRY( "DriveLetter2DriveNumber", CVcxMyVideosCollectionUtilTest::DriveLetter2DriveNumberL ),
|
|
|
92 |
ENTRY( "MakeUniqueFileName", CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL ),
|
|
|
93 |
ENTRY( "Origin", CVcxMyVideosCollectionUtilTest::OriginL ),
|
|
|
94 |
ENTRY( "Flags", CVcxMyVideosCollectionUtilTest::FlagsL ),
|
|
|
95 |
ENTRY( "DownloadId", CVcxMyVideosCollectionUtilTest::DownloadIdL ),
|
|
|
96 |
ENTRY( "DownloadState", CVcxMyVideosCollectionUtilTest::DownloadStateL ),
|
|
|
97 |
ENTRY( "Id", CVcxMyVideosCollectionUtilTest::IdL ),
|
|
|
98 |
ENTRY( "Duration", CVcxMyVideosCollectionUtilTest::DurationL ),
|
|
|
99 |
ENTRY( "Title", CVcxMyVideosCollectionUtilTest::TitleL ),
|
|
|
100 |
ENTRY( "Rating", CVcxMyVideosCollectionUtilTest::RatingL ),
|
|
|
101 |
ENTRY( "AudioFourCc", CVcxMyVideosCollectionUtilTest::AudioFourCcL ),
|
|
|
102 |
ENTRY( "AreSupported", CVcxMyVideosCollectionUtilTest::AreSupportedL ),
|
|
|
103 |
ENTRY( "AttrBelongsToFullSet", CVcxMyVideosCollectionUtilTest::AttrBelongsToFullSetL ),
|
|
|
104 |
ENTRY( "Origin2", CVcxMyVideosCollectionUtilTest::Origin ),
|
|
|
105 |
ENTRY( "PrintOpenFileHandles", CVcxMyVideosCollectionUtilTest::PrintOpenFileHandlesL ),
|
|
|
106 |
ENTRY( "GetProcessName", CVcxMyVideosCollectionUtilTest::GetProcessNameL ),
|
|
|
107 |
//ADD NEW ENTRY HERE
|
|
|
108 |
// [test cases entries] - Do not remove
|
|
|
109 |
|
|
|
110 |
};
|
|
|
111 |
|
|
|
112 |
const TInt count = sizeof( KFunctions ) /
|
|
|
113 |
sizeof( TStifFunctionInfo );
|
|
|
114 |
|
|
|
115 |
return RunInternalL( KFunctions, count, aItem );
|
|
|
116 |
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
// ----------------------------------------------------------------------------
|
|
|
120 |
// CVcxMyVideosCollectionUtil::CreateEmptyMediaListL
|
|
|
121 |
// ----------------------------------------------------------------------------
|
|
|
122 |
//
|
|
|
123 |
TInt CVcxMyVideosCollectionUtilTest::CreateEmptyMediaListL( CStifItemParser& /*aItem*/ )
|
|
|
124 |
{
|
|
|
125 |
CMPXMedia* media = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
|
|
|
126 |
delete media;
|
|
|
127 |
|
|
|
128 |
// Only thing that can fail here is method call leaves. If we reach the end
|
|
|
129 |
// everyting has worked fine and we can return ok.
|
|
|
130 |
return KErrNone;
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
// ----------------------------------------------------------------------------
|
|
|
134 |
// CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL
|
|
|
135 |
// ----------------------------------------------------------------------------
|
|
|
136 |
//
|
|
|
137 |
TInt CVcxMyVideosCollectionUtilTest::CreateEmptyMessageListL( CStifItemParser& /*aItem*/ )
|
|
|
138 |
{
|
|
|
139 |
CMPXMedia* media = TVcxMyVideosCollectionUtil::CreateEmptyMessageListL();
|
|
|
140 |
delete media;
|
|
|
141 |
|
|
|
142 |
// Only thing that can fail here is method call leaves. If we reach the end
|
|
|
143 |
// everyting has worked fine and we can return ok.
|
|
|
144 |
return KErrNone;
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
// ---------------------------------------------------------------------------
|
|
|
148 |
// CVcxMyVideosCollectionUtilTest::CopyFromListToListL
|
|
|
149 |
// ---------------------------------------------------------------------------
|
|
|
150 |
//
|
|
|
151 |
TInt CVcxMyVideosCollectionUtilTest::CopyFromListToListL( CStifItemParser& aItem )
|
|
|
152 |
{
|
|
|
153 |
CMPXMedia* from = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
|
|
|
154 |
CMPXMedia* to = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
|
|
|
155 |
CMPXMedia* failList = CMPXMedia::NewL();
|
|
|
156 |
CMPXMedia* media( NULL );
|
|
|
157 |
TInt itemsToCopy( 0 );
|
|
|
158 |
TInt itemsCopied( 0 );
|
|
|
159 |
RArray<TUint32> ids;
|
|
|
160 |
TMPXItemId idGet;
|
|
|
161 |
TInt retVal( KErrGeneral );
|
|
|
162 |
|
|
|
163 |
TInt numberOfMedia;
|
|
|
164 |
TInt wantedId;
|
|
|
165 |
|
|
|
166 |
aItem.GetNextInt( numberOfMedia );
|
|
|
167 |
aItem.GetNextInt( wantedId );
|
|
|
168 |
|
|
|
169 |
ids.Append( wantedId );
|
|
|
170 |
|
|
|
171 |
// add stuff to be copied to "from" -list
|
|
|
172 |
CleanupStack::PushL( from );
|
|
|
173 |
CleanupStack::PushL( to );
|
|
|
174 |
CMPXMediaArray* fromMessageArray = from->Value<CMPXMediaArray>(
|
|
|
175 |
KMPXMediaArrayContents );
|
|
|
176 |
CleanupStack::PushL( fromMessageArray );
|
|
|
177 |
|
|
|
178 |
TVcxMyVideosCollectionUtil::CopyFromListToListL( *from, *to, ids );
|
|
|
179 |
|
|
|
180 |
for(TInt i = 0; i < numberOfMedia; i++ )
|
|
|
181 |
{
|
|
|
182 |
media = CMPXMedia::NewL();
|
|
|
183 |
CleanupStack::PushL( media );
|
|
|
184 |
media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId,
|
|
|
185 |
TMPXItemId( i, i) );
|
|
|
186 |
media->SetTObjectValueL<TInt32>( KVcxMediaMyVideosInt32Value,
|
|
|
187 |
42 );
|
|
|
188 |
fromMessageArray->AppendL( media );
|
|
|
189 |
if( i == wantedId )
|
|
|
190 |
{
|
|
|
191 |
itemsToCopy++;
|
|
|
192 |
}
|
|
|
193 |
CleanupStack::Pop( media );
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
TRAPD( err, TVcxMyVideosCollectionUtil::CopyFromListToListL( *from, *failList, ids ) );
|
|
|
197 |
if( err != KErrArgument )
|
|
|
198 |
{
|
|
|
199 |
CleanupStack::Pop( fromMessageArray );
|
|
|
200 |
CleanupStack::Pop( to );
|
|
|
201 |
CleanupStack::Pop( from );
|
|
|
202 |
fromMessageArray->Reset();
|
|
|
203 |
delete failList;
|
|
|
204 |
delete from;
|
|
|
205 |
delete to;
|
|
|
206 |
return retVal;
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
TVcxMyVideosCollectionUtil::CopyFromListToListL( *from, *to, ids );
|
|
|
210 |
|
|
|
211 |
// check that the "to" -list have the items it should have
|
|
|
212 |
CMPXMediaArray* toMessageArray = to->Value<CMPXMediaArray>(
|
|
|
213 |
KMPXMediaArrayContents );
|
|
|
214 |
CleanupStack::PushL( toMessageArray );
|
|
|
215 |
|
|
|
216 |
for( TInt i = 0; i < toMessageArray->Count(); i++ )
|
|
|
217 |
{
|
|
|
218 |
idGet = TVcxMyVideosCollectionUtil::IdL( *(toMessageArray->operator[](i)) );
|
|
|
219 |
if( idGet.iId1 == wantedId )
|
|
|
220 |
{
|
|
|
221 |
itemsCopied++;
|
|
|
222 |
}
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
if( itemsCopied == itemsToCopy )
|
|
|
226 |
{
|
|
|
227 |
retVal = KErrNone;
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
CleanupStack::Pop( toMessageArray );
|
|
|
231 |
CleanupStack::Pop( fromMessageArray );
|
|
|
232 |
CleanupStack::Pop( to );
|
|
|
233 |
CleanupStack::Pop( from );
|
|
|
234 |
|
|
|
235 |
toMessageArray->Reset();
|
|
|
236 |
fromMessageArray->Reset();
|
|
|
237 |
|
|
|
238 |
delete failList;
|
|
|
239 |
delete from;
|
|
|
240 |
delete to;
|
|
|
241 |
return retVal;
|
|
|
242 |
}
|
|
|
243 |
|
|
|
244 |
// ---------------------------------------------------------------------------
|
|
|
245 |
// CVcxMyVideosCollectionUtilTest::CopyFromListToListL2
|
|
|
246 |
// ---------------------------------------------------------------------------
|
|
|
247 |
//
|
|
|
248 |
TInt CVcxMyVideosCollectionUtilTest::CopyFromListToListL2( CStifItemParser& aItem )
|
|
|
249 |
{
|
|
|
250 |
RArray<CMPXMedia*> fromArray;
|
|
|
251 |
CMPXMedia* to = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
|
|
|
252 |
CMPXMedia* failList = CMPXMedia::NewL();
|
|
|
253 |
CMPXMedia* media( NULL );
|
|
|
254 |
TInt itemsToCopy( 0 );
|
|
|
255 |
TInt itemsCopied( 0 );
|
|
|
256 |
RArray<TUint32> ids;
|
|
|
257 |
TMPXItemId idGet;
|
|
|
258 |
TInt retVal( KErrGeneral );
|
|
|
259 |
|
|
|
260 |
TInt numberOfMedia;
|
|
|
261 |
TInt wantedId;
|
|
|
262 |
|
|
|
263 |
aItem.GetNextInt( numberOfMedia );
|
|
|
264 |
aItem.GetNextInt( wantedId );
|
|
|
265 |
|
|
|
266 |
ids.Append( wantedId );
|
|
|
267 |
|
|
|
268 |
// add stuff to be copied to "from" -list
|
|
|
269 |
CleanupStack::PushL( to );
|
|
|
270 |
|
|
|
271 |
TVcxMyVideosCollectionUtil::CopyFromListToListL( fromArray, *to, ids );
|
|
|
272 |
|
|
|
273 |
for(TInt i = 0; i < numberOfMedia; i++ )
|
|
|
274 |
{
|
|
|
275 |
media = CMPXMedia::NewL();
|
|
|
276 |
CleanupStack::PushL( media );
|
|
|
277 |
media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId,
|
|
|
278 |
TMPXItemId( i, i) );
|
|
|
279 |
media->SetTObjectValueL<TInt32>( KVcxMediaMyVideosInt32Value,
|
|
|
280 |
42 );
|
|
|
281 |
fromArray.AppendL( media );
|
|
|
282 |
if( i == wantedId )
|
|
|
283 |
{
|
|
|
284 |
itemsToCopy++;
|
|
|
285 |
}
|
|
|
286 |
CleanupStack::Pop( media );
|
|
|
287 |
}
|
|
|
288 |
|
|
|
289 |
TRAPD(err, TVcxMyVideosCollectionUtil::CopyFromListToListL( fromArray, *failList, ids ));
|
|
|
290 |
if( err != KErrArgument )
|
|
|
291 |
{
|
|
|
292 |
CleanupStack::Pop( to );
|
|
|
293 |
fromArray.Reset();
|
|
|
294 |
delete failList;
|
|
|
295 |
delete to;
|
|
|
296 |
return retVal;
|
|
|
297 |
}
|
|
|
298 |
|
|
|
299 |
TVcxMyVideosCollectionUtil::CopyFromListToListL( fromArray, *to, ids );
|
|
|
300 |
|
|
|
301 |
// check that the "to" -list have the items it should have
|
|
|
302 |
CMPXMediaArray* toMessageArray = to->Value<CMPXMediaArray>(
|
|
|
303 |
KMPXMediaArrayContents );
|
|
|
304 |
CleanupStack::PushL( toMessageArray );
|
|
|
305 |
|
|
|
306 |
for( TInt i = 0; i < toMessageArray->Count(); i++ )
|
|
|
307 |
{
|
|
|
308 |
idGet = TVcxMyVideosCollectionUtil::IdL( *(toMessageArray->operator[](i)) );
|
|
|
309 |
if( idGet.iId1 == wantedId )
|
|
|
310 |
{
|
|
|
311 |
itemsCopied++;
|
|
|
312 |
}
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
if( itemsCopied == itemsToCopy )
|
|
|
316 |
{
|
|
|
317 |
retVal = KErrNone;
|
|
|
318 |
}
|
|
|
319 |
|
|
|
320 |
CleanupStack::Pop( toMessageArray );
|
|
|
321 |
CleanupStack::Pop( to );
|
|
|
322 |
|
|
|
323 |
toMessageArray->Reset();
|
|
|
324 |
|
|
|
325 |
for( TInt i = 0; i < fromArray.Count(); i++ )
|
|
|
326 |
{
|
|
|
327 |
CMPXMedia* arrayMedia = fromArray[i];
|
|
|
328 |
delete arrayMedia;
|
|
|
329 |
}
|
|
|
330 |
fromArray.Reset();
|
|
|
331 |
delete failList;
|
|
|
332 |
delete to;
|
|
|
333 |
return retVal;
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
// ---------------------------------------------------------------------------
|
|
|
337 |
// This helper function converts drive letter to drive number
|
|
|
338 |
// ---------------------------------------------------------------------------
|
|
|
339 |
//
|
|
|
340 |
TInt CVcxMyVideosCollectionUtilTest::DriveLetter2DriveNumberL( CStifItemParser& aItem )
|
|
|
341 |
{
|
|
|
342 |
TInt retVal( KErrNone );
|
|
|
343 |
TPtrC string;
|
|
|
344 |
TInt expectedValue( -1 );
|
|
|
345 |
|
|
|
346 |
aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
|
|
|
347 |
|
|
|
348 |
User::LeaveIfError( aItem.GetNextString( string ) );
|
|
|
349 |
User::LeaveIfError( aItem.GetNextInt( expectedValue ) );
|
|
|
350 |
|
|
|
351 |
_LIT( KNullDescString, "KNullDesC" );
|
|
|
352 |
if ( string.Compare( KNullDescString ) == 0 )
|
|
|
353 |
{
|
|
|
354 |
string.Set( KNullDesC );
|
|
|
355 |
}
|
|
|
356 |
|
|
|
357 |
TInt driveNumber = TVcxMyVideosCollectionUtil::DriveLetter2DriveNumber( string );
|
|
|
358 |
if ( driveNumber != expectedValue )
|
|
|
359 |
{
|
|
|
360 |
retVal = KErrGeneral;
|
|
|
361 |
}
|
|
|
362 |
|
|
|
363 |
return retVal;
|
|
|
364 |
}
|
|
|
365 |
|
|
|
366 |
// ---------------------------------------------------------------------------
|
|
|
367 |
// CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL
|
|
|
368 |
// ---------------------------------------------------------------------------
|
|
|
369 |
//
|
|
|
370 |
TInt CVcxMyVideosCollectionUtilTest::MakeUniqueFileNameL( CStifItemParser& /*aItem*/ )
|
|
|
371 |
{
|
|
|
372 |
TInt retVal( KErrNone );
|
|
|
373 |
RFs fs;
|
|
|
374 |
fs.Connect();
|
|
|
375 |
TBuf<KMaxPath> path;
|
|
|
376 |
_LIT( KFileName1, "c:\\data\\vcxmyvideoscollectionutiltest_file.txt" );
|
|
|
377 |
_LIT( KFileName2, "c:\\data\\vcxmyvideoscollectionutiltest_file2" );
|
|
|
378 |
_LIT( KInvalidFile, "c:\\data\\vcxmyvideoscollectionutiltest_DoesNotExist" );
|
|
|
379 |
|
|
|
380 |
// File with filename extension
|
|
|
381 |
TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KFileName1, path );
|
|
|
382 |
if ( path.Length() <= KFileName1().Length() )
|
|
|
383 |
{
|
|
|
384 |
retVal = KErrGeneral;
|
|
|
385 |
}
|
|
|
386 |
|
|
|
387 |
// File without filename extension
|
|
|
388 |
TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KFileName2, path );
|
|
|
389 |
if ( ( path.Find( KFileName2 ) == KErrNotFound ) ||
|
|
|
390 |
( path.Length() <= KFileName2().Length() ) )
|
|
|
391 |
{
|
|
|
392 |
retVal = KErrGeneral;
|
|
|
393 |
}
|
|
|
394 |
|
|
|
395 |
// Non-existent file
|
|
|
396 |
TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KInvalidFile, path );
|
|
|
397 |
if ( path.Compare( KInvalidFile ) != 0 )
|
|
|
398 |
{
|
|
|
399 |
retVal = KErrGeneral;
|
|
|
400 |
}
|
|
|
401 |
|
|
|
402 |
// Null descriptor
|
|
|
403 |
TVcxMyVideosCollectionUtil::MakeUniqueFileNameL( fs, KNullDesC, path );
|
|
|
404 |
|
|
|
405 |
fs.Close();
|
|
|
406 |
return retVal;
|
|
|
407 |
}
|
|
|
408 |
|
|
|
409 |
// ----------------------------------------------------------------------------
|
|
|
410 |
// CVcxMyVideosCollectionUtilTest::OriginL
|
|
|
411 |
// ----------------------------------------------------------------------------
|
|
|
412 |
//
|
|
|
413 |
TInt CVcxMyVideosCollectionUtilTest::OriginL( CStifItemParser& /*aItem*/ )
|
|
|
414 |
{
|
|
|
415 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
416 |
TInt retVal( KErrNone );
|
|
|
417 |
TUint8 valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
|
|
|
418 |
valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
|
|
|
419 |
if( EVcxMyVideosOriginOther != valueGet )
|
|
|
420 |
{
|
|
|
421 |
retVal = KErrGeneral;
|
|
|
422 |
delete media;
|
|
|
423 |
return retVal;
|
|
|
424 |
}
|
|
|
425 |
TUint8 valueSet = EVcxMyVideosOriginCapturedWithCamera;
|
|
|
426 |
media->SetTObjectValueL<TUint8>( KVcxMediaMyVideosOrigin, valueSet );
|
|
|
427 |
valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
|
|
|
428 |
if( valueSet != valueGet )
|
|
|
429 |
{
|
|
|
430 |
retVal = KErrGeneral;
|
|
|
431 |
delete media;
|
|
|
432 |
return retVal;
|
|
|
433 |
}
|
|
|
434 |
valueSet = EVcxMyVideosOriginTvRecording;
|
|
|
435 |
media->SetTObjectValueL<TUint8>( KVcxMediaMyVideosOrigin, valueSet );
|
|
|
436 |
valueGet = TVcxMyVideosCollectionUtil::OriginL( *media );
|
|
|
437 |
if( EVcxMyVideosOriginOther != valueGet )
|
|
|
438 |
{
|
|
|
439 |
retVal = KErrGeneral;
|
|
|
440 |
}
|
|
|
441 |
delete media;
|
|
|
442 |
return retVal;
|
|
|
443 |
}
|
|
|
444 |
|
|
|
445 |
// ----------------------------------------------------------------------------
|
|
|
446 |
// CVcxMyVideosCollectionUtilTest::FlagsL
|
|
|
447 |
// ----------------------------------------------------------------------------
|
|
|
448 |
//
|
|
|
449 |
TInt CVcxMyVideosCollectionUtilTest::FlagsL( CStifItemParser& /*aItem*/ )
|
|
|
450 |
{
|
|
|
451 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
452 |
TInt retVal( KErrNone );
|
|
|
453 |
TUint32 flagsSet( 0xBEEF );
|
|
|
454 |
TUint32 flagsGet( TVcxMyVideosCollectionUtil::FlagsL( *media ) );
|
|
|
455 |
if( flagsGet != 0 )
|
|
|
456 |
{
|
|
|
457 |
delete media;
|
|
|
458 |
retVal = KErrGeneral;
|
|
|
459 |
return retVal;
|
|
|
460 |
}
|
|
|
461 |
media->SetTObjectValueL<TUint32>( KMPXMediaGeneralFlags, flagsSet );
|
|
|
462 |
flagsGet= TVcxMyVideosCollectionUtil::FlagsL( *media );
|
|
|
463 |
if( flagsSet != flagsGet )
|
|
|
464 |
{
|
|
|
465 |
retVal = KErrGeneral;
|
|
|
466 |
}
|
|
|
467 |
delete media;
|
|
|
468 |
return retVal;
|
|
|
469 |
}
|
|
|
470 |
|
|
|
471 |
// ----------------------------------------------------------------------------
|
|
|
472 |
// CVcxMyVideosCollectionUtilTest::DownloadIdL
|
|
|
473 |
// ----------------------------------------------------------------------------
|
|
|
474 |
//
|
|
|
475 |
TInt CVcxMyVideosCollectionUtilTest::DownloadIdL( CStifItemParser& /*aItem*/ )
|
|
|
476 |
{
|
|
|
477 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
478 |
TInt retVal( KErrNone );
|
|
|
479 |
TUint32 idSet( 0xBEEF );
|
|
|
480 |
TUint32 idGet( TVcxMyVideosCollectionUtil::DownloadIdL( *media ) );
|
|
|
481 |
if( 0 != idGet )
|
|
|
482 |
{
|
|
|
483 |
delete media;
|
|
|
484 |
retVal = KErrGeneral;
|
|
|
485 |
return retVal;
|
|
|
486 |
}
|
|
|
487 |
media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, idSet );
|
|
|
488 |
idGet = TVcxMyVideosCollectionUtil::DownloadIdL( *media );
|
|
|
489 |
if( idSet != idGet )
|
|
|
490 |
{
|
|
|
491 |
retVal = KErrGeneral;
|
|
|
492 |
}
|
|
|
493 |
delete media;
|
|
|
494 |
return retVal;
|
|
|
495 |
}
|
|
|
496 |
|
|
|
497 |
// ----------------------------------------------------------------------------
|
|
|
498 |
// CVcxMyVideosCollectionUtilTest::DownloadStateL
|
|
|
499 |
// ----------------------------------------------------------------------------
|
|
|
500 |
//
|
|
|
501 |
TInt CVcxMyVideosCollectionUtilTest::DownloadStateL( CStifItemParser& /*aItem*/ )
|
|
|
502 |
{
|
|
|
503 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
504 |
TInt retVal( KErrNone );
|
|
|
505 |
TVcxMyVideosDownloadState stateSet = EVcxMyVideosDlStateFailed;
|
|
|
506 |
TVcxMyVideosDownloadState stateGet = TVcxMyVideosCollectionUtil::DownloadStateL( *media );
|
|
|
507 |
if( EVcxMyVideosDlStateNone != stateGet )
|
|
|
508 |
{
|
|
|
509 |
delete media;
|
|
|
510 |
retVal = KErrGeneral;
|
|
|
511 |
return retVal;
|
|
|
512 |
}
|
|
|
513 |
media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadState, stateSet );
|
|
|
514 |
stateGet = TVcxMyVideosCollectionUtil::DownloadStateL( *media );
|
|
|
515 |
if( stateSet != stateGet )
|
|
|
516 |
{
|
|
|
517 |
retVal = KErrGeneral;
|
|
|
518 |
}
|
|
|
519 |
delete media;
|
|
|
520 |
return retVal;
|
|
|
521 |
}
|
|
|
522 |
|
|
|
523 |
// ----------------------------------------------------------------------------
|
|
|
524 |
// CVcxMyVideosCollectionUtilTest::IdL
|
|
|
525 |
// ----------------------------------------------------------------------------
|
|
|
526 |
//
|
|
|
527 |
TInt CVcxMyVideosCollectionUtilTest::IdL( CStifItemParser& /*aItem*/ )
|
|
|
528 |
{
|
|
|
529 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
530 |
TInt retVal( KErrNone );
|
|
|
531 |
TMPXItemId idSet( 2, 7 );
|
|
|
532 |
TMPXItemId idGet = TVcxMyVideosCollectionUtil::IdL( *media );
|
|
|
533 |
if( (idGet.iId1 != 0) || (idGet.iId2 != 0) )
|
|
|
534 |
{
|
|
|
535 |
delete media;
|
|
|
536 |
retVal = KErrGeneral;
|
|
|
537 |
return retVal;
|
|
|
538 |
}
|
|
|
539 |
media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, idSet );
|
|
|
540 |
idGet = TVcxMyVideosCollectionUtil::IdL( *media );
|
|
|
541 |
if( idSet != idGet )
|
|
|
542 |
{
|
|
|
543 |
retVal = KErrGeneral;
|
|
|
544 |
}
|
|
|
545 |
delete media;
|
|
|
546 |
return retVal;
|
|
|
547 |
}
|
|
|
548 |
|
|
|
549 |
// ----------------------------------------------------------------------------
|
|
|
550 |
// CVcxMyVideosCollectionUtilTest::DurationL
|
|
|
551 |
// ----------------------------------------------------------------------------
|
|
|
552 |
//
|
|
|
553 |
TInt CVcxMyVideosCollectionUtilTest::DurationL( CStifItemParser& /*aItem*/ )
|
|
|
554 |
{
|
|
|
555 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
556 |
TInt retVal( KErrNone );
|
|
|
557 |
TReal32 durationSet( 150 );
|
|
|
558 |
TReal32 durationGet = TVcxMyVideosCollectionUtil::DurationL( *media );
|
|
|
559 |
if( -1 != durationGet )
|
|
|
560 |
{
|
|
|
561 |
delete media;
|
|
|
562 |
retVal = KErrGeneral;
|
|
|
563 |
return retVal;
|
|
|
564 |
}
|
|
|
565 |
media->SetTObjectValueL<TReal32>( KVcxMediaMyVideosDuration, durationSet );
|
|
|
566 |
durationGet = TVcxMyVideosCollectionUtil::DurationL( *media );
|
|
|
567 |
if( durationSet != durationGet )
|
|
|
568 |
{
|
|
|
569 |
retVal = KErrGeneral;
|
|
|
570 |
}
|
|
|
571 |
delete media;
|
|
|
572 |
return retVal;
|
|
|
573 |
}
|
|
|
574 |
|
|
|
575 |
// ----------------------------------------------------------------------------
|
|
|
576 |
// TVcxMyVideosCollectionUtil::Title
|
|
|
577 |
// ----------------------------------------------------------------------------
|
|
|
578 |
//
|
|
|
579 |
TInt CVcxMyVideosCollectionUtilTest::TitleL( CStifItemParser& /*aItem*/ )
|
|
|
580 |
{
|
|
|
581 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
582 |
TInt retVal( KErrNone );
|
|
|
583 |
_LIT( valueSet, "TeamNinja" );
|
|
|
584 |
HBufC* valueGet = TVcxMyVideosCollectionUtil::Title( *media ).AllocL();
|
|
|
585 |
if( valueGet->Size() != 0 )
|
|
|
586 |
{
|
|
|
587 |
delete media;
|
|
|
588 |
delete valueGet;
|
|
|
589 |
retVal = KErrGeneral;
|
|
|
590 |
return retVal;
|
|
|
591 |
}
|
|
|
592 |
delete valueGet;
|
|
|
593 |
media->SetTextValueL( KMPXMediaGeneralTitle, valueSet );
|
|
|
594 |
valueGet = TVcxMyVideosCollectionUtil::Title( *media ).AllocL();
|
|
|
595 |
if( valueGet->CompareF( valueSet ) )
|
|
|
596 |
{
|
|
|
597 |
retVal = KErrGeneral;
|
|
|
598 |
}
|
|
|
599 |
delete media;
|
|
|
600 |
delete valueGet;
|
|
|
601 |
return retVal;
|
|
|
602 |
}
|
|
|
603 |
|
|
|
604 |
// ----------------------------------------------------------------------------
|
|
|
605 |
// CVcxMyVideosCollectionUtilTest::RatingL
|
|
|
606 |
// ----------------------------------------------------------------------------
|
|
|
607 |
//
|
|
|
608 |
TInt CVcxMyVideosCollectionUtilTest::RatingL( CStifItemParser& /*aItem*/ )
|
|
|
609 |
{
|
|
|
610 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
611 |
TInt retVal( KErrNone );
|
|
|
612 |
TUint8 valueSet( 21 );
|
|
|
613 |
TUint8 valueGet = TVcxMyVideosCollectionUtil::RatingL( *media );;
|
|
|
614 |
if( 0 != valueGet )
|
|
|
615 |
{
|
|
|
616 |
delete media;
|
|
|
617 |
retVal = KErrGeneral;
|
|
|
618 |
return retVal;
|
|
|
619 |
}
|
|
|
620 |
media->SetTObjectValueL<TUint8>( KVcxMediaMyVideosRating, valueSet );
|
|
|
621 |
valueGet = TVcxMyVideosCollectionUtil::RatingL( *media );;
|
|
|
622 |
if( valueSet != valueGet )
|
|
|
623 |
{
|
|
|
624 |
retVal = KErrGeneral;
|
|
|
625 |
}
|
|
|
626 |
delete media;
|
|
|
627 |
return retVal;
|
|
|
628 |
}
|
|
|
629 |
|
|
|
630 |
// ----------------------------------------------------------------------------
|
|
|
631 |
// CVcxMyVideosCollectionUtilTest::AudioFourCcL
|
|
|
632 |
// ----------------------------------------------------------------------------
|
|
|
633 |
//
|
|
|
634 |
TInt CVcxMyVideosCollectionUtilTest::AudioFourCcL( CStifItemParser& /*aItem*/ )
|
|
|
635 |
{
|
|
|
636 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
637 |
TInt retVal( KErrNone );
|
|
|
638 |
TUint32 valueSet( 21 );
|
|
|
639 |
TUint32 valueGet = TVcxMyVideosCollectionUtil::AudioFourCcL( *media );;
|
|
|
640 |
if( 0 != valueGet )
|
|
|
641 |
{
|
|
|
642 |
delete media;
|
|
|
643 |
retVal = KErrGeneral;
|
|
|
644 |
return retVal;
|
|
|
645 |
}
|
|
|
646 |
media->SetTObjectValueL<TUint32>( KVcxMediaMyVideosAudioFourCc, valueSet );
|
|
|
647 |
valueGet = TVcxMyVideosCollectionUtil::AudioFourCcL( *media );;
|
|
|
648 |
if( valueSet != valueGet )
|
|
|
649 |
{
|
|
|
650 |
retVal = KErrGeneral;
|
|
|
651 |
}
|
|
|
652 |
delete media;
|
|
|
653 |
return retVal;
|
|
|
654 |
}
|
|
|
655 |
|
|
|
656 |
// ----------------------------------------------------------------------------
|
|
|
657 |
// CVcxMyVideosCollectionUtilTest::AreSupported
|
|
|
658 |
// ----------------------------------------------------------------------------
|
|
|
659 |
//
|
|
|
660 |
TInt CVcxMyVideosCollectionUtilTest::AreSupportedL( CStifItemParser& /*aItem*/ )
|
|
|
661 |
{
|
|
|
662 |
TInt retVal( KErrNone );
|
|
|
663 |
CMPXMedia* media = CMPXMedia::NewL();
|
|
|
664 |
RArray<TMPXAttribute> attrs;
|
|
|
665 |
TBool inMds( EFalse );
|
|
|
666 |
TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
|
|
|
667 |
attrs.Append( KMPXMediaFail );
|
|
|
668 |
TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
|
|
|
669 |
attrs.Append( KMPXMediaVideoBitRate );
|
|
|
670 |
inMds = ETrue;
|
|
|
671 |
TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
|
|
|
672 |
media->SetTObjectValueL<TUint16>( KMPXMediaVideoBitRate, 47 );
|
|
|
673 |
TVcxMyVideosCollectionUtil::AreSupported( *media, attrs.Array(), inMds );
|
|
|
674 |
delete media;
|
|
|
675 |
return retVal;
|
|
|
676 |
}
|
|
|
677 |
|
|
|
678 |
// ----------------------------------------------------------------------------
|
|
|
679 |
// CVcxMyVideosCollectionUtilTest::AttrBelongsToFullSet
|
|
|
680 |
// ----------------------------------------------------------------------------
|
|
|
681 |
//
|
|
|
682 |
TInt CVcxMyVideosCollectionUtilTest::AttrBelongsToFullSetL( CStifItemParser& /*aItem*/ )
|
|
|
683 |
{
|
|
|
684 |
TInt retVal( KErrNone );
|
|
|
685 |
|
|
|
686 |
if ( !( TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralComment ) &&
|
|
|
687 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralCopyright ) &&
|
|
|
688 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralMimeType ) &&
|
|
|
689 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaGeneralLastPlaybackPosition ) &&
|
|
|
690 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KVcxMediaMyVideosModifiedDate ) &&
|
|
|
691 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KVcxMediaMyVideosAudioLanguage ) &&
|
|
|
692 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KVcxMediaMyVideosAuthor ) &&
|
|
|
693 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoBitRate ) &&
|
|
|
694 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoHeight ) &&
|
|
|
695 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoWidth ) &&
|
|
|
696 |
TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaVideoArtist ) ) )
|
|
|
697 |
{
|
|
|
698 |
retVal = KErrGeneral;
|
|
|
699 |
return retVal;
|
|
|
700 |
}
|
|
|
701 |
|
|
|
702 |
if( TVcxMyVideosCollectionUtil::AttrBelongsToFullSet( KMPXMediaFail ) )
|
|
|
703 |
{
|
|
|
704 |
retVal = KErrGeneral;
|
|
|
705 |
}
|
|
|
706 |
|
|
|
707 |
return retVal;
|
|
|
708 |
}
|
|
|
709 |
|
|
|
710 |
// ----------------------------------------------------------------------------
|
|
|
711 |
// CVcxMyVideosCollectionUtilTest::Origin
|
|
|
712 |
// ----------------------------------------------------------------------------
|
|
|
713 |
//
|
|
|
714 |
TInt CVcxMyVideosCollectionUtilTest::Origin( CStifItemParser& /*aItem*/ )
|
|
|
715 |
{
|
|
|
716 |
TInt retVal( KErrNone );
|
|
|
717 |
|
|
|
718 |
if ( ( TVcxMyVideosCollectionUtil::Origin( KVcxMvcCategoryIdDownloads )
|
|
|
719 |
!= EVcxMyVideosOriginDownloaded ) ||
|
|
|
720 |
( TVcxMyVideosCollectionUtil::Origin( KVcxMvcCategoryIdTvRecordings )
|
|
|
721 |
!= EVcxMyVideosOriginTvRecording ) ||
|
|
|
722 |
( TVcxMyVideosCollectionUtil::Origin( KVcxMvcCategoryIdCaptured )
|
|
|
723 |
!= EVcxMyVideosOriginCapturedWithCamera ) ||
|
|
|
724 |
( TVcxMyVideosCollectionUtil::Origin( KVcxMvcCategoryIdOther )
|
|
|
725 |
!= EVcxMyVideosOriginOther ) ||
|
|
|
726 |
( TVcxMyVideosCollectionUtil::Origin( KVcxMvcCategoryIdAll )
|
|
|
727 |
!= KErrNotFound ) )
|
|
|
728 |
{
|
|
|
729 |
retVal = KErrGeneral;
|
|
|
730 |
return retVal;
|
|
|
731 |
}
|
|
|
732 |
|
|
|
733 |
if( TVcxMyVideosCollectionUtil::Origin( KCategoryIdExtraItem3 ) != KErrNotFound )
|
|
|
734 |
{
|
|
|
735 |
retVal = KErrGeneral;
|
|
|
736 |
}
|
|
|
737 |
|
|
|
738 |
return retVal;
|
|
|
739 |
}
|
|
|
740 |
|
|
|
741 |
// ----------------------------------------------------------------------------
|
|
|
742 |
// CVcxMyVideosCollectionUtilTest::PrintOpenFileHandlesL
|
|
|
743 |
// ----------------------------------------------------------------------------
|
|
|
744 |
//
|
|
|
745 |
TInt CVcxMyVideosCollectionUtilTest::PrintOpenFileHandlesL( CStifItemParser& /*aItem*/ )
|
|
|
746 |
{
|
|
|
747 |
TInt retVal( KErrNone );
|
|
|
748 |
|
|
|
749 |
#ifdef _DEBUG
|
|
|
750 |
RFs fs;
|
|
|
751 |
RFile file;
|
|
|
752 |
_LIT( KFileName, "c:\\data\\vcxmyvideoscollectionutiltest_file.txt" );
|
|
|
753 |
_LIT( KInvalidFileName, "c:\\data\\vcxmyvideoscollectionutiltest_fail.txt" );
|
|
|
754 |
User::LeaveIfError( fs.Connect() );
|
|
|
755 |
User::LeaveIfError( file.Open( fs, KFileName, EFileShareAny | EFileRead ) );
|
|
|
756 |
|
|
|
757 |
TVcxMyVideosCollectionUtil::PrintOpenFileHandlesL( KFileName, fs );
|
|
|
758 |
TVcxMyVideosCollectionUtil::PrintOpenFileHandlesL( KInvalidFileName, fs );
|
|
|
759 |
|
|
|
760 |
file.Close();
|
|
|
761 |
fs.Close();
|
|
|
762 |
#endif // _DEBUG
|
|
|
763 |
|
|
|
764 |
return retVal;
|
|
|
765 |
}
|
|
|
766 |
|
|
|
767 |
// ----------------------------------------------------------------------------
|
|
|
768 |
// CVcxMyVideosCollectionUtilTest::GetProcessName
|
|
|
769 |
// ----------------------------------------------------------------------------
|
|
|
770 |
//
|
|
|
771 |
TInt CVcxMyVideosCollectionUtilTest::GetProcessNameL( CStifItemParser& aItem )
|
|
|
772 |
{
|
|
|
773 |
TInt retVal( KErrNone );
|
|
|
774 |
TPtrC testProcessName;
|
|
|
775 |
TUint64 threadId = RThread().Id().Id();
|
|
|
776 |
TFullName processName;
|
|
|
777 |
//_LIT( KTestProcessName, "testscripter_vcxmyvideoscollectionutiltest" );
|
|
|
778 |
|
|
|
779 |
retVal = aItem.GetNextString( testProcessName );
|
|
|
780 |
|
|
|
781 |
#ifdef _DEBUG
|
|
|
782 |
if ( retVal == KErrNone )
|
|
|
783 |
{
|
|
|
784 |
TVcxMyVideosCollectionUtil::GetProcessName( threadId, processName );
|
|
|
785 |
if ( processName.Find( testProcessName ) == KErrNotFound )
|
|
|
786 |
{
|
|
|
787 |
retVal = KErrNotFound;
|
|
|
788 |
}
|
|
|
789 |
}
|
|
|
790 |
#endif // _DEBUG
|
|
|
791 |
return retVal;
|
|
|
792 |
}
|
|
|
793 |
|
|
|
794 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
|
795 |
// None
|
|
|
796 |
|
|
|
797 |
// [End of File] - Do not remove
|