Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 // Test system includes
22 #include <testframework.h>
23 #include "TSI_MmfCtlfrm.h"
24 #include "TSI_MmfCtlfrmStep.h"
25 #include "TSI_MmfCtlfrmSuite.h"
26 #include "TSI_MmfCodes.h"
27 #include "TSI_MmfEventIds.h"
28 #include "ActrlTestUids.h"
30 #include <mmf/common/mmfcontroller.h>
31 #include <mmf/common/mmfstandardcustomcommands.h>
32 #include <mmf/plugin/mmfcontrollerimplementationuids.hrh>
34 const TUid KTestControllerUid = {KTSIMmfControllerUid};
35 const TUid KTestDataSourceUid = {KTSIMmfDataSourceUid};
36 const TUid KTestDataSinkUid = {KTSIMmfDataSinkUid};
38 // audio controllers, from mmfControllerImplementationUIDs.hrh
39 const TUid KTestAudioControllerUid = {KMmfUidControllerAudio};
41 // pause length for repeat calls to GetPosition
42 // NB this can't be a const - global uninitialised data in ARM
43 #define KGetPositionIntervalLength 500000
45 // ---------------------------
46 // RTestMmfCtlfrmI0001
48 // Load each controller plugin into its own thread
52 RTestMmfCtlfrmI0001* RTestMmfCtlfrmI0001::NewL()
54 RTestMmfCtlfrmI0001* self = new(ELeave) RTestMmfCtlfrmI0001;
58 RTestMmfCtlfrmI0001::RTestMmfCtlfrmI0001()
60 iTestStepName = _L("MM-MMF-CTLFRM-I-0001");
64 TVerdict RTestMmfCtlfrmI0001::DoTestStepL()
67 TMMFPrioritySettings settings;
68 TInt error = KErrNone;
69 RMMFController controller, controller2;
71 settings.iPriority = ETSIMmfPriorityLow;
72 settings.iPref = EMdaPriorityPreferenceTime;
73 settings.iState = EMMFStateIdle;
76 error = controller.Open(KTestControllerUid, settings);
79 ERR_PRINTF2(_L("controller1 failed to open, error %d"), error);
80 return iTestStepResult = EInconclusive;
83 // Open another controller
84 // (it is valid for this test to open two instances of the same controller)
85 error = controller2.Open(KTestControllerUid, settings);
88 ERR_PRINTF2(_L("controller2 failed to open, error %d"), error);
90 return iTestStepResult = EInconclusive;
93 TBuf8<KTextBufLen> memFunctionText;
94 TUid uid = {KTSIMmfControllerUid};
95 TMMFMessageDestination handleInfo(uid);
96 TMMFMessageDestinationPckg messageDest(handleInfo);
97 TBuf<KTextBufLen> memFunctionText16;
98 TBuf<KTextBufLen> memFunction2Text16;
100 // get thread addresses
101 error = controller.CustomCommandSync(messageDest, KThreadIdFunction, KNullDesC8, KNullDesC8, memFunctionText);
104 ERR_PRINTF2(_L("controller1 CustomCommandSync failed with error %d"), error);
107 return iTestStepResult = EInconclusive;
110 // memFunctionText comes back as hex string
111 memFunctionText16.SetMax();
112 memFunctionText16.Fill(0x0);
113 memFunctionText16.Copy(memFunctionText);
114 INFO_PRINTF2(_L("Controller1 thread ID : 0x%S"), &memFunctionText16);
116 error = controller2.CustomCommandSync(messageDest, KThreadIdFunction, KNullDesC8, KNullDesC8, memFunctionText);
119 ERR_PRINTF2(_L("controller2 CustomCommandSync failed with error %d"), error);
122 return iTestStepResult = EInconclusive;
125 // memFunctionText comes back as hex string
126 memFunction2Text16.SetMax();
127 memFunction2Text16.Fill(0x0);
128 memFunction2Text16.Copy(memFunctionText);
129 INFO_PRINTF2(_L("Controller2 thread ID : 0x%S"), &memFunction2Text16);
131 // compare thread addresses; they must not match
132 if(!memFunctionText16.Compare(memFunction2Text16))
134 ERR_PRINTF1(_L("Error - thread IDs match"));
137 return iTestStepResult = EFail;
142 return iTestStepResult = EPass;
145 // ---------------------------
146 // RTestMmfCtlfrmI0002
148 // Give each controller thread its own heap
152 RTestMmfCtlfrmI0002* RTestMmfCtlfrmI0002::NewL()
154 RTestMmfCtlfrmI0002* self = new(ELeave) RTestMmfCtlfrmI0002;
158 RTestMmfCtlfrmI0002::RTestMmfCtlfrmI0002()
160 iTestStepName = _L("MM-MMF-CTLFRM-I-0002");
164 TVerdict RTestMmfCtlfrmI0002::DoTestStepL()
166 TMMFPrioritySettings settings;
167 TInt error = KErrNone;
168 RMMFController controller, controller2;
170 settings.iPriority = ETSIMmfPriorityLow;
171 settings.iPref = EMdaPriorityPreferenceTime;
172 settings.iState = EMMFStateIdle;
175 error = controller.Open(KTestControllerUid, settings);
178 ERR_PRINTF2(_L("controller1 failed to open, error %d"), error);
179 return iTestStepResult = EInconclusive;
182 // Open another controller
183 // (it is valid for this test to open two instances of the same controller)
184 error = controller2.Open(KTestControllerUid, settings);
187 ERR_PRINTF2(_L("controller2 failed to open, error %d"), error);
189 return iTestStepResult = EInconclusive;
192 TBuf8<KTextBufLen> memFunctionText;
193 TUid uid = {KTSIMmfControllerUid};
194 TMMFMessageDestination handleInfo(uid);
195 TMMFMessageDestinationPckg messageDest(handleInfo);
196 TBuf<KTextBufLen> memFunctionText16;
197 TBuf<KTextBufLen> memFunction2Text16;
199 // get heap addresses
200 error = controller.CustomCommandSync(messageDest, KHeapAddressFunction, KNullDesC8, KNullDesC8, memFunctionText);
203 ERR_PRINTF2(_L("controller1 CustomCommandSync failed with error %d"), error);
206 return iTestStepResult = EInconclusive;
209 // memFunctionText comes back as hex string
210 memFunctionText16.SetMax();
211 memFunctionText16.Fill(0x0);
212 memFunctionText16.Copy(memFunctionText);
213 INFO_PRINTF2(_L("Controller1 heap address : 0x%S"), &memFunctionText16);
215 error = controller2.CustomCommandSync(messageDest, KHeapAddressFunction, KNullDesC8, KNullDesC8, memFunctionText);
218 ERR_PRINTF2(_L("controller2 CustomCommandSync failed with error %d"), error);
221 return iTestStepResult = EInconclusive;
224 // memFunctionText comes back as hex string
225 memFunction2Text16.SetMax();
226 memFunction2Text16.Fill(0x0);
227 memFunction2Text16.Copy(memFunctionText);
228 INFO_PRINTF2(_L("Controller2 heap address : 0x%S"), &memFunction2Text16);
230 // compare heap addresses; they must not match
231 if(!memFunctionText16.Compare(memFunction2Text16))
233 ERR_PRINTF1(_L("Error - heap addresses match"));
236 return iTestStepResult = EFail;
243 return iTestStepResult = EPass;
246 // ---------------------------
247 // RTestMmfCtlfrmI0003
249 // Provide inter-thread access from client to controller plugin
253 RTestMmfCtlfrmI0003* RTestMmfCtlfrmI0003::NewL()
255 RTestMmfCtlfrmI0003* self = new(ELeave) RTestMmfCtlfrmI0003;
259 RTestMmfCtlfrmI0003::RTestMmfCtlfrmI0003()
261 iTestStepName = _L("MM-MMF-CTLFRM-I-0003");
264 TVerdict RTestMmfCtlfrmI0003::DoTestStepL()
266 TMMFPrioritySettings settings;
267 TInt error = KErrNone;
268 RMMFController controller;
270 settings.iPriority = ETSIMmfPriorityLow;
271 settings.iPref = EMdaPriorityPreferenceTime;
272 settings.iState = EMMFStateIdle;
276 error = controller.Open(KTestControllerUid, settings);
279 ERR_PRINTF2(_L("controller failed to open, error %d"), error);
280 return iTestStepResult = EInconclusive;
283 TUid uid = {KTSIMmfControllerUid};
284 TMMFMessageDestination handleInfo(uid);
285 TMMFMessageDestinationPckg messageDest(handleInfo);
287 // send dummy messages, to verify that return values are correct
288 error = controller.CustomCommandSync(messageDest, KDummyFunc1, KNullDesC8, KNullDesC8);
289 if(error == KDummyFunc1Return)
293 ERR_PRINTF2(_L("CustomCommandSync KDummyFunc1 returned unexpected value %d"), error);
295 return iTestStepResult = EFail;
299 error = controller.CustomCommandSync(messageDest, KDummyFunc2, KNullDesC8, KNullDesC8);
300 if(error == KDummyFunc2Return)
304 ERR_PRINTF2(_L("CustomCommandSync KDummyFunc2 returned unexpected value %d"), error);
306 return iTestStepResult = EFail;
309 INFO_PRINTF1(_L("CustomCommandSync returned expected values"));
313 return iTestStepResult = EPass;
316 // ---------------------------
317 // RTestMmfCtlfrmI0102
319 // Load a controller plugin by UID
323 RTestMmfCtlfrmI0102* RTestMmfCtlfrmI0102::NewL()
325 RTestMmfCtlfrmI0102* self = new(ELeave) RTestMmfCtlfrmI0102;
329 RTestMmfCtlfrmI0102::RTestMmfCtlfrmI0102()
331 iTestStepName = _L("MM-MMF-CTLFRM-I-0102");
334 TVerdict RTestMmfCtlfrmI0102::DoTestStepL()
336 TMMFPrioritySettings settings;
337 TInt error = KErrNone;
338 RMMFController controller;
340 settings.iPriority = ETSIMmfPriorityLow;
341 settings.iPref = EMdaPriorityPreferenceTime;
342 settings.iState = EMMFStateIdle;
345 error = controller.Open(KTestControllerUid, settings);
348 ERR_PRINTF2(_L("controller failed to open, error %d"), error);
349 return iTestStepResult = EInconclusive;
352 TUid uid = {KTSIMmfControllerUid};
353 TMMFMessageDestination handleInfo(uid);
354 TMMFMessageDestinationPckg messageDest(handleInfo);
355 TBuf8<KTextBufLen> memFunctionText;
356 TBuf<KTextBufLen> memFunctionText16;
358 // verify that we've loaded the plugin requested
359 // the return we expect to be the string KPluginUIDSubstitute
360 // we'd like to use the UID itself, but it's private in CMMFController, so this will have to do
361 error = controller.CustomCommandSync(messageDest, KPluginUidFunction, KNullDesC8, KNullDesC8, memFunctionText);
364 // could be we haven't got this function in the loaded plugin
365 ERR_PRINTF2(_L("CustomCommandSync KPluginUidFunction failed, error code %d"), error);
367 return iTestStepResult = EFail;
370 // this string must match that specified in TSIMmfController.cpp
371 _LIT8(KPluginUIDSubstitute, "TSI_MMFController");
373 // memFunctionText comes back as hex string
374 memFunctionText16.SetMax();
375 memFunctionText16.Fill(0x0);
376 memFunctionText16.Copy(memFunctionText);
377 INFO_PRINTF2(_L("Controller returned : %S"), &memFunctionText16);
379 // check return string is expected value
380 if(memFunctionText.Compare(KPluginUIDSubstitute)) // returns 0 if equal
382 ERR_PRINTF1(_L("Error - string does not match expected value"));
384 return iTestStepResult = EFail;
389 return iTestStepResult = EPass;
392 // ---------------------------
393 // RTestMmfCtlfrmI0105
395 // Load a controller plugin by filename / extension
397 // REQ172.5.3, REQ172.5.4
399 RTestMmfCtlfrmI0105* RTestMmfCtlfrmI0105::NewL()
401 RTestMmfCtlfrmI0105* self = new(ELeave) RTestMmfCtlfrmI0105;
405 RTestMmfCtlfrmI0105::RTestMmfCtlfrmI0105()
407 iTestStepName = _L("MM-MMF-CTLFRM-I-0105");
410 TVerdict RTestMmfCtlfrmI0105::DoTestStepL()
412 // open controller by filename / extension
414 INFO_PRINTF1(_L("open controller by filename / extension"));
416 TMMFPrioritySettings settings;
417 TInt error = KErrNone;
418 RMMFController controller;
420 settings.iPriority = ETSIMmfPriorityLow;
421 settings.iPref = EMdaPriorityPreferenceTime;
422 settings.iState = EMMFStateIdle;
424 CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
425 CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
427 // Set the format match data
428 fSelect->SetMatchToFileNameL(_L("test.wav"));
429 // Set the controller plugin play format match data
430 cSelect->SetRequiredPlayFormatSupportL(*fSelect);
432 RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
433 CleanupResetAndDestroyPushL(controllers);
434 cSelect->ListImplementationsL(controllers); // Populates the array with all the suitable controllers
435 TInt numControllers = controllers.Count();
438 ERR_PRINTF1(_L("Could not find any controllers"));
439 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
440 return iTestStepResult = EFail;
442 INFO_PRINTF2(_L("Found %d controllers"), numControllers);
443 CMMFControllerImplementationInformation* implInfo = controllers[0];
444 TUid theControllerImplUid = implInfo->Uid();
445 error = controller.Open(theControllerImplUid, settings); // instantiate the controller
448 ERR_PRINTF2(_L("Could not open controller, error %d"), error);
449 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
450 return iTestStepResult = EFail;
453 INFO_PRINTF2(_L("Opened controller with UID 0x%8x"), theControllerImplUid);
454 if(theControllerImplUid != KTestAudioControllerUid) // check it's the right one
456 ERR_PRINTF1(_L("Error: this is not the Audio Controller"));
457 return iTestStepResult = EFail;
460 INFO_PRINTF1(_L("This is the Audio Controller"));
462 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
463 return iTestStepResult = EPass;
466 // ---------------------------
467 // RTestMmfCtlfrmI0106
469 // Load a controller plugin from a preferred supplier by filename / extension
471 // REQ172.5.3, REQ172.5.4
473 RTestMmfCtlfrmI0106* RTestMmfCtlfrmI0106::NewL()
475 RTestMmfCtlfrmI0106* self = new(ELeave) RTestMmfCtlfrmI0106;
479 RTestMmfCtlfrmI0106::RTestMmfCtlfrmI0106()
481 iTestStepName = _L("MM-MMF-CTLFRM-I-0106");
484 TVerdict RTestMmfCtlfrmI0106::DoTestStepL()
486 // open controller by filename / extension and preferred supplier
488 INFO_PRINTF1(_L("open controller by filename / extension and preferred supplier"));
490 TMMFPrioritySettings settings;
491 TInt error = KErrNone;
492 RMMFController controller;
494 settings.iPriority = ETSIMmfPriorityLow;
495 settings.iPref = EMdaPriorityPreferenceTime;
496 settings.iState = EMMFStateIdle;
498 CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
499 CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
501 // Set the format match data
502 fSelect->SetMatchToFileNameL(_L("test.wav"));
503 // Set the controller plugin play format match data
504 cSelect->SetRequiredPlayFormatSupportL(*fSelect);
506 // Set for only those plugins supplied by "Symbian"
507 _LIT(KPrefSupplierSymbian, "Symbian");
508 cSelect->SetPreferredSupplierL(KPrefSupplierSymbian, CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned);
510 RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
511 CleanupResetAndDestroyPushL(controllers);
512 cSelect->ListImplementationsL(controllers); // Populates the array with all the suitable controllers
513 TInt numControllers = controllers.Count();
516 ERR_PRINTF1(_L("Could not find any controllers"));
517 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
518 return iTestStepResult = EFail;
520 INFO_PRINTF2(_L("Found %d controllers"), numControllers);
521 CMMFControllerImplementationInformation* implInfo = controllers[0];
522 TUid theControllerImplUid = implInfo->Uid();
523 error = controller.Open(theControllerImplUid, settings); // instantiate the controller
526 ERR_PRINTF2(_L("Could not open controller, error %d"), error);
527 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
528 return iTestStepResult = EFail;
531 INFO_PRINTF2(_L("Opened controller with UID 0x%8x"), theControllerImplUid);
532 if(theControllerImplUid != KTestAudioControllerUid) // check it's the right one
534 ERR_PRINTF1(_L("Error: this is not the requested controller"));
536 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
537 return iTestStepResult = EFail;
540 INFO_PRINTF1(_L("This is the Audio Controller"));
541 if(implInfo->Supplier() != KPrefSupplierSymbian) // check supplier
543 ERR_PRINTF1(_L("Error: this controller is not from the requested supplier"));
545 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
546 return iTestStepResult = EFail;
549 INFO_PRINTF1(_L("This controller is from the requested supplier"));
551 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
552 return iTestStepResult = EPass;
555 // ---------------------------
556 // RTestMmfCtlfrmI0107
558 // Add a second instance of a controller which already exists
562 RTestMmfCtlfrmI0107* RTestMmfCtlfrmI0107::NewL()
564 RTestMmfCtlfrmI0107* self = new(ELeave) RTestMmfCtlfrmI0107;
568 RTestMmfCtlfrmI0107::RTestMmfCtlfrmI0107()
570 iTestStepName = _L("MM-MMF-CTLFRM-I-0107");
573 TVerdict RTestMmfCtlfrmI0107::DoTestStepL()
575 // add a second instance of an already loaded controller
576 // essentially a duplicate of test 0001/0002 - simply to verify that we are running
577 // two instances of the same controller
579 INFO_PRINTF1(_L("add a second instance of an already loaded controller"));
581 TMMFPrioritySettings settings;
582 TInt error = KErrNone;
583 RMMFController controller, controller2;
585 settings.iPriority = ETSIMmfPriorityLow;
586 settings.iPref = EMdaPriorityPreferenceTime;
587 settings.iState = EMMFStateIdle;
590 error = controller.Open(KTestControllerUid, settings);
593 ERR_PRINTF2(_L("controller1 failed to open, error %d"), error);
594 return iTestStepResult = EInconclusive;
597 // Open another controller
598 // (it is valid for this test to open two instances of the same controller)
599 error = controller2.Open(KTestControllerUid, settings);
602 ERR_PRINTF2(_L("controller2 failed to open, error %d"), error);
604 return iTestStepResult = EInconclusive;
607 TBuf8<KTextBufLen> memFunctionText;
608 TUid uid = {KTSIMmfControllerUid};
609 TMMFMessageDestination handleInfo(uid);
610 TMMFMessageDestinationPckg messageDest(handleInfo);
611 TBuf<KTextBufLen> memFunctionText16;
612 TBuf<KTextBufLen> memFunction2Text16;
614 // get thread addresses
615 error = controller.CustomCommandSync(messageDest, KThreadIdFunction, KNullDesC8, KNullDesC8, memFunctionText);
618 ERR_PRINTF2(_L("controller1 CustomCommandSync failed with error %d"), error);
621 return iTestStepResult = EInconclusive;
624 // memFunctionText comes back as hex string
625 memFunctionText16.SetMax();
626 memFunctionText16.Fill(0x0);
627 memFunctionText16.Copy(memFunctionText);
628 INFO_PRINTF2(_L("Controller1 thread ID : 0x%S"), &memFunctionText16);
630 error = controller2.CustomCommandSync(messageDest, KThreadIdFunction, KNullDesC8, KNullDesC8, memFunctionText);
633 ERR_PRINTF2(_L("controller2 CustomCommandSync failed with error %d"), error);
636 return iTestStepResult = EInconclusive;
639 // memFunctionText comes back as hex string
640 memFunction2Text16.SetMax();
641 memFunction2Text16.Fill(0x0);
642 memFunction2Text16.Copy(memFunctionText);
643 INFO_PRINTF2(_L("Controller2 thread ID : 0x%S"), &memFunction2Text16);
645 // compare thread addresses; they must not match
646 if(!memFunctionText16.Compare(memFunction2Text16))
648 ERR_PRINTF1(_L("Error - thread IDs match"));
651 return iTestStepResult = EFail;
654 // get heap addresses
655 error = controller.CustomCommandSync(messageDest, KHeapAddressFunction, KNullDesC8, KNullDesC8, memFunctionText);
658 ERR_PRINTF2(_L("controller1 CustomCommandSync failed with error %d"), error);
661 return iTestStepResult = EInconclusive;
664 // memFunctionText comes back as hex string
665 memFunctionText16.SetMax();
666 memFunctionText16.Fill(0x0);
667 memFunctionText16.Copy(memFunctionText);
668 INFO_PRINTF2(_L("Controller1 heap address : 0x%S"), &memFunctionText16);
670 error = controller2.CustomCommandSync(messageDest, KHeapAddressFunction, KNullDesC8, KNullDesC8, memFunctionText);
673 ERR_PRINTF2(_L("controller2 CustomCommandSync failed with error %d"), error);
676 return iTestStepResult = EInconclusive;
679 // memFunctionText comes back as hex string
680 memFunction2Text16.SetMax();
681 memFunction2Text16.Fill(0x0);
682 memFunction2Text16.Copy(memFunctionText);
683 INFO_PRINTF2(_L("Controller2 heap address : 0x%S"), &memFunction2Text16);
685 // compare heap addresses; they must not match
686 if(!memFunctionText16.Compare(memFunction2Text16))
688 ERR_PRINTF1(_L("Error - heap addresses match"));
691 return iTestStepResult = EFail;
694 // success if we've got here
695 INFO_PRINTF1(_L("Two instances of the same controller loaded successfully"));
701 return iTestStepResult = EPass;
704 // ---------------------------
705 // RTestMmfCtlfrmI0108
707 // Load a controller plugin using ambiguous or insufficient information
711 RTestMmfCtlfrmI0108* RTestMmfCtlfrmI0108::NewL()
713 RTestMmfCtlfrmI0108* self = new(ELeave) RTestMmfCtlfrmI0108;
717 RTestMmfCtlfrmI0108::RTestMmfCtlfrmI0108()
719 iTestStepName = _L("MM-MMF-CTLFRM-I-0108");
722 TVerdict RTestMmfCtlfrmI0108::DoTestStepL()
724 // load a controller with ambiguous information
726 INFO_PRINTF1(_L("load a controller with insufficient information"));
728 // we'll basically give no information at all. if we get a controller back at all,
730 TMMFPrioritySettings settings;
731 TInt error = KErrNone;
732 RMMFController controller;
734 settings.iPriority = ETSIMmfPriorityLow;
735 settings.iPref = EMdaPriorityPreferenceTime;
736 settings.iState = EMMFStateIdle;
738 CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
740 RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
741 CleanupResetAndDestroyPushL(controllers);
742 cSelect->ListImplementationsL(controllers); // Populates the array with all the suitable controllers
743 TInt numControllers = controllers.Count();
746 ERR_PRINTF1(_L("Could not find any controllers"));
747 CleanupStack::PopAndDestroy(2);//controllers, cSelect
748 return iTestStepResult = EFail;
750 INFO_PRINTF2(_L("Found %d controllers"), numControllers);
751 TBool controllerLoaded = EFalse;
752 CMMFControllerImplementationInformation* implInfo = NULL;
753 TUid theControllerImplUid = TUid::Uid(0);
754 for(TInt i = 0; i < numControllers; i++)
756 implInfo = controllers[i];
757 theControllerImplUid = implInfo->Uid();
758 error = controller.Open(theControllerImplUid, settings); // instantiate the controller
761 if(error != KErrNoMemory)
763 ERR_PRINTF2(_L("Could not open controller, error %d"), error);
769 controllerLoaded = ETrue;
773 if(!controllerLoaded)
775 INFO_PRINTF1(_L("No controller loaded"));
776 CleanupStack::PopAndDestroy(2);//controllers, cSelect
777 return iTestStepResult = EFail;
780 const TDesC& theControllerImplName = implInfo->DisplayName();
781 const TDesC& theControllerImplSupplier = implInfo->Supplier();
782 INFO_PRINTF2(_L("Opened controller with UID 0x%8x"), theControllerImplUid);
783 INFO_PRINTF3(_L("This is the %S, supplied by %S"), &theControllerImplName, &theControllerImplSupplier);
785 CleanupStack::PopAndDestroy(2);//controllers, cSelect
786 return iTestStepResult = EPass;
790 // ---------------------------
791 // RTestMmfCtlfrmI0109
793 // Call overloaded constructors for parameters
797 RTestMmfCtlfrmI0109* RTestMmfCtlfrmI0109::NewL()
799 RTestMmfCtlfrmI0109* self = new(ELeave) RTestMmfCtlfrmI0109;
803 RTestMmfCtlfrmI0109::RTestMmfCtlfrmI0109()
805 iTestStepName = _L("MM-MMF-CTLFRM-I-0109");
808 TVerdict RTestMmfCtlfrmI0109::DoTestStepL()
810 // open controller by filename / extension
812 INFO_PRINTF1(_L("call overloaded constructors for parameters"));
814 CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewL();
815 CleanupStack::PushL(cSelect);
816 INFO_PRINTF1(_L("CMMFControllerPluginSelectionParameters constructed ok"));
818 CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewL();
819 CleanupStack::PushL(fSelect);
820 INFO_PRINTF1(_L("CMMFFormatSelectionParameters constructed ok"));
822 CMMFFormatDecodePluginSelectionParameters* dSelect = CMMFFormatDecodePluginSelectionParameters::NewL();
823 CleanupStack::PushL(dSelect);
824 INFO_PRINTF1(_L("CMMFFormatDecodePluginSelectionParameters constructed ok"));
826 CMMFFormatEncodePluginSelectionParameters* eSelect = CMMFFormatEncodePluginSelectionParameters::NewL();
827 CleanupStack::PushL(eSelect);
828 INFO_PRINTF1(_L("CMMFFormatEncodePluginSelectionParameters constructed ok"));
830 // if we get here without leaving, we've passed
831 CleanupStack::PopAndDestroy(4);//eSelect, dSelect, fSelect, cSelect
832 return iTestStepResult = EPass;
835 // ---------------------------
836 // RTestMmfCtlfrmI0111
842 RTestMmfCtlfrmI0111* RTestMmfCtlfrmI0111::NewL()
844 RTestMmfCtlfrmI0111* self = new(ELeave) RTestMmfCtlfrmI0111;
848 RTestMmfCtlfrmI0111::RTestMmfCtlfrmI0111()
850 iTestStepName = _L("MM-MMF-CTLFRM-I-0111");
853 TVerdict RTestMmfCtlfrmI0111::DoTestStepL()
855 INFO_PRINTF1(_L("(a) add a data source"));
857 TInt error = KErrNone;
859 _LIT8(KInitData,"TEST");
861 // first : add a data source without a handle
862 error = iController.AddDataSource(KTestDataSourceUid, KInitData);
865 ERR_PRINTF2(_L("AddDataSource failed, error %d"), error);
866 return iTestStepResult = EInconclusive;
869 // Get log info - we expect "AddDataSourceL Called"
870 _LIT8(KExpectedResult, "AddDataSourceL Called");
871 TBuf8<KTextBufLen> memFunctionText;
873 TUid uid = {KTSIMmfControllerUid};
874 TMMFMessageDestination handleInfo(uid);
875 TMMFMessageDestinationPckg messageDest(handleInfo);
877 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
880 ERR_PRINTF2(_L("controller CustomCommandSync failed with error %d"), error);
881 return iTestStepResult = EInconclusive;
884 TBuf<KTextBufLen> memFunctionText16;
885 memFunctionText16.SetMax();
886 memFunctionText16.Fill(0x0);
887 memFunctionText16.Copy(memFunctionText);
888 INFO_PRINTF2(_L("Log : %S"), &memFunctionText16);
890 if (memFunctionText != KExpectedResult)
892 ERR_PRINTF1(_L("Return value did not match expected"));
893 return iTestStepResult = EFail;
896 // second : add a data source with a handle
897 INFO_PRINTF1(_L("(b) add a data source with handle"));
898 TMMFMessageDestination* sourceHandlePtr = new (ELeave) TMMFMessageDestination();
899 TMMFMessageDestination& sourceHandle = *sourceHandlePtr;
901 error = iController.AddDataSource(KTestDataSourceUid, KInitData, sourceHandle);
904 ERR_PRINTF2(_L("AddDataSource failed, error %d"), error);
905 delete sourceHandlePtr;
906 return iTestStepResult = EInconclusive;
909 // Get log info - we expect "AddDataSourceL Called" again
910 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
913 ERR_PRINTF2(_L("controller CustomCommandSync failed with error %d"), error);
914 delete sourceHandlePtr;
915 return iTestStepResult = EInconclusive;
918 memFunctionText16.SetMax();
919 memFunctionText16.Fill(0x0);
920 memFunctionText16.Copy(memFunctionText);
921 INFO_PRINTF2(_L("Log : %S"), &memFunctionText16);
923 if (memFunctionText != KExpectedResult)
925 ERR_PRINTF1(_L("Return value did not match expected"));
926 delete sourceHandlePtr;
927 return iTestStepResult = EFail;
930 INFO_PRINTF2(_L("Data source handle is %d"), sourceHandle.DestinationHandle());
932 // call a custom source command. doesn't matter what it is, we'd expect it to return KErrNotSupported
933 // anyway - the point is to ensure CMMFDataSourceHolder::HandleRequest() is called.
934 // a return of 0 or -5 indicates it has been.
935 error = iController.CustomCommandSync(sourceHandle, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
936 INFO_PRINTF2(_L("CustomCommandSync on sourceHandle returned %d"), error);
937 if (error && error != KErrNotSupported)
939 ERR_PRINTF1(_L("Unexpected error code returned"));
940 delete sourceHandlePtr;
941 return iTestStepResult = EFail;
945 delete sourceHandlePtr;
946 return iTestStepResult = EPass;
949 // ---------------------------
950 // RTestMmfCtlfrmI0112
952 // Remove a data source
956 RTestMmfCtlfrmI0112* RTestMmfCtlfrmI0112::NewL()
958 RTestMmfCtlfrmI0112* self = new(ELeave) RTestMmfCtlfrmI0112;
962 RTestMmfCtlfrmI0112::RTestMmfCtlfrmI0112()
964 iTestStepName = _L("MM-MMF-CTLFRM-I-0112");
967 TVerdict RTestMmfCtlfrmI0112::DoTestStepL()
969 INFO_PRINTF1(_L("remove a data source"));
971 TInt error = KErrNone;
973 _LIT8(KInitData,"TEST");
975 // add a data source with a handle
976 TMMFMessageDestination* sourceHandlePtr = new (ELeave) TMMFMessageDestination();
977 TMMFMessageDestination& sourceHandle = *sourceHandlePtr;
979 error = iController.AddDataSource(KTestDataSourceUid, KInitData, sourceHandle);
982 ERR_PRINTF2(_L("AddDataSource failed, error %d"), error);
983 delete sourceHandlePtr;
984 return iTestStepResult = EInconclusive;
987 // Get log info - we expect "AddDataSourceL Called"
988 _LIT8(KExpectedResult, "AddDataSourceL Called");
989 TBuf8<KTextBufLen> memFunctionText;
991 TUid uid = {KTSIMmfControllerUid};
992 TMMFMessageDestination handleInfo(uid);
993 TMMFMessageDestinationPckg messageDest(handleInfo);
995 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
998 ERR_PRINTF2(_L("controller CustomCommandSync failed with error %d"), error);
999 delete sourceHandlePtr;
1000 return iTestStepResult = EInconclusive;
1003 if (memFunctionText != KExpectedResult)
1005 ERR_PRINTF1(_L("Return value did not match expected"));
1006 delete sourceHandlePtr;
1007 return iTestStepResult = EInconclusive;
1010 // now, delete the data source we just added
1011 error = iController.RemoveDataSource(sourceHandle);
1014 ERR_PRINTF2(_L("RemoveDataSource failed with error %d"), error);
1015 delete sourceHandlePtr;
1016 return iTestStepResult = EInconclusive;
1019 // verify that the data source is no longer there. try and remove it again, this should
1021 error = iController.RemoveDataSource(sourceHandle);
1024 ERR_PRINTF1(_L("Error : data source was not removed at first attempt"));
1025 delete sourceHandlePtr;
1026 return iTestStepResult = EInconclusive;
1029 INFO_PRINTF2(_L("Data source removed (second attempt failed with error %d)"), error);
1032 delete sourceHandlePtr;
1033 return iTestStepResult = EPass;
1036 // ---------------------------
1037 // RTestMmfCtlfrmI0113
1043 RTestMmfCtlfrmI0113* RTestMmfCtlfrmI0113::NewL()
1045 RTestMmfCtlfrmI0113* self = new(ELeave) RTestMmfCtlfrmI0113;
1049 RTestMmfCtlfrmI0113::RTestMmfCtlfrmI0113()
1051 iTestStepName = _L("MM-MMF-CTLFRM-I-0113");
1054 TVerdict RTestMmfCtlfrmI0113::DoTestStepL()
1056 INFO_PRINTF1(_L("(a) add a data sink"));
1058 TInt error = KErrNone;
1060 _LIT8(KInitData,"TEST");
1062 // first : add a data sink without a handle
1063 error = iController.AddDataSink(KTestDataSinkUid, KInitData);
1066 ERR_PRINTF2(_L("AddDataSink failed, error %d"), error);
1067 return iTestStepResult = EInconclusive;
1070 // Get log info - we expect "AddDataSinkL Called"
1071 _LIT8(KExpectedResult, "AddDataSinkL Called");
1072 TBuf8<KTextBufLen> memFunctionText;
1074 TUid uid = {KTSIMmfControllerUid};
1075 TMMFMessageDestination handleInfo(uid);
1076 TMMFMessageDestinationPckg messageDest(handleInfo);
1078 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
1081 ERR_PRINTF2(_L("controller CustomCommandSync failed with error %d"), error);
1082 return iTestStepResult = EInconclusive;
1085 TBuf<KTextBufLen> memFunctionText16;
1086 memFunctionText16.SetMax();
1087 memFunctionText16.Fill(0x0);
1088 memFunctionText16.Copy(memFunctionText);
1089 INFO_PRINTF2(_L("Log : %S"), &memFunctionText16);
1091 if (memFunctionText != KExpectedResult)
1093 ERR_PRINTF1(_L("Return value did not match expected"));
1094 return iTestStepResult = EFail;
1097 // second : add a data sink with a handle
1098 INFO_PRINTF1(_L("(b) add a data sink with handle"));
1099 TMMFMessageDestination* sinkHandlePtr = new (ELeave) TMMFMessageDestination();
1100 TMMFMessageDestination& sinkHandle = *sinkHandlePtr;
1102 error = iController.AddDataSink(KTestDataSinkUid, KInitData, sinkHandle);
1105 ERR_PRINTF2(_L("AddDataSink failed, error %d"), error);
1106 delete sinkHandlePtr;
1107 return iTestStepResult = EInconclusive;
1110 // Get log info - we expect "AddDataSinkL Called" again
1111 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
1114 ERR_PRINTF2(_L("controller CustomCommandSync failed with error %d"), error);
1115 delete sinkHandlePtr;
1116 return iTestStepResult = EInconclusive;
1119 memFunctionText16.SetMax();
1120 memFunctionText16.Fill(0x0);
1121 memFunctionText16.Copy(memFunctionText);
1122 INFO_PRINTF2(_L("Log : %S"), &memFunctionText16);
1124 if (memFunctionText != KExpectedResult)
1126 ERR_PRINTF1(_L("Return value did not match expected"));
1127 delete sinkHandlePtr;
1128 return iTestStepResult = EFail;
1131 INFO_PRINTF2(_L("Data sink handle is %d"), sinkHandle.DestinationHandle());
1133 // call a custom sink command. doesn't matter what it is, we'd expect it to return KErrNotSupported
1134 // anyway - the point is to ensure CMMFDataSinkHolder::HandleRequest() is called.
1135 // a return of 0 or -5 indicates it has been.
1136 error = iController.CustomCommandSync(sinkHandle, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
1137 INFO_PRINTF2(_L("CustomCommandSync on sinkHandle returned %d"), error);
1138 if (error && error != KErrNotSupported)
1140 ERR_PRINTF1(_L("Unexpected error code returned"));
1141 delete sinkHandlePtr;
1142 return iTestStepResult = EFail;
1146 delete sinkHandlePtr;
1147 return iTestStepResult = EPass;
1150 // ---------------------------
1151 // RTestMmfCtlfrmI0114
1153 // Remove a data sink
1157 RTestMmfCtlfrmI0114* RTestMmfCtlfrmI0114::NewL()
1159 RTestMmfCtlfrmI0114* self = new(ELeave) RTestMmfCtlfrmI0114;
1163 RTestMmfCtlfrmI0114::RTestMmfCtlfrmI0114()
1165 iTestStepName = _L("MM-MMF-CTLFRM-I-0114");
1168 TVerdict RTestMmfCtlfrmI0114::DoTestStepL()
1170 INFO_PRINTF1(_L("remove a data sink"));
1172 TInt error = KErrNone;
1174 _LIT8(KInitData,"TEST");
1176 // add a data sink with a handle
1177 TMMFMessageDestination* sinkHandlePtr = new (ELeave) TMMFMessageDestination();
1178 TMMFMessageDestination& sinkHandle = *sinkHandlePtr;
1180 error = iController.AddDataSink(KTestDataSinkUid, KInitData, sinkHandle);
1183 ERR_PRINTF2(_L("AddDataSink failed, error %d"), error);
1184 delete sinkHandlePtr;
1185 return iTestStepResult = EInconclusive;
1188 // Get log info - we expect "AddDataSinkL Called"
1189 _LIT8(KExpectedResult, "AddDataSinkL Called");
1190 TBuf8<KTextBufLen> memFunctionText;
1192 TUid uid = {KTSIMmfControllerUid};
1193 TMMFMessageDestination handleInfo(uid);
1194 TMMFMessageDestinationPckg messageDest(handleInfo);
1196 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
1199 ERR_PRINTF2(_L("controller CustomCommandSync failed with error %d"), error);
1200 delete sinkHandlePtr;
1201 return iTestStepResult = EInconclusive;
1204 if (memFunctionText != KExpectedResult)
1206 ERR_PRINTF1(_L("Return value did not match expected"));
1207 delete sinkHandlePtr;
1208 return iTestStepResult = EInconclusive;
1211 // now, delete the data sink we just added
1212 error = iController.RemoveDataSink(sinkHandle);
1215 ERR_PRINTF2(_L("RemoveDataSink failed with error %d"), error);
1216 delete sinkHandlePtr;
1217 return iTestStepResult = EInconclusive;
1220 // verify that the data sink is no longer there. try and remove it again, this should
1222 error = iController.RemoveDataSink(sinkHandle);
1225 ERR_PRINTF1(_L("Error : data sink was not removed at first attempt"));
1226 delete sinkHandlePtr;
1227 return iTestStepResult = EInconclusive;
1230 INFO_PRINTF2(_L("Data sink removed (second attempt failed with error %d)"), error);
1233 delete sinkHandlePtr;
1234 return iTestStepResult = EPass;
1237 // ---------------------------
1238 // RTestMmfCtlfrmI0117
1240 // Set / get source config parameters
1244 RTestMmfCtlfrmI0117* RTestMmfCtlfrmI0117::NewL()
1246 RTestMmfCtlfrmI0117* self = new(ELeave) RTestMmfCtlfrmI0117;
1250 RTestMmfCtlfrmI0117::RTestMmfCtlfrmI0117()
1252 iTestStepName = _L("MM-MMF-CTLFRM-I-0117");
1255 TVerdict RTestMmfCtlfrmI0117::DoTestStepL( void )
1257 INFO_PRINTF1(_L("Set / get source config parameters"));
1259 TInt error = KErrNone;
1261 RMMFAudioControllerCustomCommands customCommands(iController);
1263 RArray<TUint> supportedSampleRates;
1264 TRAP(error, customCommands.GetSupportedSourceSampleRatesL(supportedSampleRates));
1267 ERR_PRINTF2(_L("GetSupportedSourceSampleRatesL left, error %d"), error);
1268 return iTestStepResult = EFail;
1270 INFO_PRINTF2(_L("GetSupportedSourceSampleRatesL returned %d entries"), supportedSampleRates.Count());
1272 RArray<TUint> supportedBitRates;
1273 // we expect this to be Not Supported
1274 TRAP(error, customCommands.GetSupportedSourceBitRatesL(supportedBitRates));
1277 ERR_PRINTF2(_L("GetSupportedSourceBitRatesL left, error %d"), error);
1278 if(error != KErrNotSupported)
1279 return iTestStepResult = EFail;
1283 INFO_PRINTF2(_L("GetSupportedSourceBitRatesL returned %d entries"), supportedBitRates.Count());
1286 RArray<TUint> supportedNumChannels;
1287 TRAP(error, customCommands.GetSupportedSourceNumChannelsL(supportedNumChannels));
1290 ERR_PRINTF2(_L("GetSupportedSourceNumChannelsL left, error %d"), error);
1291 return iTestStepResult = EFail;
1293 INFO_PRINTF2(_L("GetSupportedSourceNumChannelsL returned %d entries"), supportedNumChannels.Count());
1295 TUint bitRate = 1000; // 1 Khz
1296 error = customCommands.SetSourceBitRate(bitRate);
1297 INFO_PRINTF2(_L("SetSourceBitRate returned %d"), error);
1298 if (error && error != KErrNotSupported)
1300 ERR_PRINTF2(_L("SetSourceBitRate failed, error %d"), error);
1301 return iTestStepResult = EFail;
1304 TUint sampleRate = 5;
1305 error = customCommands.SetSourceSampleRate(sampleRate);
1306 INFO_PRINTF2(_L("SetSourceSampleRate returned %d"), error);
1307 // Setting source sample rate to a different value
1308 // is tolerated (INC038043) to preserve BC with 6.1
1309 if (error != KErrNone)
1311 ERR_PRINTF3(_L("SetSourceSampleRate failed, error %d, expected %d"), error, KErrAlreadyExists);
1312 return iTestStepResult = EFail;
1315 TUint numChannels = 1;
1316 error = customCommands.SetSourceNumChannels(numChannels);
1317 INFO_PRINTF2(_L("SetSourceNumChannels returned %d"), error);
1318 // Setting number of channels to a different value
1319 // is tolerated (INC038043) to preserve BC with 6.1
1320 if (error && error != KErrNone)
1322 ERR_PRINTF2(_L("SetSourceNumChannels failed, error %d"), error);
1323 return iTestStepResult = EFail;
1326 // EPass if we got here
1327 return iTestStepResult = EPass;
1330 // ---------------------------
1331 // RTestMmfCtlfrmI0118
1333 // Set / get sink config parameters
1337 RTestMmfCtlfrmI0118* RTestMmfCtlfrmI0118::NewL()
1339 RTestMmfCtlfrmI0118* self = new(ELeave) RTestMmfCtlfrmI0118;
1343 RTestMmfCtlfrmI0118::RTestMmfCtlfrmI0118()
1345 iTestStepName = _L("MM-MMF-CTLFRM-I-0118");
1348 TVerdict RTestMmfCtlfrmI0118::DoTestStepL( void )
1350 INFO_PRINTF1(_L("Set / get sink config parameters"));
1352 TInt error = KErrNone;
1354 RMMFAudioControllerCustomCommands customCommands(iController);
1356 RArray<TUint> supportedSampleRates;
1357 TRAP(error, customCommands.GetSupportedSinkSampleRatesL(supportedSampleRates));
1358 if (error != KErrNotSupported)
1360 ERR_PRINTF2(_L("GetSupportedSinkSampleRatesL left with error %d but expected is KErrNotSupported"), error);
1361 return iTestStepResult = EFail;
1363 INFO_PRINTF2(_L("GetSupportedSinkSampleRatesL returned %d entries"), supportedSampleRates.Count());
1365 RArray<TUint> supportedBitRates;
1366 // we expect this to be Not Supported
1367 TRAP(error, customCommands.GetSupportedSinkBitRatesL(supportedBitRates));
1370 ERR_PRINTF2(_L("GetSupportedSinkBitRatesL left, error %d"), error);
1371 if(error != KErrNotSupported)
1372 return iTestStepResult = EFail;
1376 INFO_PRINTF2(_L("GetSupportedSinkBitRatesL returned %d entries"), supportedBitRates.Count());
1379 RArray<TUint> supportedNumChannels;
1380 TRAP(error, customCommands.GetSupportedSinkNumChannelsL(supportedNumChannels));
1381 if (error != KErrNotSupported)
1383 ERR_PRINTF2(_L("GetSupportedSinkNumChannelsL left with error %d but expected is KErrNotSupported"), error);
1384 return iTestStepResult = EFail;
1386 INFO_PRINTF2(_L("GetSupportedSinkNumChannelsL returned %d entries"), supportedNumChannels.Count());
1388 TUint bitRate = 1000; // 1 Khz
1389 error = customCommands.SetSinkBitRate(bitRate);
1390 INFO_PRINTF2(_L("SetSinkBitRate returned %d"), error);
1391 if (error && error != KErrNotSupported)
1393 ERR_PRINTF2(_L("SetSinkBitRate failed, error %d"), error);
1394 return iTestStepResult = EFail;
1397 TUint sampleRate = 5;
1398 error = customCommands.SetSinkSampleRate(sampleRate);
1399 INFO_PRINTF2(_L("SetSinkSampleRate returned %d"), error);
1400 if (error && error != KErrNotSupported)
1402 ERR_PRINTF2(_L("SetSinkSampleRate failed, error %d"), error);
1403 return iTestStepResult = EFail;
1406 TUint numChannels = 1;
1407 error = customCommands.SetSinkNumChannels(numChannels);
1408 INFO_PRINTF2(_L("SetSinkNumChannels returned %d"), error);
1409 if (error && error != KErrNotSupported)
1411 ERR_PRINTF2(_L("SetSinkNumChannels failed, error %d"), error);
1412 return iTestStepResult = EFail;
1415 // EPass if we got here
1416 return iTestStepResult = EPass;
1419 // ---------------------------
1420 // RTestMmfCtlfrmI0119
1422 // Get supported source/sink video types
1426 RTestMmfCtlfrmI0119* RTestMmfCtlfrmI0119::NewL()
1428 RTestMmfCtlfrmI0119* self = new(ELeave) RTestMmfCtlfrmI0119;
1432 RTestMmfCtlfrmI0119::RTestMmfCtlfrmI0119()
1434 iTestStepName = _L("MM-MMF-CTLFRM-I-0119");
1437 TVerdict RTestMmfCtlfrmI0119::DoTestStepL( void )
1439 // NB this is implemented purely for code coverage purposes
1440 INFO_PRINTF1(_L("Get supported source/sink audio/video types"));
1442 // GetSupportedSinkAudioTypes no longer in base class
1443 INFO_PRINTF1(_L("GetSupportedSinkAudioTypes no longer in video controller base class"));
1445 // GetSupportedSinkVideoTypes no longer in base class
1446 INFO_PRINTF1(_L("GetSupportedSinkVideoTypes no longer in video controller base class"));
1448 // GetSupportedSourceAudioTypes no longer supported
1449 INFO_PRINTF1(_L("GetSupportedSourceAudioTypes no longer supported"));
1451 // GetSupportedSourceVideoTypes no longer supported
1452 INFO_PRINTF1(_L("GetSupportedSourceVideoTypes no longer supported"));
1454 // EPass if we got here
1455 return iTestStepResult = EPass;
1458 // ---------------------------
1459 // RTestMmfCtlfrmI0120
1461 // Call display window related methods for video play controller
1465 RTestMmfCtlfrmI0120* RTestMmfCtlfrmI0120::NewL()
1467 RTestMmfCtlfrmI0120* self = new(ELeave) RTestMmfCtlfrmI0120;
1471 RTestMmfCtlfrmI0120::RTestMmfCtlfrmI0120()
1473 iTestStepName = _L("MM-MMF-CTLFRM-I-0120");
1476 TVerdict RTestMmfCtlfrmI0120::DoTestStepL( void )
1478 // NB this is implemented purely for code coverage purposes
1479 INFO_PRINTF1(_L("Call display window related methods for video play controller"));
1481 TInt error = KErrNone;
1483 RMMFVideoPlayControllerCustomCommands playCustomCommands(iController);
1486 error = playCustomCommands.SetDisplayWindow(r, r);
1487 INFO_PRINTF2(_L("SetDisplayWindow returned %d"), error);
1490 if(error != KErrNotSupported)
1491 return iTestStepResult = EFail;
1495 error = playCustomCommands.UpdateDisplayRegion(rg);
1496 INFO_PRINTF2(_L("UpdateDisplayRegion returned %d"), error);
1499 if(error != KErrNotSupported)
1500 return iTestStepResult = EFail;
1503 // EPass if we got here
1504 return iTestStepResult = EPass;
1507 // ---------------------------
1508 // RTestMmfCtlfrmI0121
1510 // Prime (prepare data flow)
1514 RTestMmfCtlfrmI0121* RTestMmfCtlfrmI0121::NewL()
1516 RTestMmfCtlfrmI0121* self = new(ELeave) RTestMmfCtlfrmI0121;
1520 RTestMmfCtlfrmI0121::RTestMmfCtlfrmI0121()
1522 iTestStepName = _L("MM-MMF-CTLFRM-I-0121");
1525 TVerdict RTestMmfCtlfrmI0121::DoTestStepL()
1527 INFO_PRINTF1(_L("Prime a controller"));
1529 TInt error = KErrNone;
1530 TVerdict result = EPass;
1532 error = iController.Prime();
1535 ERR_PRINTF2(_L("Prime failed, error %d"), error);
1536 return iTestStepResult = EFail;
1539 // [ wait for and process the return event from the Custom audio controller ]
1540 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
1541 result = SearchForEvent( primeEvent );
1542 if( result == EFail )
1544 ERR_PRINTF1(_L("Custom audio controller did not return a prime event"));
1545 return iTestStepResult = EFail;
1548 // EPass if we got here
1549 return iTestStepResult = EPass;
1552 // ---------------------------
1553 // RTestMmfCtlfrmI0122
1559 RTestMmfCtlfrmI0122* RTestMmfCtlfrmI0122::NewL()
1561 RTestMmfCtlfrmI0122* self = new(ELeave) RTestMmfCtlfrmI0122;
1565 RTestMmfCtlfrmI0122::RTestMmfCtlfrmI0122()
1567 iTestStepName = _L("MM-MMF-CTLFRM-I-0122");
1570 TVerdict RTestMmfCtlfrmI0122::DoTestStepL()
1572 // Play a controller. Must be primed first
1573 INFO_PRINTF1(_L("Play a controller"));
1575 TInt error = KErrNone;
1576 TVerdict result = EPass;
1578 error = iController.Prime();
1581 ERR_PRINTF2(_L("Prime failed, error %d"), error);
1582 return iTestStepResult = EInconclusive;
1585 // [ wait for and process the return event from the Custom audio controller ]
1586 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
1587 result = SearchForEvent( primeEvent );
1588 if( result == EFail )
1590 ERR_PRINTF1(_L("Custom audio controller did not return a prime event"));
1591 return iTestStepResult = EInconclusive;
1594 error = iController.Play();
1597 ERR_PRINTF2(_L("Play failed, error %d"), error);
1598 return iTestStepResult = EFail;
1601 // wait for an event from the Custom audio controller
1602 TMMFEvent playEvent( KPlayTestId, KErrNone);
1603 result = SearchForEvent( playEvent );
1604 if( result == EFail )
1606 ERR_PRINTF1(_L("Custom audio controller did not return a play event"));
1607 return iTestStepResult = EFail;
1610 // verify that clip is playing : get the position a couple of times
1611 // NB the clip must be at least 1 second long for this to work
1613 TTimeIntervalMicroSeconds clipPos1, clipPos2, clipPos3;
1614 User::After(KGetPositionIntervalLength);
1615 error = iController.GetPosition(clipPos1);
1616 User::After(KGetPositionIntervalLength);
1617 error += iController.GetPosition(clipPos2);
1618 User::After(KGetPositionIntervalLength);
1619 error += iController.GetPosition(clipPos3);
1623 // NB it's cumulative so don't give return value
1624 ERR_PRINTF1(_L("Error : GetPosition failed"));
1625 return iTestStepResult = EInconclusive;
1628 INFO_PRINTF4(_L("Clip positions : %ld %ld %ld"), I64LOW(clipPos1.Int64()), I64LOW(clipPos2.Int64()), I64LOW(clipPos3.Int64()));
1630 if((clipPos1 == clipPos2) && (clipPos2 == clipPos3))
1632 ERR_PRINTF1(_L("Error : clip position not changing"));
1633 return iTestStepResult = EFail;
1636 // EPass if we got here
1637 return iTestStepResult = EPass;
1640 // ---------------------------
1641 // RTestMmfCtlfrmI0123
1647 RTestMmfCtlfrmI0123* RTestMmfCtlfrmI0123::NewL()
1649 RTestMmfCtlfrmI0123* self = new(ELeave) RTestMmfCtlfrmI0123;
1653 RTestMmfCtlfrmI0123::RTestMmfCtlfrmI0123()
1655 iTestStepName = _L("MM-MMF-CTLFRM-I-0123");
1658 TVerdict RTestMmfCtlfrmI0123::DoTestStepL()
1660 // Stop a controller. Must be playing first
1661 INFO_PRINTF1(_L("Stop a controller"));
1663 TInt error = KErrNone;
1664 TVerdict result = EPass;
1666 error = iController.Prime();
1669 ERR_PRINTF2(_L("Prime failed, error %d"), error);
1670 return iTestStepResult = EInconclusive;
1673 // [ wait for and process the return event from the Custom audio controller ]
1674 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
1675 result = SearchForEvent( primeEvent );
1676 if( result == EFail )
1678 ERR_PRINTF1(_L("Custom audio controller did not return a prime event"));
1679 return iTestStepResult = EInconclusive;
1682 error = iController.Play();
1685 ERR_PRINTF2(_L("Play failed, error %d"), error);
1686 return iTestStepResult = EInconclusive;
1689 // get an event from the controller
1690 TMMFEvent playEvent( KPlayTestId, KErrNone);
1691 result = SearchForEvent( playEvent );
1692 if( result == EFail )
1694 ERR_PRINTF1(_L("Custom audio controller did not return a play event"));
1695 return iTestStepResult = EFail;
1698 // verify that clip is playing : get the position a couple of times
1699 // NB the clip must be at least 1.5 seconds long for this to work
1701 TTimeIntervalMicroSeconds clipPos1, clipPos2, clipPos3;
1702 User::After(KGetPositionIntervalLength);
1703 error = iController.GetPosition(clipPos1);
1704 User::After(KGetPositionIntervalLength);
1705 error += iController.GetPosition(clipPos2);
1706 User::After(KGetPositionIntervalLength);
1707 error += iController.GetPosition(clipPos3);
1711 // NB it's cumulative so don't give return value
1712 ERR_PRINTF1(_L("Error : GetPosition failed"));
1713 return iTestStepResult = EInconclusive;
1716 INFO_PRINTF4(_L("Clip positions : %ld %ld %ld"), I64LOW(clipPos1.Int64()), I64LOW(clipPos2.Int64()), I64LOW(clipPos3.Int64()));
1718 if((clipPos1 == clipPos2) && (clipPos2 == clipPos3))
1720 ERR_PRINTF1(_L("Error : clip position not changing"));
1721 return iTestStepResult = EInconclusive;
1724 // now stop the clip. verify that the position is 0 and not changing.
1725 error = iController.Stop();
1728 ERR_PRINTF2(_L("Stop failed, error %d"), error);
1729 return iTestStepResult = EFail;
1732 // verify that clip is stopped : get the position a couple of times
1733 // NB we have to re-prime it first for this to work. If it is still playing,
1734 // the prime will fail
1735 error = iController.Prime();
1738 ERR_PRINTF2(_L("Prime failed, error %d"), error);
1739 return iTestStepResult = EInconclusive;
1742 User::After(KGetPositionIntervalLength);
1743 error = iController.GetPosition(clipPos1);
1744 User::After(KGetPositionIntervalLength);
1745 error += iController.GetPosition(clipPos2);
1746 User::After(KGetPositionIntervalLength);
1747 error += iController.GetPosition(clipPos3);
1751 // NB it's cumulative so don't give return value
1752 ERR_PRINTF1(_L("Error : GetPosition failed"));
1753 return iTestStepResult = EInconclusive;
1756 INFO_PRINTF4(_L("Clip positions : %ld %ld %ld"), I64LOW(clipPos1.Int64()), I64LOW(clipPos2.Int64()), I64LOW(clipPos3.Int64()));
1758 if((clipPos1 != clipPos2) && (clipPos2 != clipPos3))
1760 ERR_PRINTF1(_L("Error : clip position still changing"));
1761 return iTestStepResult = EFail;
1764 if(clipPos3.Int64() != 0)
1766 ERR_PRINTF1(_L("Error : clip position not at start"));
1767 return iTestStepResult = EFail;
1770 // EPass if we got here
1771 return iTestStepResult = EPass;
1774 // ---------------------------
1775 // RTestMmfCtlfrmI0124
1781 RTestMmfCtlfrmI0124* RTestMmfCtlfrmI0124::NewL()
1783 RTestMmfCtlfrmI0124* self = new(ELeave) RTestMmfCtlfrmI0124;
1787 RTestMmfCtlfrmI0124::RTestMmfCtlfrmI0124()
1789 iTestStepName = _L("MM-MMF-CTLFRM-I-0124");
1792 TVerdict RTestMmfCtlfrmI0124::DoTestStepL()
1794 // Pause a controller. Must be playing first
1795 INFO_PRINTF1(_L("Pause a controller"));
1797 TInt error = KErrNone;
1798 TVerdict result = EPass;
1800 error = iController.Prime();
1803 ERR_PRINTF2(_L("Prime failed, error %d"), error);
1804 return iTestStepResult = EInconclusive;
1807 // [ wait for and process the return event from the Custom audio controller ]
1808 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
1809 result = SearchForEvent( primeEvent );
1810 if( result == EFail )
1812 ERR_PRINTF1(_L("Custom audio controller did not return a prime event"));
1813 return iTestStepResult = EInconclusive;
1816 error = iController.Play();
1819 ERR_PRINTF2(_L("Play failed, error %d"), error);
1820 return iTestStepResult = EInconclusive;
1823 // get an event from the Custom audio controller
1824 TMMFEvent playEvent( KPlayTestId, KErrNone);
1825 result = SearchForEvent( playEvent );
1826 if( result == EFail )
1828 ERR_PRINTF1(_L("Custom audio controller did not return a play event"));
1829 return iTestStepResult = EFail;
1832 // verify that clip is playing : get the position a couple of times
1833 // NB the clip must be at least 1 second long for this to work
1835 TTimeIntervalMicroSeconds clipPos1, clipPos2, clipPos3;
1836 User::After(KGetPositionIntervalLength);
1837 error = iController.GetPosition(clipPos1);
1838 User::After(KGetPositionIntervalLength);
1839 error += iController.GetPosition(clipPos2);
1840 User::After(KGetPositionIntervalLength);
1841 error += iController.GetPosition(clipPos3);
1845 // NB it's cumulative so don't give return value
1846 ERR_PRINTF1(_L("Error : GetPosition failed"));
1847 return iTestStepResult = EInconclusive;
1850 INFO_PRINTF4(_L("Clip positions : %ld %ld %ld"), I64LOW(clipPos1.Int64()), I64LOW(clipPos2.Int64()), I64LOW(clipPos3.Int64()));
1852 if((clipPos1 == clipPos2) || (clipPos2 == clipPos3))
1854 ERR_PRINTF1(_L("Error : clip position not changing"));
1855 return iTestStepResult = EInconclusive;
1858 // now pause the clip. verify that the position is not 0 and not changing.
1859 error = iController.Pause();
1862 ERR_PRINTF2(_L("Pause failed, error %d"), error);
1863 return iTestStepResult = EFail;
1866 // [ wait for and process the return event from the Custom audio controller ]
1867 TMMFEvent pauseEvent( KPauseTestId, KErrNone);
1868 result = SearchForEvent( pauseEvent );
1869 if( result == EFail )
1871 ERR_PRINTF1(_L("Custom audio controller did not return a pause event"));
1872 return iTestStepResult = EFail;
1875 // verify that clip is paused : get the position a couple of times
1876 User::After(KGetPositionIntervalLength);
1877 error = iController.GetPosition(clipPos1);
1878 User::After(KGetPositionIntervalLength);
1879 error += iController.GetPosition(clipPos2);
1880 User::After(KGetPositionIntervalLength);
1881 error += iController.GetPosition(clipPos3);
1885 // NB it's cumulative so don't give return value
1886 ERR_PRINTF1(_L("Error : GetPosition failed"));
1887 return iTestStepResult = EInconclusive;
1890 INFO_PRINTF4(_L("Clip positions : %ld %ld %ld"), I64LOW(clipPos1.Int64()), I64LOW(clipPos2.Int64()), I64LOW(clipPos3.Int64()));
1892 if((clipPos1 != clipPos2) || (clipPos2 != clipPos3))
1894 ERR_PRINTF1(_L("Error : clip position still changing"));
1895 return iTestStepResult = EFail;
1898 if(clipPos2.Int64() == 0)
1900 ERR_PRINTF1(_L("Error : clip position is zero"));
1901 return iTestStepResult = EFail;
1904 // EPass if we got here
1905 return iTestStepResult = EPass;
1908 // ---------------------------
1909 // RTestMmfCtlfrmI0125
1911 // Assign priority to controller
1915 RTestMmfCtlfrmI0125* RTestMmfCtlfrmI0125::NewL()
1917 RTestMmfCtlfrmI0125* self = new(ELeave) RTestMmfCtlfrmI0125;
1921 RTestMmfCtlfrmI0125::RTestMmfCtlfrmI0125()
1923 iTestStepName = _L("MM-MMF-CTLFRM-I-0125");
1926 TVerdict RTestMmfCtlfrmI0125::DoTestStepL()
1928 INFO_PRINTF1(_L("Assign priority to controller"));
1929 TInt error = KErrNone;
1931 // set priorities - 1 higher than 2
1932 iSettings.iPriority = 10;
1933 error = iController1.SetPrioritySettings(iSettings);
1936 ERR_PRINTF2(_L("controller1 SetPrioritySettings failed, error %d"), error);
1937 return iTestStepResult = EInconclusive;
1940 iSettings.iPriority = -10;
1941 error = iController2.SetPrioritySettings(iSettings);
1944 ERR_PRINTF2(_L("controller2 SetPrioritySettings failed, error %d"), error);
1945 return iTestStepResult = EInconclusive;
1949 error = iController1.Prime();
1952 ERR_PRINTF2(_L("controller1 prime failed, error %d"), error);
1953 return iTestStepResult = EInconclusive;
1955 error = iController2.Prime();
1958 ERR_PRINTF2(_L("controller2 prime failed, error %d"), error);
1959 return iTestStepResult = EInconclusive;
1962 // at last we are ready to do the test...
1963 // play both controllers. give the first time to start before playing the second.
1964 // we should get an error.
1965 error = iController1.Play();
1968 ERR_PRINTF2(_L("iController1 play failed, error %d"), error);
1969 return iTestStepResult = EInconclusive;
1971 // wait a while, to give it chance to play
1972 const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1973 INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1974 User::After(KPlayPosition32);
1975 error = iController2.Play();
1978 ERR_PRINTF2(_L("iController2 play failed, error %d"), error);
1979 return iTestStepResult = EInconclusive;
1982 // search for a KErrInUse from anywhere on controller 2
1983 // this is from Audio Policy
1984 TMMFEvent inUseEvent( KMMFEventCategoryPlaybackComplete, KErrInUse );
1986 result = SearchForEvent( inUseEvent, 2 );
1987 if( result == EFail )
1989 ERR_PRINTF1(_L("Audio Policy did not return a KErrInUse event"));
1990 return iTestStepResult = EFail;
1992 INFO_PRINTF1(_L("Audio Policy returned a KErrInUse event"));
1994 // check that the position on controller1 is actually changing
1995 // and that the position on controller2 isn't
1997 // NB this may fail - if iController2 is actually stopped. in that case
1998 // we just have to check that GetPosition returns an error
1999 TTimeIntervalMicroSeconds clipPos1a, clipPos1b, clipPos1c;
2000 TTimeIntervalMicroSeconds clipPos2a, clipPos2b, clipPos2c;
2001 User::After(KGetPositionIntervalLength);
2002 error = iController1.GetPosition(clipPos1a);
2004 TInt ctrl2Error=KErrNone;
2005 ctrl2Error = iController2.GetPosition(clipPos2a);
2008 ERR_PRINTF1(_L("Controller 2 GetPosition returned an Error"));
2009 return iTestStepResult = EFail;
2012 User::After(KGetPositionIntervalLength);
2013 error += iController1.GetPosition(clipPos1b);
2014 ctrl2Error = iController2.GetPosition(clipPos2b);
2017 ERR_PRINTF1(_L("Controller 2 GetPosition returned an Error"));
2018 return iTestStepResult = EFail;
2021 User::After(KGetPositionIntervalLength);
2022 error += iController1.GetPosition(clipPos1c);
2023 ctrl2Error = iController2.GetPosition(clipPos2c);
2026 ERR_PRINTF1(_L("Controller 2 GetPosition returned an Error"));
2027 return iTestStepResult = EFail;
2031 // NB it's cumulative so don't give return value
2032 ERR_PRINTF1(_L("Error : GetPosition failed"));
2033 return iTestStepResult = EInconclusive;
2036 INFO_PRINTF4(_L("Clip positions 1 : %d %d %d"), I64LOW(clipPos1a.Int64()), I64LOW(clipPos1b.Int64()), I64LOW(clipPos1c.Int64()));
2037 INFO_PRINTF4(_L("Clip positions 2 : %d %d %d"), I64LOW(clipPos2a.Int64()), I64LOW(clipPos2b.Int64()), I64LOW(clipPos2c.Int64()));
2039 if((clipPos1a == clipPos1b) || (clipPos1b == clipPos1c))
2041 ERR_PRINTF1(_L("Error : clip position 1 not changing"));
2042 return iTestStepResult = EFail;
2044 if(clipPos2a != clipPos2b || clipPos2b != clipPos2c)
2046 ERR_PRINTF1(_L("Controller 2 position changed"));
2047 return iTestStepResult = EFail;
2049 // ok - now do the same the other way up - set controller 2 priority higher than
2051 iController1.Stop();
2052 iController2.Stop();
2055 iSettings.iPriority = -10;
2056 error = iController1.SetPrioritySettings(iSettings);
2059 ERR_PRINTF2(_L("controller1 SetPrioritySettings failed, error %d"), error);
2060 return iTestStepResult = EInconclusive;
2063 iSettings.iPriority = 10;
2064 error = iController2.SetPrioritySettings(iSettings);
2067 ERR_PRINTF2(_L("controller2 SetPrioritySettings failed, error %d"), error);
2068 return iTestStepResult = EInconclusive;
2072 error = iController1.Prime();
2075 ERR_PRINTF2(_L("controller1 prime failed, error %d"), error);
2076 return iTestStepResult = EInconclusive;
2078 error = iController2.Prime();
2081 ERR_PRINTF2(_L("controller2 prime failed, error %d"), error);
2082 return iTestStepResult = EInconclusive;
2085 // play both controllers. give the first time to start before playing the second.
2086 // we should get an error.
2087 error = iController1.Play();
2090 ERR_PRINTF2(_L("iController1 play failed, error %d"), error);
2091 return iTestStepResult = EInconclusive;
2093 // wait a while, to give it chance to play
2094 INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
2095 User::After(KPlayPosition32);
2096 error = iController2.Play();
2099 ERR_PRINTF2(_L("iController2 play failed, error %d"), error);
2100 return iTestStepResult = EInconclusive;
2103 // *** Test Changed - originally searched for a KErrAccessDenied
2104 // from anywhere on controller 1
2105 // BUT since controller 1 is already playing, this isn't appropriate
2106 // Instead we search for a KErrCancel event from controller 1;
2107 // this should be passed through the Custom Audio Controller and arrive
2108 // with uid KMMFEventCategoryPlaybackComplete
2111 // Search for the event caused by playing the higher priority controller
2112 inUseEvent.iEventType = KMMFEventCategoryPlaybackComplete;
2113 result = SearchForEvent( inUseEvent, 1 );
2114 if( result == EFail )
2116 ERR_PRINTF1(_L("Audio Policy did not return a KErrInUse event"));
2117 return iTestStepResult = EFail;
2119 INFO_PRINTF1(_L("Audio Policy returned a KErrInUse event"));
2122 // check that the position on controller2 is actually changing
2123 // and that the position on controller1 isn't
2124 User::After(KGetPositionIntervalLength);
2126 TInt ctrlError1=KErrNone;
2127 ctrlError1 = iController1.GetPosition(clipPos1a);
2130 ERR_PRINTF1(_L("Controller 1 GetPosition returned an Error"));
2131 return iTestStepResult = EFail;
2134 error = iController2.GetPosition(clipPos2a);
2135 User::After(KGetPositionIntervalLength);
2136 ctrlError1 = iController1.GetPosition(clipPos1b);
2139 ERR_PRINTF1(_L("Controller 1 GetPosition returned an Error"));
2140 return iTestStepResult = EFail;
2143 error += iController2.GetPosition(clipPos2b);
2144 User::After(KGetPositionIntervalLength);
2145 ctrlError1 = iController1.GetPosition(clipPos1c);
2148 ERR_PRINTF1(_L("Controller 1 GetPosition returned an Error"));
2149 return iTestStepResult = EFail;
2152 error += iController2.GetPosition(clipPos2c);
2156 // NB it's cumulative so don't give return value
2157 ERR_PRINTF1(_L("Error : GetPosition failed"));
2158 return iTestStepResult = EInconclusive;
2161 INFO_PRINTF4(_L("Clip positions 1 : %d %d %d"), I64LOW(clipPos1a.Int64()), I64LOW(clipPos1b.Int64()), I64LOW(clipPos1c.Int64()));
2162 INFO_PRINTF4(_L("Clip positions 2 : %d %d %d"), I64LOW(clipPos2a.Int64()), I64LOW(clipPos2b.Int64()), I64LOW(clipPos2c.Int64()));
2164 if((clipPos2a == clipPos2b) || (clipPos2b == clipPos2c))
2166 ERR_PRINTF1(_L("Error : clip position 2 not changing"));
2167 return iTestStepResult = EFail;
2169 if(clipPos1a != clipPos1b || clipPos1b != clipPos1c)
2171 ERR_PRINTF1(_L("Controller 1 position changed"));
2172 return iTestStepResult = EFail;
2174 return iTestStepResult = EPass;
2178 // ---------------------------
2179 // RTestMmfCtlfrmI0128
2185 RTestMmfCtlfrmI0128* RTestMmfCtlfrmI0128::NewL()
2187 RTestMmfCtlfrmI0128* self = new(ELeave) RTestMmfCtlfrmI0128;
2191 RTestMmfCtlfrmI0128::RTestMmfCtlfrmI0128()
2193 iTestStepName = _L("MM-MMF-CTLFRM-I-0128");
2196 TVerdict RTestMmfCtlfrmI0128::DoTestStepL()
2199 INFO_PRINTF1(_L("Get Position"));
2201 TInt error = KErrNone;
2202 TVerdict result = EPass;
2204 // 1. before playing, verify that GetPosition returns start
2205 // 2. set to known position, verify that GetPosition returns correct position
2206 // 3. set to start, play for N seconds, check position is approx as expected
2208 error = iController.Prime();
2211 ERR_PRINTF2(_L("Prime failed, error %d"), error);
2212 return iTestStepResult = EInconclusive;
2215 // [ wait for and process the return event from the Custom audio controller ]
2216 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
2217 result = SearchForEvent( primeEvent );
2218 if( result == EFail )
2220 ERR_PRINTF1(_L("Custom audio controller did not return a prime event"));
2221 return iTestStepResult = EInconclusive;
2224 // 1. verify that clip is at position 0
2225 TTimeIntervalMicroSeconds clipPos;
2226 error = iController.GetPosition(clipPos);
2230 ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);
2231 return iTestStepResult = EFail;
2234 INFO_PRINTF2(_L("Clip position : %ld"), I64LOW(clipPos.Int64()));
2235 if(clipPos.Int64() != 0)
2237 ERR_PRINTF1(_L("Error : clip position not at start"));
2238 return iTestStepResult = EFail;
2241 // 2. set position and verify that clip is there
2242 // NB allow for resolution of the controller itself
2243 const TTimeIntervalMicroSeconds KPlayPosition(2000000);
2244 const TTimeIntervalMicroSeconds KPlayPositionPlusError(3000000);
2245 const TTimeIntervalMicroSeconds KPlayPositionMinusError(1000000); // allow +/1 sec
2246 const TTimeIntervalMicroSeconds32 KPlayPosition32 = 2000000L; // for User::After
2247 error = iController.SetPosition(KPlayPosition);
2250 ERR_PRINTF2(_L("SetPosition failed, error %d"), error);
2251 return iTestStepResult = EInconclusive;
2254 error = iController.GetPosition(clipPos);
2257 ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);
2258 return iTestStepResult = EFail;
2261 INFO_PRINTF3(_L("Clip position : %ld Expected : %ld"), I64LOW(clipPos.Int64()), I64LOW(KPlayPosition.Int64()));
2262 if( (clipPos < (KPlayPositionMinusError)) || (clipPos > (KPlayPositionPlusError)) )
2264 ERR_PRINTF1(_L("Error : clip position not set correctly"));
2265 return iTestStepResult = EFail;
2268 // 3. set position to start, play clip for a time span, and verify that its position is approx. correct
2269 const TTimeIntervalMicroSeconds KStartPosition(0);
2270 error = iController.SetPosition(KStartPosition);
2273 ERR_PRINTF2(_L("SetPosition failed, error %d"), error);
2274 return iTestStepResult = EInconclusive;
2277 error = iController.GetPosition(clipPos);
2280 ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);
2281 return iTestStepResult = EFail;
2284 INFO_PRINTF2(_L("Clip position : %ld"), I64LOW(clipPos.Int64()));
2285 if(clipPos != KStartPosition)
2287 ERR_PRINTF1(_L("Error : clip position not at start"));
2288 return iTestStepResult = EFail;
2291 error = iController.Play();
2294 ERR_PRINTF2(_L("Play failed, error %d"), error);
2295 return iTestStepResult = EInconclusive;
2297 TMMFEvent playEvent( KPlayTestId, KErrNone);
2298 result = SearchForEvent( playEvent );
2299 if( result == EFail )
2301 ERR_PRINTF1(_L("Custom audio controller did not return a play event"));
2302 return iTestStepResult = EInconclusive;
2305 TTimeIntervalMicroSeconds clipPosStart;
2306 error = iController.GetPosition(clipPosStart);
2309 ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);
2310 return iTestStepResult = EInconclusive;
2313 INFO_PRINTF2(_L("Clip position : %ld"), I64LOW(clipPosStart.Int64()));
2315 // wait, then get pos again
2316 User::After(KPlayPosition32);
2318 error = iController.GetPosition(clipPos);
2321 ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);
2322 return iTestStepResult = EFail;
2325 TTimeIntervalMicroSeconds clipPosPlayedFor = clipPos;
2326 clipPosPlayedFor = clipPosPlayedFor.Int64() - clipPosStart.Int64();
2328 TTimeIntervalMicroSeconds clipPosExpected = KPlayPosition;
2329 clipPosExpected = clipPosExpected.Int64() + clipPosStart.Int64();
2331 INFO_PRINTF3(_L("Clip position : %ld Expected : %ld"), I64LOW(clipPos.Int64()), I64LOW(clipPosExpected.Int64()));
2332 if( (clipPosPlayedFor < (KPlayPositionMinusError)) || (clipPosPlayedFor > (KPlayPositionPlusError)) )
2334 ERR_PRINTF1(_L("Error : clip position not correct"));
2335 return iTestStepResult = EFail;
2338 // EPass if we got here
2339 return iTestStepResult = EPass;
2342 // ---------------------------
2343 // RTestMmfCtlfrmI0129
2349 RTestMmfCtlfrmI0129* RTestMmfCtlfrmI0129::NewL()
2351 RTestMmfCtlfrmI0129* self = new(ELeave) RTestMmfCtlfrmI0129;
2355 RTestMmfCtlfrmI0129::RTestMmfCtlfrmI0129()
2357 iTestStepName = _L("MM-MMF-CTLFRM-I-0129");
2360 TVerdict RTestMmfCtlfrmI0129::DoTestStepL()
2363 INFO_PRINTF1(_L("Set Position"));
2365 TInt error = KErrNone;
2366 TVerdict result = EPass;
2368 // set to known position, verify that GetPosition returns correct position
2370 error = iController.Prime();
2373 ERR_PRINTF2(_L("Prime failed, error %d"), error);
2374 return iTestStepResult = EInconclusive;
2377 // [ wait for and process the return event from the Custom audio controller ]
2378 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
2379 result = SearchForEvent( primeEvent );
2380 if( result == EFail )
2382 ERR_PRINTF1(_L("Custom audio controller did not return a prime event"));
2383 return iTestStepResult = EInconclusive;
2386 // 2. set position and verify that clip is there
2387 // NB allow for resolution of the controller itself
2388 const TTimeIntervalMicroSeconds KPlayPosition(2000000);
2389 const TTimeIntervalMicroSeconds KPlayPositionPlusError(2500000);
2390 const TTimeIntervalMicroSeconds KPlayPositionMinusError(1500000); // allow +/-0.5 sec
2391 error = iController.SetPosition(KPlayPosition);
2394 ERR_PRINTF2(_L("SetPosition failed, error %d"), error);
2395 return iTestStepResult = EFail;
2398 TTimeIntervalMicroSeconds clipPos;
2399 error = iController.GetPosition(clipPos);
2402 ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);
2403 return iTestStepResult = EInconclusive;
2406 INFO_PRINTF3(_L("Clip position : %ld Expected : %ld"), I64LOW(clipPos.Int64()), I64LOW(KPlayPosition.Int64()));
2407 if( (clipPos < (KPlayPositionMinusError)) || (clipPos > (KPlayPositionPlusError)) )
2409 ERR_PRINTF1(_L("Error : clip position not set correctly"));
2410 return iTestStepResult = EFail;
2413 // EPass if we got here
2414 return iTestStepResult = EPass;
2417 // ---------------------------
2418 // RTestMmfCtlfrmI0131
2424 RTestMmfCtlfrmI0131* RTestMmfCtlfrmI0131::NewL()
2426 RTestMmfCtlfrmI0131* self = new(ELeave) RTestMmfCtlfrmI0131;
2430 RTestMmfCtlfrmI0131::RTestMmfCtlfrmI0131()
2432 iTestStepName = _L("MM-MMF-CTLFRM-I-0131");
2435 TVerdict RTestMmfCtlfrmI0131::DoTestStepL()
2437 INFO_PRINTF1(_L("Reset"));
2439 TInt error = KErrNone;
2441 // reset the controller; verify that source and sink are no longer present, and that
2442 // it is not primed.
2444 error = iController.Reset();
2447 ERR_PRINTF2(_L("Error : Reset failed, error %d"), error);
2448 return iTestStepResult = EFail;
2451 // try and play : we should get an error KErrNotReady
2452 error = iController.Play();
2453 if(error != KErrNotReady)
2455 ERR_PRINTF2(_L("Error : play returned unexpected code %d"), error);
2456 return iTestStepResult = EFail;
2458 INFO_PRINTF1(_L("Attempt to play controller failed with KErrNotReady"));
2460 // try and remove data source : we should get an error KErrNotFound
2461 TMMFMessageDestination& sourceHandle = *iSourceHandlePtr;
2462 error = iController.RemoveDataSource(sourceHandle);
2463 if(error != KErrNotFound)
2465 ERR_PRINTF2(_L("Error : remove data source returned unexpected code %d"), error);
2466 return iTestStepResult = EFail;
2468 INFO_PRINTF1(_L("Attempt to remove data source failed with KErrNotFound"));
2470 // try and remove data sink : we should get an error KErrNotFound
2471 TMMFMessageDestination& sinkHandle = *iSinkHandlePtr;
2472 error = iController.RemoveDataSink(sinkHandle);
2473 if(error != KErrNotFound)
2475 ERR_PRINTF2(_L("Error : remove data sink returned unexpected code %d"), error);
2476 return iTestStepResult = EFail;
2478 INFO_PRINTF1(_L("Attempt to remove data sink failed with KErrNotFound"));
2480 // EPass if we got here
2481 return iTestStepResult = EPass;
2484 // ---------------------------
2485 // RTestMmfCtlfrmI0132
2491 RTestMmfCtlfrmI0132* RTestMmfCtlfrmI0132::NewL()
2493 RTestMmfCtlfrmI0132* self = new(ELeave) RTestMmfCtlfrmI0132;
2497 RTestMmfCtlfrmI0132::RTestMmfCtlfrmI0132()
2499 iTestStepName = _L("MM-MMF-CTLFRM-I-0132");
2502 TVerdict RTestMmfCtlfrmI0132::DoTestStepL()
2505 INFO_PRINTF1(_L("Close"));
2507 TInt error = KErrNone;
2509 // close the controller; verify that source and sink are no longer present, and that
2510 // it is not primed.
2512 iController.Close();
2515 // try and prime : we should get an error KErrNotReady
2516 error = iController.Prime();
2517 if(error != KErrNotReady)
2519 ERR_PRINTF2(_L("Error : prime returned unexpected code %d"), error);
2520 return iTestStepResult = EFail;
2522 INFO_PRINTF1(_L("Attempt to prime controller failed with KErrNotReady"));
2523 // try and play : we should get an error KErrNotReady
2524 error = iController.Play();
2525 if(error != KErrNotReady)
2527 ERR_PRINTF2(_L("Error : play returned unexpected code %d"), error);
2528 return iTestStepResult = EFail;
2530 INFO_PRINTF1(_L("Attempt to play controller failed with KErrNotReady"));
2532 // try and remove data source : we should get an error KErrNotReady
2533 TMMFMessageDestination& sourceHandle = *iSourceHandlePtr;
2534 error = iController.RemoveDataSource(sourceHandle);
2535 if(error != KErrNotReady)
2537 ERR_PRINTF2(_L("Error : remove data source returned unexpected code %d"), error);
2538 return iTestStepResult = EFail;
2540 INFO_PRINTF1(_L("Attempt to remove data source failed with KErrNotReady"));
2542 // try and remove data sink : we should get an error KErrNotReady
2543 TMMFMessageDestination& sinkHandle = *iSinkHandlePtr;
2544 error = iController.RemoveDataSink(sinkHandle);
2545 if(error != KErrNotReady)
2547 ERR_PRINTF2(_L("Error : remove data sink returned unexpected code %d"), error);
2548 return iTestStepResult = EFail;
2550 INFO_PRINTF1(_L("Attempt to remove data sink failed with KErrNotReady"));
2552 // EPass if we got here
2553 return iTestStepResult = EPass;
2556 // ---------------------------
2557 // RTestMmfCtlfrmI0141
2559 // Event notification
2563 RTestMmfCtlfrmI0141* RTestMmfCtlfrmI0141::NewL()
2565 RTestMmfCtlfrmI0141* self = new(ELeave) RTestMmfCtlfrmI0141;
2569 RTestMmfCtlfrmI0141::RTestMmfCtlfrmI0141()
2571 iTestStepName = _L("MM-MMF-CTLFRM-I-0141");
2574 TVerdict RTestMmfCtlfrmI0141::DoTestStepL()
2576 // NB : if event search is disabled, we can't run this test - but unlike other
2577 // tests which can pass without SearchForEvent being called, this one can't.
2578 #ifdef EVENT_SEARCH_DISABLED
2579 ERR_PRINTF1(_L("SearchForEvent disabled, we can't run this test"));
2580 return iTestStepResult = EInconclusive;
2583 INFO_PRINTF1(_L("Receive Events"));
2585 TInt error = KErrNone;
2586 TVerdict result = EPass;
2588 error = iController.Prime();
2591 ERR_PRINTF2(_L("Prime failed, error %d"), error);
2592 return iTestStepResult = EFail;
2595 // SearchForEvent() calls ReceiveEvents() and waits until the event is received
2597 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
2598 result = SearchForEvent( primeEvent );
2599 if( result != EPass )
2601 ERR_PRINTF1(_L("Event request did not find the event"));
2602 return iTestStepResult = result;
2605 // we pass if we receive the event
2606 INFO_PRINTF1(_L("Event request succeeded"));
2608 // EPass if we got here
2609 return iTestStepResult = EPass;
2611 #endif // EVENT_SEARCH_DISABLED
2614 // ---------------------------
2615 // RTestMmfCtlfrmI0142
2617 // Cancel event notification
2621 RTestMmfCtlfrmI0142* RTestMmfCtlfrmI0142::NewL()
2623 RTestMmfCtlfrmI0142* self = new(ELeave) RTestMmfCtlfrmI0142;
2627 RTestMmfCtlfrmI0142::RTestMmfCtlfrmI0142()
2629 iTestStepName = _L("MM-MMF-CTLFRM-I-0142");
2632 // SearchForEventWithCancel() is a modified version of SearchForEvent() which
2633 // calls ReceiveEvents() but then calls CancelReceiveEvents() before waiting for the request.
2634 // It will return EPass if, and only if, the request times out.
2635 TVerdict RTestMmfCtlfrmI0142::SearchForEventWithCancel( TMMFEvent& aEvent )
2637 TVerdict result = EPass;
2639 TRequestStatus timerStatus;
2640 TRequestStatus eventStatus;
2643 TInt err = myTimer.CreateLocal();
2646 ERR_PRINTF1(_L("Error : could not create local timer in SearchForEventWithCancel"));
2650 // NOTE. This test is somewhat spurious - we cannot call ReceiveEvents() without getting
2651 // an event back even if we call ReceiveEvents() straight afterwards.
2653 // Therefore we don't call ReceiveEvents() here. Instead we call
2654 // CancelEvents() straight away, and set eventStatus to KRequestPending to ensure we get
2655 // a timeout from the 'request'.
2657 // This is still a valid test as long as we precede it in DoTestStepL() with a call to
2658 // SearchForEvent() to show that the event mechanism is working.
2660 TMMFEventPckg receivedEvent;
2662 // event values for audio controller testing
2663 const TInt KDelay = 1000000;
2664 const TInt KMaxRetries = 1;
2666 // for KMaxRetries attempt to find the event
2667 for( TInt retries = 0; retries < KMaxRetries; retries++ )
2669 eventStatus = KRequestPending;
2670 // now cancel receive events before we have a chance to receive any!
2671 CancelReceivedEvents();
2673 // start breakout timer to escape
2674 myTimer.After( timerStatus, KDelay );
2675 // wait for an event to mature
2676 User::WaitForRequest( eventStatus, timerStatus );
2678 // fail if we get an event. pass if we timeout
2679 if( IsTimeOut( eventStatus ))
2681 CancelReceivedEvents();
2685 if( IsSoughtEvent( aEvent, receivedEvent ) )
2689 // set status to FAIL since we have found the event
2694 // we've received an event other than the one expected.
2695 // we aren't expecting to receive events at all, so this too is a fail
2704 TVerdict RTestMmfCtlfrmI0142::DoTestStepL()
2706 // NB : if event search is disabled, we can't run this test - but unlike other
2707 // tests which can pass without SearchForEvent being called, this one can't.
2708 #ifdef EVENT_SEARCH_DISABLED
2709 ERR_PRINTF1(_L("SearchForEvent disabled, we can't run this test"));
2710 return iTestStepResult = EInconclusive;
2713 INFO_PRINTF1(_L("Cancel receive events"));
2715 TInt error = KErrNone;
2716 TVerdict result = EPass;
2718 error = iController.Prime();
2721 ERR_PRINTF2(_L("Prime failed, error %d"), error);
2722 return iTestStepResult = EFail;
2725 // Get an event first, to ensure that the mechanism is working.
2726 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
2727 result = SearchForEvent( primeEvent );
2728 if( result != EPass )
2730 ERR_PRINTF1(_L("First event request timed out"));
2731 return iTestStepResult = result;
2733 INFO_PRINTF1(_L("First event request succeeded"));
2735 // SearchForEventWithCancel() is an override which doesn't actually get an event at all.
2736 TMMFEvent primeEvent2( KPrimeTestId, KErrNone);
2737 result = SearchForEventWithCancel( primeEvent2 );
2738 if( result != EPass )
2740 ERR_PRINTF1(_L("Second event request did NOT timeout"));
2741 return iTestStepResult = result;
2744 // we pass if we don't receive an event
2745 INFO_PRINTF1(_L("Second event request timed out"));
2747 // EPass if we got here
2748 return iTestStepResult = EPass;
2750 #endif // EVENT_SEARCH_DISABLED
2753 // ---------------------------
2754 // RTestMmfCtlfrmI0143
2756 // Custom commands (synchronous)
2760 RTestMmfCtlfrmI0143* RTestMmfCtlfrmI0143::NewL()
2762 RTestMmfCtlfrmI0143* self = new(ELeave) RTestMmfCtlfrmI0143;
2766 RTestMmfCtlfrmI0143::RTestMmfCtlfrmI0143()
2768 iTestStepName = _L("MM-MMF-CTLFRM-I-0143");
2771 TVerdict RTestMmfCtlfrmI0143::DoTestStepL()
2773 INFO_PRINTF1(_L("Custom Command (sync)"));
2775 TInt error = KErrNone;
2777 TUid uid = {KTSIMmfControllerUid};
2778 TMMFMessageDestination handleInfo(uid);
2779 TMMFMessageDestinationPckg messageDest(handleInfo);
2781 // call CustomCommandSync
2782 error = iController.CustomCommandSync(messageDest, KDummyFunc1, KNullDesC8, KNullDesC8);
2783 if(error == KDummyFunc1Return)
2787 ERR_PRINTF2(_L("CustomCommandSync KDummyFunc1 returned unexpected value %d"), error);
2788 return iTestStepResult = EFail;
2790 INFO_PRINTF2(_L("CustomCommandSync KDummyFunc1 returned expected value %d"), KDummyFunc1Return);
2792 // now call the log - to test CustomCommandSync with aDataFrom
2793 _LIT8(KExpectedResult, "DummyFunc1 Called");
2794 TBuf8<KTextBufLen> memFunctionText;
2796 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
2799 ERR_PRINTF2(_L("CustomCommandSync failed with error %d"), error);
2800 return iTestStepResult = EFail;
2803 TBuf<KTextBufLen> memFunctionText16;
2804 memFunctionText16.SetMax();
2805 memFunctionText16.Fill(0x0);
2806 memFunctionText16.Copy(memFunctionText);
2807 INFO_PRINTF2(_L("Log : %S"), &memFunctionText16);
2809 if (memFunctionText != KExpectedResult)
2811 ERR_PRINTF1(_L("Return value did not match expected"));
2812 return iTestStepResult = EFail;
2815 // this is simply to ensure that all variations of ReadDataNFromClient*() are called
2816 // SetControllerMode() in TSI_MmfController does this.
2817 error = iController.CustomCommandSync(messageDest, KModeFunction, KNullDesC8, KNullDesC8, memFunctionText);
2820 ERR_PRINTF2(_L("CustomCommandSync failed with error %d"), error);
2821 return iTestStepResult = EFail;
2823 // now call the log - to test CustomCommandSync with aDataFrom
2824 _LIT8(KExpectedResultModePass, "SetControllerMode completed successfully");
2825 error = iController.CustomCommandSync(messageDest, KLogFunction, KNullDesC8, KNullDesC8, memFunctionText);
2828 ERR_PRINTF2(_L("CustomCommandSync failed with error %d"), error);
2829 return iTestStepResult = EFail;
2831 memFunctionText16.SetMax();
2832 memFunctionText16.Fill(0x0);
2833 memFunctionText16.Copy(memFunctionText);
2834 INFO_PRINTF2(_L("Log : %S"), &memFunctionText16);
2836 if (memFunctionText != KExpectedResultModePass)
2837 return iTestStepResult = EFail;
2839 return iTestStepResult = EPass;
2842 // ---------------------------
2843 // RTestMmfCtlfrmI0144
2845 // Custom commands (asynchronous)
2849 RTestMmfCtlfrmI0144* RTestMmfCtlfrmI0144::NewL()
2851 RTestMmfCtlfrmI0144* self = new(ELeave) RTestMmfCtlfrmI0144;
2855 RTestMmfCtlfrmI0144::RTestMmfCtlfrmI0144()
2857 iTestStepName = _L("MM-MMF-CTLFRM-I-0144");
2860 TVerdict RTestMmfCtlfrmI0144::DoTestStepL()
2862 INFO_PRINTF1(_L("Custom Command (async)"));
2864 TInt error = KErrNone;
2866 TUid uid = {KTSIMmfControllerUid};
2867 TMMFMessageDestination handleInfo(uid);
2868 TMMFMessageDestinationPckg messageDest(handleInfo);
2870 // call CustomCommandAsync
2871 const TInt KGuardTimerValue = 5000000; // give it 5 sec timeout
2873 TRequestStatus timerStatus;
2874 TRequestStatus controllerStatus;
2875 guardTimer.CreateLocal();
2877 iController.CustomCommandAsync(messageDest, KDummyFunc1, KNullDesC8, KNullDesC8, controllerStatus);
2878 guardTimer.After(timerStatus, KGuardTimerValue);
2879 User::WaitForRequest(controllerStatus, timerStatus);
2880 guardTimer.Cancel();
2883 if(controllerStatus == KRequestPending)
2885 // request timed out
2886 ERR_PRINTF1(_L("CustomCommandAsync : request timed out"));
2887 return iTestStepResult = EFail;
2890 error = controllerStatus.Int();
2891 if(error == KDummyFunc1Return)
2895 ERR_PRINTF2(_L("CustomCommandAsync KDummyFunc1 returned unexpected value %d"), error);
2896 return iTestStepResult = EFail;
2898 INFO_PRINTF2(_L("CustomCommandAsync KDummyFunc1 returned expected value %d"), KDummyFunc1Return);
2900 // now call the log - to test CustomCommandAsync with aDataFrom
2901 _LIT8(KExpectedResult, "DummyFunc1 Called");
2902 TBuf8<KTextBufLen> memFunctionText;
2904 guardTimer.CreateLocal();
2905 iController.CustomCommandAsync(messageDest, KLogFunction, KNullDesC8, KNullDesC8,
2906 memFunctionText, controllerStatus);
2907 guardTimer.After(timerStatus, KGuardTimerValue);
2908 User::WaitForRequest(controllerStatus, timerStatus);
2909 guardTimer.Cancel();
2912 if(controllerStatus == KRequestPending)
2914 // request timed out
2915 ERR_PRINTF1(_L("CustomCommandAsync : request timed out"));
2916 return iTestStepResult = EFail;
2919 error = controllerStatus.Int();
2922 ERR_PRINTF2(_L("CustomCommandAsync failed with error %d"), error);
2923 return iTestStepResult = EFail;
2926 TBuf<KTextBufLen> memFunctionText16;
2927 memFunctionText16.SetMax();
2928 memFunctionText16.Fill(0x0);
2929 memFunctionText16.Copy(memFunctionText);
2930 INFO_PRINTF2(_L("Log : %S"), &memFunctionText16);
2932 if (memFunctionText != KExpectedResult)
2934 ERR_PRINTF1(_L("Return value did not match expected"));
2935 return iTestStepResult = EFail;
2938 return iTestStepResult = EPass;
2941 // ---------------------------
2942 // RTestMmfCtlfrmI0151
2948 RTestMmfCtlfrmI0151* RTestMmfCtlfrmI0151::NewL()
2950 RTestMmfCtlfrmI0151* self = new(ELeave) RTestMmfCtlfrmI0151;
2954 RTestMmfCtlfrmI0151::RTestMmfCtlfrmI0151()
2956 iTestStepName = _L("MM-MMF-CTLFRM-I-0151");
2959 TVerdict RTestMmfCtlfrmI0151::DoTestStepL()
2961 INFO_PRINTF1(_L("Get Duration"));
2963 TInt error = KErrNone;
2964 TTimeIntervalMicroSeconds duration;
2966 error = iController.GetDuration(duration);
2969 ERR_PRINTF2(_L("GetDuration failed with error %d"), error);
2970 return iTestStepResult = EFail;
2972 INFO_PRINTF2(_L("Clip duration: %d"), I64LOW(duration.Int64()));
2974 // we just happen to know that this clip is 5.33 seconds long
2975 // currently assuming resolution 1/100 of a sec, rounding up
2976 const TTimeIntervalMicroSeconds expectedDuration(5330000);
2977 const TInt expectedDurationMilliSeconds = 533;
2978 TInt64 duration64 = duration.Int64();
2980 I64DIVMOD(duration64, 10000, durationMod);
2981 if (durationMod >= 5000)
2984 if(duration64 != expectedDurationMilliSeconds)
2986 ERR_PRINTF2(_L("Expected duration was %d"), I64LOW(expectedDuration.Int64()));
2987 return iTestStepResult = EFail;
2990 return iTestStepResult = EPass;
2993 // ---------------------------
2994 // RTestMmfCtlfrmI0152
2996 // Get metadata entries
3000 RTestMmfCtlfrmI0152* RTestMmfCtlfrmI0152::NewL()
3002 RTestMmfCtlfrmI0152* self = new(ELeave) RTestMmfCtlfrmI0152;
3006 RTestMmfCtlfrmI0152::RTestMmfCtlfrmI0152()
3008 iTestStepName = _L("MM-MMF-CTLFRM-I-0152");
3011 TVerdict RTestMmfCtlfrmI0152::DoTestStepL()
3013 INFO_PRINTF1(_L("Get Metadata Entries"));
3015 TInt error = KErrNone;
3017 // expected values from our test controller
3018 const TInt KExpectedNumberOfMetaDataEntries = 4;
3019 // NB : these are 8-bit strings
3020 _LIT(KExpectedMetaDataEntryName1, "AudioLevel");
3021 _LIT(KExpectedMetaDataEntryValue1, "HIGH");
3022 _LIT(KExpectedMetaDataEntryName2, "AudioQuality");
3023 _LIT(KExpectedMetaDataEntryValue2, "LOW");
3026 error = iController.GetNumberOfMetaDataEntries(numEntries);
3029 ERR_PRINTF2(_L("GetNumberOfMetaDataEntries failed, error %d"), error);
3030 return iTestStepResult = EFail;
3032 INFO_PRINTF2(_L("Number of metadata entries : %d"), numEntries);
3033 if (numEntries != KExpectedNumberOfMetaDataEntries)
3035 ERR_PRINTF2(_L("GetNumberOfMetaDataEntries returned unexpected value %d"), numEntries);
3036 return iTestStepResult = EFail;
3039 CMMFMetaDataEntry* metaEntry1 = NULL;
3040 TRAPD(err1, metaEntry1 = iController.GetMetaDataEntryL(1))
3043 ERR_PRINTF2(_L("GetMetaDataEntryL left with error %d"), err1);
3044 return iTestStepResult = EFail;
3046 CleanupStack::PushL(metaEntry1);
3047 TPtrC entry1Name = metaEntry1->Name();
3048 TPtrC entry1Value = metaEntry1->Value();
3049 INFO_PRINTF3(_L("Metadata entry 1 = %S:%S"), &entry1Name, &entry1Value);
3051 if((entry1Name != KExpectedMetaDataEntryName1) || (entry1Value != KExpectedMetaDataEntryValue1))
3053 ERR_PRINTF1(_L("Metadata entries did not match expected"));
3054 CleanupStack::PopAndDestroy(metaEntry1);
3055 return iTestStepResult = EFail;
3058 CMMFMetaDataEntry* metaEntry2 = NULL;
3059 TRAPD(err2, metaEntry2 = iController.GetMetaDataEntryL(2))
3062 ERR_PRINTF2(_L("GetMetaDataEntryL left with error %d"), err2);
3063 CleanupStack::PopAndDestroy(metaEntry1);
3064 return iTestStepResult = EFail;
3066 CleanupStack::PushL(metaEntry2);
3067 TPtrC entry2Name = metaEntry2->Name();
3068 TPtrC entry2Value = metaEntry2->Value();
3069 INFO_PRINTF3(_L("Metadata entry 2 = %S:%S"), &entry2Name, &entry2Value);
3071 if((entry2Name != KExpectedMetaDataEntryName2) || (entry2Value != KExpectedMetaDataEntryValue2))
3073 ERR_PRINTF1(_L("Metadata entries did not match expected"));
3074 CleanupStack::PopAndDestroy(2); // metaEntry2, metaEntry1
3075 return iTestStepResult = EFail;
3078 // test the copy constructor
3079 CMMFMetaDataEntry* metaEntry3 = CMMFMetaDataEntry::NewL(*metaEntry2);
3080 CleanupStack::PushL(metaEntry3);
3081 TPtrC entry3Name = metaEntry3->Name();
3082 TPtrC entry3Value = metaEntry3->Value();
3083 INFO_PRINTF3(_L("Copy-constructed metadata entry = %S:%S"), &entry3Name, &entry3Value);
3085 if((entry3Name != KExpectedMetaDataEntryName2) || (entry3Value != KExpectedMetaDataEntryValue2))
3087 ERR_PRINTF1(_L("Copy-constructed metadata entries did not match expected"));
3088 CleanupStack::PopAndDestroy(3); // metaEntry3, metaEntry2, metaEntry1
3089 return iTestStepResult = EFail;
3093 TRAPD(err3, metaEntry3->SetNameL(KExpectedMetaDataEntryName1));
3096 ERR_PRINTF2(_L("SetNameL left with error %d"), err3);
3097 CleanupStack::PopAndDestroy(3); // metaEntry3, metaEntry2, metaEntry1
3098 return iTestStepResult = EFail;
3101 TRAP(err3, metaEntry3->SetValueL(KExpectedMetaDataEntryValue1));
3104 ERR_PRINTF2(_L("SetValueL left with error %d"), err3);
3105 CleanupStack::PopAndDestroy(3); // metaEntry3, metaEntry2, metaEntry1
3106 return iTestStepResult = EFail;
3109 TPtrC entry3NewName = metaEntry3->Name();
3110 TPtrC entry3NewValue = metaEntry3->Value();
3111 INFO_PRINTF3(_L("Copy-constructed metadata entry now = %S:%S"), &entry3NewName, &entry3NewValue);
3113 if((entry3NewName != KExpectedMetaDataEntryName1) || (entry3NewValue != KExpectedMetaDataEntryValue1))
3115 ERR_PRINTF1(_L("Copy-constructed metadata entries did not match after Set()"));
3116 CleanupStack::PopAndDestroy(3); // metaEntry3, metaEntry2, metaEntry1
3117 return iTestStepResult = EFail;
3121 CleanupStack::PopAndDestroy(3); // metaEntry3, metaEntry2, metaEntry1
3122 return iTestStepResult = EPass;