os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciunderflowautostopcontrol.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2007-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "teststepciunderflowautostopcontrol.h"
    17 
    18 
    19 TVerdict CTestStepCIUnderflowAutoStopControl::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0091-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0091L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0092-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0092L();
    32 		}
    33 
    34 	return iTestStepResult;
    35 	}
    36 
    37 
    38 TVerdict CTestStepCIUnderflowAutoStopControl::DoTestStep0091L()
    39 	{
    40 	iTestStepResult = EFail;
    41 
    42 	INFO_PRINTF1(_L("UnderflowAutoStopControl - Instantiating"));
    43 
    44 	//Initialize - with the UID of our test HwDevice
    45 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    46 	TUid testUID = {KUidUnderflowAutoStopControlTestDevice};
    47 	#else
    48 	TFourCC testUID('T','0','2','1');
    49 	#endif
    50 	
    51 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    52 
    53 	if (iTestStepResult != EPass)
    54 		{
    55 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    56 		return EInconclusive;
    57 		}
    58 
    59 	// reset the value as previous test is pass
    60 	iTestStepResult = EFail;  
    61 
    62 	// KUidunderflowAutoStopControl
    63 	MMMFUnderflowAutoStopControl* ptr = static_cast <MMMFUnderflowAutoStopControl*> (iMMFDevSound->CustomInterface(KUidUnderflowAutoStopControl));
    64 
    65 	if (ptr)
    66 		{
    67 		INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl instantiated successfully"));
    68 
    69 		iTestStepResult = EPass;
    70 		}
    71 	else
    72 		{
    73 		ERR_PRINTF1(_L("MMMFUnderflowAutoStopControl failed to retrieve the interface"));
    74 		}
    75 
    76 	return iTestStepResult;
    77 	}
    78 
    79 
    80 TVerdict CTestStepCIUnderflowAutoStopControl::DoTestStep0092L()
    81 	{
    82 	iTestStepResult = EFail;
    83 	TInt result = KErrGeneral;
    84 
    85 	INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl - SetConversionFormat"));
    86 
    87 	//Initialize - with the UID of our test HwDevice
    88 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    89 	TUid testUID = {KUidUnderflowAutoStopControlTestDevice};
    90 	#else
    91 	TFourCC testUID('T','0','2','1');
    92 	#endif
    93 	
    94 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    95 
    96 	if (iTestStepResult != EPass)
    97 		{
    98 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    99 		return EInconclusive;
   100 		}
   101 
   102 	// reset the value as previous test is pass
   103 	iTestStepResult = EFail;
   104 
   105 	// KUidUnderflowAutoStopControl
   106 	MMMFUnderflowAutoStopControl* ptr = static_cast <MMMFUnderflowAutoStopControl*> (iMMFDevSound->CustomInterface(KUidUnderflowAutoStopControl));
   107 
   108 	if (ptr)
   109 		{
   110 		result = ptr->MmuascTurnOffUnderflowAutoStop(); // call method
   111 		
   112 		if (result == KErrNone)
   113 			{
   114 			INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl::MmuascTurnOffUnderflowAutoStop finished successfully"));
   115 
   116 			iTestStepResult = EPass;
   117 			}
   118 		else
   119 			{
   120 			ERR_PRINTF2(_L("MMMFUnderflowAutoStopControl::MmuascTurnOffUnderflowAutoStop failed with error %d"), result);
   121 			}
   122 		}
   123 	else
   124 		{
   125 		INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl failed to retrieve the interface"));
   126 		iTestStepResult = EInconclusive;
   127 		}
   128 
   129 	return iTestStepResult;
   130 	}