1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0488.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,132 @@
1.4 +#ifndef __TEST_CASE_PBASE_T_USBDI_0488_H
1.5 +#define __TEST_CASE_PBASE_T_USBDI_0488_H
1.6 +
1.7 +/*
1.8 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.9 +* All rights reserved.
1.10 +* This component and the accompanying materials are made available
1.11 +* under the terms of the License "Eclipse Public License v1.0"
1.12 +* which accompanies this distribution, and is available
1.13 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.14 +*
1.15 +* Initial Contributors:
1.16 +* Nokia Corporation - initial contribution.
1.17 +*
1.18 +* Contributors:
1.19 +*
1.20 +* Description:
1.21 +* @file PBASE-T_USBDI-0488.h
1.22 +* @internalComponent
1.23 +*
1.24 +*
1.25 +*/
1.26 +
1.27 +
1.28 +
1.29 +#include "basetestcase.h"
1.30 +#include "testcasefactory.h"
1.31 +#include "modelleddevices.h"
1.32 +#include "FDFActor.h"
1.33 +#include <d32usbc.h>
1.34 +#include <e32debug.h>
1.35 +#include <d32usbdi.h>
1.36 +#include "hosttransfers.h"
1.37 +#include "controltransferrequests.h"
1.38 +
1.39 +namespace NUnitTesting_USBDI
1.40 + {
1.41 +
1.42 +/**
1.43 +
1.44 +
1.45 + @SYMTestCaseID PBASE-T_USBDI-0488
1.46 + @SYMTestCaseDesc Resource cleanup following panic in client.
1.47 + @SYMFssID
1.48 + @SYMPREQ 1782
1.49 + @SYMREQ 7065 - [ USBD : Closing interface handles: Unclean shutdown (ie. kernel closes handle]
1.50 + @SYMTestType UT
1.51 + @SYMTestPriority 1
1.52 + @SYMTestActions 1. Enumerate
1.53 + 2. Add heap mark
1.54 + 3. Select alternate setting 1
1.55 + 4. Open pipe for endpoint on interface 1
1.56 + 5. Select alternate setting 0
1.57 + 6. Validate panic cause (Interface setting changed while pipe is opened on other alternate setting)
1.58 + 7. Close interface 1
1.59 + 8. Check heap mark is equal to original mark
1.60 + @SYMTestExpectedResults Resources successfully cleaned up following a specific panic.
1.61 + @SYMTestStatus Implemented
1.62 +
1.63 +
1.64 +*/
1.65 +class CUT_PBASE_T_USBDI_0488 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
1.66 + {
1.67 +public:
1.68 + static CUT_PBASE_T_USBDI_0488* NewL(TBool aHostRole);
1.69 + ~CUT_PBASE_T_USBDI_0488();
1.70 +
1.71 +public: // From MUsbBusObserver
1.72 + void DeviceInsertedL(TUint aDeviceHandle);
1.73 + void DeviceRemovedL(TUint aDeviceHandle);
1.74 + void BusErrorL(TInt aError);
1.75 + void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
1.76 + TInt aCompletionCode);
1.77 +
1.78 +
1.79 +public: // From MCommandObserver
1.80 + void Ep0TransferCompleteL(TInt aCompletionCode);
1.81 +
1.82 +private:
1.83 + CUT_PBASE_T_USBDI_0488(TBool aHostRole);
1.84 + void ConstructL();
1.85 + void ExecuteHostTestCaseL();
1.86 + void ExecuteDeviceTestCaseL();
1.87 + void HostDoCancel();
1.88 + void DeviceDoCancel();
1.89 + void HostRunL();
1.90 + void DeviceRunL();
1.91 +
1.92 +private:
1.93 + enum TCaseStep
1.94 + {
1.95 + EInProgress,
1.96 + EFailed,
1.97 + EPassed
1.98 + };
1.99 +
1.100 +public :
1.101 +
1.102 + RUsbInterface iUsbInterface1;
1.103 +
1.104 +
1.105 +private:
1.106 +
1.107 + CEp0Transfer* iControlEp0;
1.108 + CActorFDF* iActorFDF;
1.109 + RUsbInterface iUsbInterface0;
1.110 + RUsbPipe iInPipe;
1.111 + // The current test case step
1.112 + TCaseStep iCaseStep;
1.113 +
1.114 + // The test device for this test case
1.115 + RUsbDeviceA* iTestDevice;
1.116 +
1.117 +
1.118 +
1.119 +private:
1.120 + /**
1.121 + The functor for this test case for the factory
1.122 + */
1.123 + const static TFunctorTestCase<CUT_PBASE_T_USBDI_0488,TBool> iFunctor;
1.124 +
1.125 + /**
1.126 + static method, function of spawned thread.
1.127 + @param[in] aTestCase pointer
1.128 + */
1.129 + static TInt TestSelectAlternateInterfaceThenPanic(TAny* aTest);
1.130 + };
1.131 +
1.132 + }
1.133 +
1.134 +
1.135 +#endif