|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // @file PBASE-T_USBDI-0475.cpp |
|
15 // @internalComponent |
|
16 // |
|
17 // |
|
18 |
|
19 #include "PBASE-T_USBDI-0475.h" |
|
20 #include "descriptorsRawData.h" |
|
21 #include <d32usbdescriptors.h> |
|
22 #include "testpolicy.h" |
|
23 |
|
24 namespace NUnitTesting_USBDI |
|
25 { |
|
26 |
|
27 _LIT(KTestCaseId,"PBASE-T_USBDI-0475"); |
|
28 const TFunctorTestCase<CUT_PBASE_T_USBDI_0475,TBool> CUT_PBASE_T_USBDI_0475::iFunctor(KTestCaseId); |
|
29 |
|
30 CUT_PBASE_T_USBDI_0475* CUT_PBASE_T_USBDI_0475::NewL(TBool aHostRole) |
|
31 { |
|
32 CUT_PBASE_T_USBDI_0475* self = new (ELeave) CUT_PBASE_T_USBDI_0475(aHostRole); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 |
|
40 CUT_PBASE_T_USBDI_0475::CUT_PBASE_T_USBDI_0475(TBool aHostRole) |
|
41 : CBaseTestCase(KTestCaseId,aHostRole,ETrue), |
|
42 iCaseStep(EInProgress) |
|
43 { |
|
44 } |
|
45 |
|
46 |
|
47 void CUT_PBASE_T_USBDI_0475::ConstructL() |
|
48 { |
|
49 LOG_FUNC |
|
50 } |
|
51 |
|
52 |
|
53 CUT_PBASE_T_USBDI_0475::~CUT_PBASE_T_USBDI_0475() |
|
54 { |
|
55 LOG_FUNC |
|
56 |
|
57 Cancel(); |
|
58 } |
|
59 |
|
60 |
|
61 void CUT_PBASE_T_USBDI_0475::ExecuteHostTestCaseL() |
|
62 { |
|
63 LOG_FUNC |
|
64 TInt err(KErrNone); |
|
65 |
|
66 TUsbGenericDescriptor* parsed = NULL; |
|
67 TUsbDeviceDescriptor* devDesc = 0; |
|
68 TUsbConfigurationDescriptor* configDesc = 0; |
|
69 |
|
70 // Parse Device Descriptor |
|
71 err = UsbDescriptorParser::Parse(KDeviceDescriptorData, parsed); |
|
72 CHECK(err == KErrNone) // KErrNone |
|
73 devDesc = TUsbDeviceDescriptor::Cast(parsed); |
|
74 CHECK(devDesc != 0) |
|
75 CHECK(err == KErrNone) // KErrNone |
|
76 |
|
77 // Parse Configuration Descriptor ---------- Case 1 |
|
78 err = UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase1, parsed); |
|
79 configDesc = TUsbConfigurationDescriptor::Cast(parsed); |
|
80 |
|
81 CHECK(configDesc == 0) |
|
82 CHECK(err == KErrCorrupt) // no tree generated |
|
83 |
|
84 // Parse Configuration Descriptor ---------- Case 2 |
|
85 err = UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase2, parsed); |
|
86 configDesc = TUsbConfigurationDescriptor::Cast(parsed); |
|
87 |
|
88 CHECK(configDesc != 0) // tree should be kept, even if there is a parse error at the end |
|
89 CHECK(err == KErrCorrupt) // KErrCorrupt |
|
90 |
|
91 // Parse Configuration Descriptor ---------- Case 3 |
|
92 CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorUnexpectedLengthTestCase3, 3) == KErrNone); |
|
93 |
|
94 TestPassed(); |
|
95 } |
|
96 |
|
97 void CUT_PBASE_T_USBDI_0475::HostDoCancel() |
|
98 { |
|
99 LOG_FUNC |
|
100 } |
|
101 |
|
102 |
|
103 void CUT_PBASE_T_USBDI_0475::ExecuteDeviceTestCaseL() |
|
104 { |
|
105 } |
|
106 |
|
107 void CUT_PBASE_T_USBDI_0475::DeviceDoCancel() |
|
108 { |
|
109 LOG_FUNC |
|
110 } |
|
111 |
|
112 |
|
113 |
|
114 void CUT_PBASE_T_USBDI_0475::HostRunL() |
|
115 { |
|
116 LOG_FUNC |
|
117 } |
|
118 |
|
119 |
|
120 void CUT_PBASE_T_USBDI_0475::DeviceRunL() |
|
121 { |
|
122 LOG_FUNC |
|
123 } |
|
124 |
|
125 |
|
126 } |