253
|
1 |
// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
|
0
|
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-0476.cpp
|
|
15 |
// @internalComponent
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include "PBASE-T_USBDI-0476.h"
|
|
20 |
#include "descriptorsRawData.h"
|
|
21 |
#include <d32usbdescriptors.h>
|
|
22 |
#include "testpolicy.h"
|
253
|
23 |
#include "OstTraceDefinitions.h"
|
|
24 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
25 |
#include "PBASE-T_USBDI-0476Traces.h"
|
|
26 |
#endif
|
|
27 |
|
|
28 |
|
0
|
29 |
|
|
30 |
namespace NUnitTesting_USBDI
|
|
31 |
{
|
|
32 |
|
|
33 |
_LIT(KTestCaseId,"PBASE-T_USBDI-0476");
|
|
34 |
const TFunctorTestCase<CUT_PBASE_T_USBDI_0476,TBool> CUT_PBASE_T_USBDI_0476::iFunctor(KTestCaseId);
|
|
35 |
|
|
36 |
CUT_PBASE_T_USBDI_0476* CUT_PBASE_T_USBDI_0476::NewL(TBool aHostRole)
|
|
37 |
{
|
253
|
38 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_NEWL_ENTRY, aHostRole );
|
0
|
39 |
CUT_PBASE_T_USBDI_0476* self = new (ELeave) CUT_PBASE_T_USBDI_0476(aHostRole);
|
|
40 |
CleanupStack::PushL(self);
|
|
41 |
self->ConstructL();
|
|
42 |
CleanupStack::Pop(self);
|
253
|
43 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_NEWL_EXIT, ( TUint )( self ) );
|
0
|
44 |
return self;
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
CUT_PBASE_T_USBDI_0476::CUT_PBASE_T_USBDI_0476(TBool aHostRole)
|
|
49 |
: CBaseTestCase(KTestCaseId,aHostRole,ETrue),
|
|
50 |
iCaseStep(EInProgress)
|
|
51 |
{
|
253
|
52 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0476_CUT_PBASE_T_USBDI_0476_ENTRY, this );
|
|
53 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_CUT_PBASE_T_USBDI_0476_EXIT, this );
|
0
|
54 |
}
|
|
55 |
|
|
56 |
|
|
57 |
void CUT_PBASE_T_USBDI_0476::ConstructL()
|
|
58 |
{
|
253
|
59 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_CONSTRUCTL_ENTRY, this );
|
|
60 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_CONSTRUCTL_EXIT, this );
|
0
|
61 |
}
|
|
62 |
|
|
63 |
|
|
64 |
CUT_PBASE_T_USBDI_0476::~CUT_PBASE_T_USBDI_0476()
|
|
65 |
{
|
253
|
66 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_CUT_PBASE_T_USBDI_0476_ENTRY_DUP01, this );
|
0
|
67 |
|
|
68 |
Cancel();
|
253
|
69 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_CUT_PBASE_T_USBDI_0476_EXIT_DUP01, this );
|
0
|
70 |
}
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
void CUT_PBASE_T_USBDI_0476::ExecuteHostTestCaseL()
|
|
75 |
{
|
253
|
76 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_EXECUTEHOSTTESTCASEL_ENTRY, this );
|
0
|
77 |
TInt err(KErrNone);
|
|
78 |
|
|
79 |
TUsbGenericDescriptor* parsed = NULL;
|
|
80 |
TUsbDeviceDescriptor* devDesc = 0;
|
|
81 |
|
|
82 |
// Parse Device Descriptor
|
|
83 |
err = UsbDescriptorParser::Parse(KDeviceDescriptorData, parsed);
|
|
84 |
CHECK(err == KErrNone) // KErrNone
|
|
85 |
devDesc = TUsbDeviceDescriptor::Cast(parsed);
|
|
86 |
CHECK(devDesc != 0)
|
|
87 |
CHECK(err == KErrNone) // KErrNone
|
|
88 |
|
|
89 |
// Parse Configuration Descriptor ---------- Case 1
|
|
90 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase1, 1) == KErrNone);
|
|
91 |
|
|
92 |
// Parse Configuration Descriptor ---------- Case 2
|
|
93 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase2, 2) == KErrNone);
|
|
94 |
|
|
95 |
// Parse Configuration Descriptor ---------- Case 3
|
|
96 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase3, 3) == KErrNone);
|
|
97 |
|
|
98 |
// Parse Configuration Descriptor ---------- Case 4
|
|
99 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KBtDongleDescriptorTestCase4 , 4) == KErrGeneral);
|
|
100 |
|
|
101 |
// Parse Configuration Descriptor ---------- Case 5
|
|
102 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase5, 5) == KErrNone);
|
|
103 |
|
|
104 |
// Parse Configuration Descriptor ---------- Case 6
|
|
105 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase6, 6) == KErrNone);
|
|
106 |
|
|
107 |
// Parse Configuration Descriptor ---------- Case 7
|
|
108 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase7, 7) == KErrNone);
|
|
109 |
|
|
110 |
// Parse Configuration Descriptor ---------- Case 8
|
|
111 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase8, 8) == KErrNone);
|
|
112 |
|
|
113 |
// Parse Configuration Descriptor ---------- Case 9
|
|
114 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase9, 9) == KErrNone);
|
|
115 |
|
|
116 |
// Parse Configuration Descriptor ---------- Case 10
|
|
117 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase10, 10) == KErrNone);
|
|
118 |
|
|
119 |
// Parse Configuration Descriptor ---------- Case 11
|
|
120 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase11, 11) == KErrNone);
|
|
121 |
|
|
122 |
// Parse Configuration Descriptor ---------- Case 12
|
|
123 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase12, 12) == KErrNone);
|
|
124 |
|
|
125 |
// Parse Configuration Descriptor ---------- Case 13
|
|
126 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase13, 13) == KErrNone);
|
|
127 |
|
|
128 |
// Parse Configuration Descriptor ---------- Case 14
|
|
129 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorWithIADTestCase14, 14) == KErrNone);
|
|
130 |
|
|
131 |
TestPassed();
|
253
|
132 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_EXECUTEHOSTTESTCASEL_EXIT, this );
|
0
|
133 |
}
|
|
134 |
|
|
135 |
void CUT_PBASE_T_USBDI_0476::HostDoCancel()
|
|
136 |
{
|
253
|
137 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_HOSTDOCANCEL_ENTRY, this );
|
|
138 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_HOSTDOCANCEL_EXIT, this );
|
0
|
139 |
}
|
|
140 |
|
|
141 |
|
|
142 |
void CUT_PBASE_T_USBDI_0476::ExecuteDeviceTestCaseL()
|
|
143 |
{
|
253
|
144 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_EXECUTEDEVICETESTCASEL_ENTRY, this );
|
|
145 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_EXECUTEDEVICETESTCASEL_EXIT, this );
|
0
|
146 |
}
|
|
147 |
|
|
148 |
void CUT_PBASE_T_USBDI_0476::DeviceDoCancel()
|
|
149 |
{
|
253
|
150 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_DEVICEDOCANCEL_ENTRY, this );
|
|
151 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_DEVICEDOCANCEL_EXIT, this );
|
0
|
152 |
}
|
|
153 |
|
|
154 |
|
|
155 |
void CUT_PBASE_T_USBDI_0476::HostRunL()
|
|
156 |
{
|
253
|
157 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_HOSTRUNL_ENTRY, this );
|
|
158 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_HOSTRUNL_EXIT, this );
|
0
|
159 |
}
|
|
160 |
|
|
161 |
|
|
162 |
void CUT_PBASE_T_USBDI_0476::DeviceRunL()
|
|
163 |
{
|
253
|
164 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0476_DEVICERUNL_ENTRY, this );
|
|
165 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0476_DEVICERUNL_EXIT, this );
|
0
|
166 |
}
|
|
167 |
|
|
168 |
|
|
169 |
}
|