author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 02 Sep 2010 21:54:16 +0300 | |
changeset 259 | 57b9594f5772 |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
child 271 | dc268b18d709 |
permissions | -rw-r--r-- |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
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-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" |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
#include "OstTraceDefinitions.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#ifdef OST_TRACE_COMPILER_IN_USE |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#include "PBASE-T_USBDI-0475Traces.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
#endif |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
|
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
|
0 | 29 |
|
30 |
namespace NUnitTesting_USBDI |
|
31 |
{ |
|
32 |
||
33 |
_LIT(KTestCaseId,"PBASE-T_USBDI-0475"); |
|
34 |
const TFunctorTestCase<CUT_PBASE_T_USBDI_0475,TBool> CUT_PBASE_T_USBDI_0475::iFunctor(KTestCaseId); |
|
35 |
||
36 |
CUT_PBASE_T_USBDI_0475* CUT_PBASE_T_USBDI_0475::NewL(TBool aHostRole) |
|
37 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
38 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_NEWL_ENTRY, aHostRole ); |
0 | 39 |
CUT_PBASE_T_USBDI_0475* self = new (ELeave) CUT_PBASE_T_USBDI_0475(aHostRole); |
40 |
CleanupStack::PushL(self); |
|
41 |
self->ConstructL(); |
|
42 |
CleanupStack::Pop(self); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_NEWL_EXIT, ( TUint )( self ) ); |
0 | 44 |
return self; |
45 |
} |
|
46 |
||
47 |
||
48 |
CUT_PBASE_T_USBDI_0475::CUT_PBASE_T_USBDI_0475(TBool aHostRole) |
|
49 |
: CBaseTestCase(KTestCaseId,aHostRole,ETrue), |
|
50 |
iCaseStep(EInProgress) |
|
51 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
52 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0475_CUT_PBASE_T_USBDI_0475_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
53 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_CUT_PBASE_T_USBDI_0475_EXIT, this ); |
0 | 54 |
} |
55 |
||
56 |
||
57 |
void CUT_PBASE_T_USBDI_0475::ConstructL() |
|
58 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_CONSTRUCTL_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_CONSTRUCTL_EXIT, this ); |
0 | 61 |
} |
62 |
||
63 |
||
64 |
CUT_PBASE_T_USBDI_0475::~CUT_PBASE_T_USBDI_0475() |
|
65 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
66 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_CUT_PBASE_T_USBDI_0475_ENTRY_DUP01, this ); |
0 | 67 |
|
68 |
Cancel(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
69 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_CUT_PBASE_T_USBDI_0475_EXIT_DUP01, this ); |
0 | 70 |
} |
71 |
||
72 |
||
73 |
void CUT_PBASE_T_USBDI_0475::ExecuteHostTestCaseL() |
|
74 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_EXECUTEHOSTTESTCASEL_ENTRY, this ); |
0 | 76 |
TInt err(KErrNone); |
77 |
||
78 |
TUsbGenericDescriptor* parsed = NULL; |
|
79 |
TUsbDeviceDescriptor* devDesc = 0; |
|
80 |
TUsbConfigurationDescriptor* configDesc = 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 |
err = UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase1, parsed); |
|
91 |
configDesc = TUsbConfigurationDescriptor::Cast(parsed); |
|
92 |
||
93 |
CHECK(configDesc == 0) |
|
94 |
CHECK(err == KErrCorrupt) // no tree generated |
|
95 |
||
96 |
// Parse Configuration Descriptor ---------- Case 2 |
|
97 |
err = UsbDescriptorParser::Parse(KConfigurationDescriptorInsufficientDataTestCase2, parsed); |
|
98 |
configDesc = TUsbConfigurationDescriptor::Cast(parsed); |
|
99 |
||
100 |
CHECK(configDesc != 0) // tree should be kept, even if there is a parse error at the end |
|
101 |
CHECK(err == KErrCorrupt) // KErrCorrupt |
|
102 |
||
103 |
// Parse Configuration Descriptor ---------- Case 3 |
|
104 |
CHECK(ParseConfigDescriptorAndCheckTree(devDesc, KConfigurationDescriptorUnexpectedLengthTestCase3, 3) == KErrNone); |
|
105 |
||
106 |
TestPassed(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_EXECUTEHOSTTESTCASEL_EXIT, this ); |
0 | 108 |
} |
109 |
||
110 |
void CUT_PBASE_T_USBDI_0475::HostDoCancel() |
|
111 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
112 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_HOSTDOCANCEL_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
113 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_HOSTDOCANCEL_EXIT, this ); |
0 | 114 |
} |
115 |
||
116 |
||
117 |
void CUT_PBASE_T_USBDI_0475::ExecuteDeviceTestCaseL() |
|
118 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
119 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_EXECUTEDEVICETESTCASEL_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_EXECUTEDEVICETESTCASEL_EXIT, this ); |
0 | 121 |
} |
122 |
||
123 |
void CUT_PBASE_T_USBDI_0475::DeviceDoCancel() |
|
124 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_DEVICEDOCANCEL_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_DEVICEDOCANCEL_EXIT, this ); |
0 | 127 |
} |
128 |
||
129 |
||
130 |
||
131 |
void CUT_PBASE_T_USBDI_0475::HostRunL() |
|
132 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_HOSTRUNL_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
134 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_HOSTRUNL_EXIT, this ); |
0 | 135 |
} |
136 |
||
137 |
||
138 |
void CUT_PBASE_T_USBDI_0475::DeviceRunL() |
|
139 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
140 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0475_DEVICERUNL_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
141 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0475_DEVICERUNL_EXIT, this ); |
0 | 142 |
} |
143 |
||
144 |
||
145 |
} |