Update contrib.
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 the License "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.
14 // @file PBASE-T_USBDI-0475.cpp
19 #include "PBASE-T_USBDI-0475.h"
20 #include "descriptorsRawData.h"
21 #include <d32usbdescriptors.h>
22 #include "testpolicy.h"
24 namespace NUnitTesting_USBDI
27 _LIT(KTestCaseId,"PBASE-T_USBDI-0475");
28 const TFunctorTestCase<CUT_PBASE_T_USBDI_0475,TBool> CUT_PBASE_T_USBDI_0475::iFunctor(KTestCaseId);
30 CUT_PBASE_T_USBDI_0475* CUT_PBASE_T_USBDI_0475::NewL(TBool aHostRole)
32 CUT_PBASE_T_USBDI_0475* self = new (ELeave) CUT_PBASE_T_USBDI_0475(aHostRole);
33 CleanupStack::PushL(self);
35 CleanupStack::Pop(self);
40 CUT_PBASE_T_USBDI_0475::CUT_PBASE_T_USBDI_0475(TBool aHostRole)
41 : CBaseTestCase(KTestCaseId,aHostRole,ETrue),
42 iCaseStep(EInProgress)
47 void CUT_PBASE_T_USBDI_0475::ConstructL()
53 CUT_PBASE_T_USBDI_0475::~CUT_PBASE_T_USBDI_0475()
61 void CUT_PBASE_T_USBDI_0475::ExecuteHostTestCaseL()
66 TUsbGenericDescriptor* parsed = NULL;
67 TUsbDeviceDescriptor* devDesc = 0;
68 TUsbConfigurationDescriptor* configDesc = 0;
70 // Parse Device Descriptor
71 err = UsbDescriptorParser::Parse(KDeviceDescriptorData, parsed);
72 CHECK(err == KErrNone) // KErrNone
73 devDesc = TUsbDeviceDescriptor::Cast(parsed);
75 CHECK(err == KErrNone) // KErrNone
77 // Parse Configuration Descriptor ---------- Case 1
78 err = UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase1, parsed);
79 configDesc = TUsbConfigurationDescriptor::Cast(parsed);
81 CHECK(configDesc == 0)
82 CHECK(err == KErrCorrupt) // no tree generated
84 // Parse Configuration Descriptor ---------- Case 2
85 err = UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase2, parsed);
86 configDesc = TUsbConfigurationDescriptor::Cast(parsed);
88 CHECK(configDesc != 0) // tree should be kept, even if there is a parse error at the end
89 CHECK(err == KErrCorrupt) // KErrCorrupt
91 // Parse Configuration Descriptor ---------- Case 3
92 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorUnexpectedLengthTestCase3, 3) == KErrNone);
97 void CUT_PBASE_T_USBDI_0475::HostDoCancel()
103 void CUT_PBASE_T_USBDI_0475::ExecuteDeviceTestCaseL()
107 void CUT_PBASE_T_USBDI_0475::DeviceDoCancel()
114 void CUT_PBASE_T_USBDI_0475::HostRunL()
120 void CUT_PBASE_T_USBDI_0475::DeviceRunL()