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 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-0476.cpp
19 #include "PBASE-T_USBDI-0476.h"
20 #include "descriptorsRawData.h"
21 #include <d32usbdescriptors.h>
22 #include "testpolicy.h"
24 namespace NUnitTesting_USBDI
27 _LIT(KTestCaseId,"PBASE-T_USBDI-0476");
28 const TFunctorTestCase<CUT_PBASE_T_USBDI_0476,TBool> CUT_PBASE_T_USBDI_0476::iFunctor(KTestCaseId);
30 CUT_PBASE_T_USBDI_0476* CUT_PBASE_T_USBDI_0476::NewL(TBool aHostRole)
32 CUT_PBASE_T_USBDI_0476* self = new (ELeave) CUT_PBASE_T_USBDI_0476(aHostRole);
33 CleanupStack::PushL(self);
35 CleanupStack::Pop(self);
40 CUT_PBASE_T_USBDI_0476::CUT_PBASE_T_USBDI_0476(TBool aHostRole)
41 : CBaseTestCase(KTestCaseId,aHostRole,ETrue),
42 iCaseStep(EInProgress)
47 void CUT_PBASE_T_USBDI_0476::ConstructL()
53 CUT_PBASE_T_USBDI_0476::~CUT_PBASE_T_USBDI_0476()
62 void CUT_PBASE_T_USBDI_0476::ExecuteHostTestCaseL()
67 TUsbGenericDescriptor* parsed = NULL;
68 TUsbDeviceDescriptor* devDesc = 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 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase1, 1) == KErrNone);
80 // Parse Configuration Descriptor ---------- Case 2
81 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase2, 2) == KErrNone);
83 // Parse Configuration Descriptor ---------- Case 3
84 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase3, 3) == KErrNone);
86 // Parse Configuration Descriptor ---------- Case 4
87 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KBtDongleDescriptorTestCase4 , 4) == KErrGeneral);
89 // Parse Configuration Descriptor ---------- Case 5
90 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase5, 5) == KErrNone);
92 // Parse Configuration Descriptor ---------- Case 6
93 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase6, 6) == KErrNone);
95 // Parse Configuration Descriptor ---------- Case 7
96 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase7, 7) == KErrNone);
98 // Parse Configuration Descriptor ---------- Case 8
99 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase8, 8) == KErrNone);
101 // Parse Configuration Descriptor ---------- Case 9
102 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase9, 9) == KErrNone);
104 // Parse Configuration Descriptor ---------- Case 10
105 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase10, 10) == KErrNone);
107 // Parse Configuration Descriptor ---------- Case 11
108 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase11, 11) == KErrNone);
110 // Parse Configuration Descriptor ---------- Case 12
111 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase12, 12) == KErrNone);
113 // Parse Configuration Descriptor ---------- Case 13
114 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase13, 13) == KErrNone);
116 // Parse Configuration Descriptor ---------- Case 14
117 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase14, 14) == KErrNone);
122 void CUT_PBASE_T_USBDI_0476::HostDoCancel()
128 void CUT_PBASE_T_USBDI_0476::ExecuteDeviceTestCaseL()
132 void CUT_PBASE_T_USBDI_0476::DeviceDoCancel()
138 void CUT_PBASE_T_USBDI_0476::HostRunL()
144 void CUT_PBASE_T_USBDI_0476::DeviceRunL()