|
1 // Copyright (c) 2008-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 "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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include "tipcfuzzer.h" |
|
23 |
|
24 CIpcFuzzer* CIpcFuzzer::NewL() |
|
25 { |
|
26 CIpcFuzzer* self = CIpcFuzzer::NewLC(); |
|
27 CleanupStack::Pop(); // self; |
|
28 return self; |
|
29 } |
|
30 |
|
31 CIpcFuzzer* CIpcFuzzer::NewLC() |
|
32 { |
|
33 CIpcFuzzer* self = new CIpcFuzzer(); |
|
34 CleanupStack::PushL(self); // self; |
|
35 self->ConstructL(); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // Constructor |
|
40 CIpcFuzzer::CIpcFuzzer() |
|
41 { |
|
42 } |
|
43 |
|
44 void CIpcFuzzer::ConstructL() |
|
45 { |
|
46 } |
|
47 |
|
48 //Destructor |
|
49 CIpcFuzzer::~CIpcFuzzer() |
|
50 { |
|
51 } |
|
52 |
|
53 // Prepares 8 bit junk descriptor data. |
|
54 HBufC8* CIpcFuzzer::GetDescData8L(TUint aIdx) |
|
55 { |
|
56 HBufC8* buf8 = NULL; |
|
57 switch(aIdx) |
|
58 { |
|
59 case 1: |
|
60 { |
|
61 buf8 = HBufC8::NewLC(1); |
|
62 TPtr8 ptr = buf8->Des(); |
|
63 ptr.Fill(TChar(0x61),1); |
|
64 } |
|
65 break; |
|
66 case 2: |
|
67 { |
|
68 buf8 = HBufC8::NewLC(255); |
|
69 TPtr8 ptr = buf8->Des(); |
|
70 ptr.Fill(TChar(0x61),255); |
|
71 } |
|
72 break; |
|
73 case 3: |
|
74 { |
|
75 buf8 = HBufC8::NewLC(55000); |
|
76 TPtr8 ptr = buf8->Des(); |
|
77 ptr.Fill(TChar(0x61),55000); |
|
78 } |
|
79 break; |
|
80 case 4: |
|
81 { |
|
82 buf8 = HBufC8::NewLC(255); |
|
83 TPtr8 ptr = buf8->Des(); |
|
84 ptr.Fill(TChar(0xffff),255); |
|
85 } |
|
86 break; |
|
87 case 5: |
|
88 { |
|
89 buf8 = HBufC8::NewLC(255); |
|
90 TPtr8 ptr = buf8->Des(); |
|
91 ptr.Fill(TChar(0x0000),255); |
|
92 } |
|
93 break; |
|
94 case 6: |
|
95 { |
|
96 buf8 = HBufC8::NewLC(255); |
|
97 TPtr8 ptr = buf8->Des(); |
|
98 ptr.Fill(TChar(0x6100),255); |
|
99 } |
|
100 break; |
|
101 case 7: |
|
102 { |
|
103 buf8 = HBufC8::NewLC(55000); |
|
104 TPtr8 ptr = buf8->Des(); |
|
105 ptr.Fill(TChar(0x6100),55000); |
|
106 } |
|
107 break; |
|
108 case 8: |
|
109 { |
|
110 buf8 = HBufC8::NewLC(0); |
|
111 } |
|
112 break; |
|
113 default: |
|
114 break; |
|
115 } |
|
116 if(buf8) |
|
117 CleanupStack::Pop(); |
|
118 return buf8; |
|
119 } |
|
120 |
|
121 // Prepares 16 bit junk descriptor data. |
|
122 HBufC* CIpcFuzzer::GetDescData16L(TUint aIdx) |
|
123 { |
|
124 HBufC* buf16 = NULL; |
|
125 switch(aIdx) |
|
126 { |
|
127 case 1: |
|
128 { |
|
129 buf16 = HBufC::NewLC(1); |
|
130 TPtr ptr = buf16->Des(); |
|
131 ptr.Fill(TChar(0x61),1); |
|
132 } |
|
133 break; |
|
134 case 2: |
|
135 { |
|
136 buf16 = HBufC::NewLC(255); |
|
137 TPtr ptr = buf16->Des(); |
|
138 ptr.Fill(TChar(0x61),255); |
|
139 } |
|
140 break; |
|
141 case 3: |
|
142 { |
|
143 buf16 = HBufC::NewLC(55000); |
|
144 TPtr ptr = buf16->Des(); |
|
145 ptr.Fill(TChar(0x61),55000); |
|
146 } |
|
147 break; |
|
148 case 4: |
|
149 { |
|
150 buf16 = HBufC::NewLC(255); |
|
151 TPtr ptr = buf16->Des(); |
|
152 ptr.Fill(TChar(0xffff),255); |
|
153 } |
|
154 break; |
|
155 case 5: |
|
156 { |
|
157 buf16 = HBufC::NewLC(255); |
|
158 TPtr ptr = buf16->Des(); |
|
159 ptr.Fill(TChar(0x0000),255); |
|
160 } |
|
161 break; |
|
162 case 6: |
|
163 { |
|
164 buf16 = HBufC::NewLC(255); |
|
165 TPtr ptr = buf16->Des(); |
|
166 ptr.Fill(TChar(0x6100),255); |
|
167 } |
|
168 break; |
|
169 case 7: |
|
170 { |
|
171 buf16 = HBufC::NewLC(55000); |
|
172 TPtr ptr = buf16->Des(); |
|
173 ptr.Fill(TChar(0x6100),55000); |
|
174 } |
|
175 break; |
|
176 case 8: |
|
177 { |
|
178 buf16 = HBufC::NewLC(0); |
|
179 } |
|
180 break; |
|
181 default: |
|
182 break; |
|
183 } |
|
184 if(buf16) |
|
185 CleanupStack::Pop(); |
|
186 return buf16; |
|
187 } |
|
188 |
|
189 // Prepares an integer value. |
|
190 TInt CIpcFuzzer::GetIntData(TUint aIdx) |
|
191 { |
|
192 TInt data = 0; |
|
193 switch(aIdx) |
|
194 { |
|
195 case 1: |
|
196 { |
|
197 data = 1; |
|
198 } |
|
199 break; |
|
200 case 2: |
|
201 { |
|
202 data = 0xffffffff; |
|
203 } |
|
204 break; |
|
205 case 3: |
|
206 { |
|
207 data = 0x7fffffff; |
|
208 } |
|
209 break; |
|
210 case 4: |
|
211 { |
|
212 data = 0x80000000; |
|
213 } |
|
214 break; |
|
215 case 5: |
|
216 { |
|
217 data = 0x0fffffff; |
|
218 } |
|
219 break; |
|
220 case 6: |
|
221 { |
|
222 data = 55000; |
|
223 } |
|
224 break; |
|
225 case 7: |
|
226 { |
|
227 data = 255; |
|
228 } |
|
229 break; |
|
230 case 8: |
|
231 { |
|
232 data = 0x77777777; |
|
233 } |
|
234 break; |
|
235 case 9: |
|
236 { |
|
237 data = 12345678; |
|
238 } |
|
239 break; |
|
240 default: |
|
241 break; |
|
242 } |
|
243 return data; |
|
244 } |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |