OLD | NEW |
1 library googleapis.safebrowsing.v4.test; | 1 library googleapis.safebrowsing.v4.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:test/test.dart' as unittest; | 10 import 'package:test/test.dart' as unittest; |
(...skipping 73 matching lines...) Loading... |
84 | 84 |
85 checkClientInfo(api.ClientInfo o) { | 85 checkClientInfo(api.ClientInfo o) { |
86 buildCounterClientInfo++; | 86 buildCounterClientInfo++; |
87 if (buildCounterClientInfo < 3) { | 87 if (buildCounterClientInfo < 3) { |
88 unittest.expect(o.clientId, unittest.equals('foo')); | 88 unittest.expect(o.clientId, unittest.equals('foo')); |
89 unittest.expect(o.clientVersion, unittest.equals('foo')); | 89 unittest.expect(o.clientVersion, unittest.equals('foo')); |
90 } | 90 } |
91 buildCounterClientInfo--; | 91 buildCounterClientInfo--; |
92 } | 92 } |
93 | 93 |
94 buildUnnamed1064() { | 94 buildUnnamed1081() { |
95 var o = new core.List<core.String>(); | 95 var o = new core.List<core.String>(); |
96 o.add("foo"); | 96 o.add("foo"); |
97 o.add("foo"); | 97 o.add("foo"); |
98 return o; | 98 return o; |
99 } | 99 } |
100 | 100 |
101 checkUnnamed1064(core.List<core.String> o) { | 101 checkUnnamed1081(core.List<core.String> o) { |
102 unittest.expect(o, unittest.hasLength(2)); | 102 unittest.expect(o, unittest.hasLength(2)); |
103 unittest.expect(o[0], unittest.equals('foo')); | 103 unittest.expect(o[0], unittest.equals('foo')); |
104 unittest.expect(o[1], unittest.equals('foo')); | 104 unittest.expect(o[1], unittest.equals('foo')); |
105 } | 105 } |
106 | 106 |
107 core.int buildCounterConstraints = 0; | 107 core.int buildCounterConstraints = 0; |
108 buildConstraints() { | 108 buildConstraints() { |
109 var o = new api.Constraints(); | 109 var o = new api.Constraints(); |
110 buildCounterConstraints++; | 110 buildCounterConstraints++; |
111 if (buildCounterConstraints < 3) { | 111 if (buildCounterConstraints < 3) { |
112 o.maxDatabaseEntries = 42; | 112 o.maxDatabaseEntries = 42; |
113 o.maxUpdateEntries = 42; | 113 o.maxUpdateEntries = 42; |
114 o.region = "foo"; | 114 o.region = "foo"; |
115 o.supportedCompressions = buildUnnamed1064(); | 115 o.supportedCompressions = buildUnnamed1081(); |
116 } | 116 } |
117 buildCounterConstraints--; | 117 buildCounterConstraints--; |
118 return o; | 118 return o; |
119 } | 119 } |
120 | 120 |
121 checkConstraints(api.Constraints o) { | 121 checkConstraints(api.Constraints o) { |
122 buildCounterConstraints++; | 122 buildCounterConstraints++; |
123 if (buildCounterConstraints < 3) { | 123 if (buildCounterConstraints < 3) { |
124 unittest.expect(o.maxDatabaseEntries, unittest.equals(42)); | 124 unittest.expect(o.maxDatabaseEntries, unittest.equals(42)); |
125 unittest.expect(o.maxUpdateEntries, unittest.equals(42)); | 125 unittest.expect(o.maxUpdateEntries, unittest.equals(42)); |
126 unittest.expect(o.region, unittest.equals('foo')); | 126 unittest.expect(o.region, unittest.equals('foo')); |
127 checkUnnamed1064(o.supportedCompressions); | 127 checkUnnamed1081(o.supportedCompressions); |
128 } | 128 } |
129 buildCounterConstraints--; | 129 buildCounterConstraints--; |
130 } | 130 } |
131 | 131 |
132 buildUnnamed1065() { | 132 buildUnnamed1082() { |
133 var o = new core.List<api.ListUpdateRequest>(); | 133 var o = new core.List<api.ListUpdateRequest>(); |
134 o.add(buildListUpdateRequest()); | 134 o.add(buildListUpdateRequest()); |
135 o.add(buildListUpdateRequest()); | 135 o.add(buildListUpdateRequest()); |
136 return o; | 136 return o; |
137 } | 137 } |
138 | 138 |
139 checkUnnamed1065(core.List<api.ListUpdateRequest> o) { | 139 checkUnnamed1082(core.List<api.ListUpdateRequest> o) { |
140 unittest.expect(o, unittest.hasLength(2)); | 140 unittest.expect(o, unittest.hasLength(2)); |
141 checkListUpdateRequest(o[0]); | 141 checkListUpdateRequest(o[0]); |
142 checkListUpdateRequest(o[1]); | 142 checkListUpdateRequest(o[1]); |
143 } | 143 } |
144 | 144 |
145 core.int buildCounterFetchThreatListUpdatesRequest = 0; | 145 core.int buildCounterFetchThreatListUpdatesRequest = 0; |
146 buildFetchThreatListUpdatesRequest() { | 146 buildFetchThreatListUpdatesRequest() { |
147 var o = new api.FetchThreatListUpdatesRequest(); | 147 var o = new api.FetchThreatListUpdatesRequest(); |
148 buildCounterFetchThreatListUpdatesRequest++; | 148 buildCounterFetchThreatListUpdatesRequest++; |
149 if (buildCounterFetchThreatListUpdatesRequest < 3) { | 149 if (buildCounterFetchThreatListUpdatesRequest < 3) { |
150 o.client = buildClientInfo(); | 150 o.client = buildClientInfo(); |
151 o.listUpdateRequests = buildUnnamed1065(); | 151 o.listUpdateRequests = buildUnnamed1082(); |
152 } | 152 } |
153 buildCounterFetchThreatListUpdatesRequest--; | 153 buildCounterFetchThreatListUpdatesRequest--; |
154 return o; | 154 return o; |
155 } | 155 } |
156 | 156 |
157 checkFetchThreatListUpdatesRequest(api.FetchThreatListUpdatesRequest o) { | 157 checkFetchThreatListUpdatesRequest(api.FetchThreatListUpdatesRequest o) { |
158 buildCounterFetchThreatListUpdatesRequest++; | 158 buildCounterFetchThreatListUpdatesRequest++; |
159 if (buildCounterFetchThreatListUpdatesRequest < 3) { | 159 if (buildCounterFetchThreatListUpdatesRequest < 3) { |
160 checkClientInfo(o.client); | 160 checkClientInfo(o.client); |
161 checkUnnamed1065(o.listUpdateRequests); | 161 checkUnnamed1082(o.listUpdateRequests); |
162 } | 162 } |
163 buildCounterFetchThreatListUpdatesRequest--; | 163 buildCounterFetchThreatListUpdatesRequest--; |
164 } | 164 } |
165 | 165 |
166 buildUnnamed1066() { | 166 buildUnnamed1083() { |
167 var o = new core.List<api.ListUpdateResponse>(); | 167 var o = new core.List<api.ListUpdateResponse>(); |
168 o.add(buildListUpdateResponse()); | 168 o.add(buildListUpdateResponse()); |
169 o.add(buildListUpdateResponse()); | 169 o.add(buildListUpdateResponse()); |
170 return o; | 170 return o; |
171 } | 171 } |
172 | 172 |
173 checkUnnamed1066(core.List<api.ListUpdateResponse> o) { | 173 checkUnnamed1083(core.List<api.ListUpdateResponse> o) { |
174 unittest.expect(o, unittest.hasLength(2)); | 174 unittest.expect(o, unittest.hasLength(2)); |
175 checkListUpdateResponse(o[0]); | 175 checkListUpdateResponse(o[0]); |
176 checkListUpdateResponse(o[1]); | 176 checkListUpdateResponse(o[1]); |
177 } | 177 } |
178 | 178 |
179 core.int buildCounterFetchThreatListUpdatesResponse = 0; | 179 core.int buildCounterFetchThreatListUpdatesResponse = 0; |
180 buildFetchThreatListUpdatesResponse() { | 180 buildFetchThreatListUpdatesResponse() { |
181 var o = new api.FetchThreatListUpdatesResponse(); | 181 var o = new api.FetchThreatListUpdatesResponse(); |
182 buildCounterFetchThreatListUpdatesResponse++; | 182 buildCounterFetchThreatListUpdatesResponse++; |
183 if (buildCounterFetchThreatListUpdatesResponse < 3) { | 183 if (buildCounterFetchThreatListUpdatesResponse < 3) { |
184 o.listUpdateResponses = buildUnnamed1066(); | 184 o.listUpdateResponses = buildUnnamed1083(); |
185 o.minimumWaitDuration = "foo"; | 185 o.minimumWaitDuration = "foo"; |
186 } | 186 } |
187 buildCounterFetchThreatListUpdatesResponse--; | 187 buildCounterFetchThreatListUpdatesResponse--; |
188 return o; | 188 return o; |
189 } | 189 } |
190 | 190 |
191 checkFetchThreatListUpdatesResponse(api.FetchThreatListUpdatesResponse o) { | 191 checkFetchThreatListUpdatesResponse(api.FetchThreatListUpdatesResponse o) { |
192 buildCounterFetchThreatListUpdatesResponse++; | 192 buildCounterFetchThreatListUpdatesResponse++; |
193 if (buildCounterFetchThreatListUpdatesResponse < 3) { | 193 if (buildCounterFetchThreatListUpdatesResponse < 3) { |
194 checkUnnamed1066(o.listUpdateResponses); | 194 checkUnnamed1083(o.listUpdateResponses); |
195 unittest.expect(o.minimumWaitDuration, unittest.equals('foo')); | 195 unittest.expect(o.minimumWaitDuration, unittest.equals('foo')); |
196 } | 196 } |
197 buildCounterFetchThreatListUpdatesResponse--; | 197 buildCounterFetchThreatListUpdatesResponse--; |
198 } | 198 } |
199 | 199 |
200 buildUnnamed1067() { | 200 buildUnnamed1084() { |
201 var o = new core.List<core.String>(); | 201 var o = new core.List<core.String>(); |
202 o.add("foo"); | 202 o.add("foo"); |
203 o.add("foo"); | 203 o.add("foo"); |
204 return o; | 204 return o; |
205 } | 205 } |
206 | 206 |
207 checkUnnamed1067(core.List<core.String> o) { | 207 checkUnnamed1084(core.List<core.String> o) { |
208 unittest.expect(o, unittest.hasLength(2)); | 208 unittest.expect(o, unittest.hasLength(2)); |
209 unittest.expect(o[0], unittest.equals('foo')); | 209 unittest.expect(o[0], unittest.equals('foo')); |
210 unittest.expect(o[1], unittest.equals('foo')); | 210 unittest.expect(o[1], unittest.equals('foo')); |
211 } | 211 } |
212 | 212 |
213 core.int buildCounterFindFullHashesRequest = 0; | 213 core.int buildCounterFindFullHashesRequest = 0; |
214 buildFindFullHashesRequest() { | 214 buildFindFullHashesRequest() { |
215 var o = new api.FindFullHashesRequest(); | 215 var o = new api.FindFullHashesRequest(); |
216 buildCounterFindFullHashesRequest++; | 216 buildCounterFindFullHashesRequest++; |
217 if (buildCounterFindFullHashesRequest < 3) { | 217 if (buildCounterFindFullHashesRequest < 3) { |
218 o.apiClient = buildClientInfo(); | 218 o.apiClient = buildClientInfo(); |
219 o.client = buildClientInfo(); | 219 o.client = buildClientInfo(); |
220 o.clientStates = buildUnnamed1067(); | 220 o.clientStates = buildUnnamed1084(); |
221 o.threatInfo = buildThreatInfo(); | 221 o.threatInfo = buildThreatInfo(); |
222 } | 222 } |
223 buildCounterFindFullHashesRequest--; | 223 buildCounterFindFullHashesRequest--; |
224 return o; | 224 return o; |
225 } | 225 } |
226 | 226 |
227 checkFindFullHashesRequest(api.FindFullHashesRequest o) { | 227 checkFindFullHashesRequest(api.FindFullHashesRequest o) { |
228 buildCounterFindFullHashesRequest++; | 228 buildCounterFindFullHashesRequest++; |
229 if (buildCounterFindFullHashesRequest < 3) { | 229 if (buildCounterFindFullHashesRequest < 3) { |
230 checkClientInfo(o.apiClient); | 230 checkClientInfo(o.apiClient); |
231 checkClientInfo(o.client); | 231 checkClientInfo(o.client); |
232 checkUnnamed1067(o.clientStates); | 232 checkUnnamed1084(o.clientStates); |
233 checkThreatInfo(o.threatInfo); | 233 checkThreatInfo(o.threatInfo); |
234 } | 234 } |
235 buildCounterFindFullHashesRequest--; | 235 buildCounterFindFullHashesRequest--; |
236 } | 236 } |
237 | 237 |
238 buildUnnamed1068() { | 238 buildUnnamed1085() { |
239 var o = new core.List<api.ThreatMatch>(); | 239 var o = new core.List<api.ThreatMatch>(); |
240 o.add(buildThreatMatch()); | 240 o.add(buildThreatMatch()); |
241 o.add(buildThreatMatch()); | 241 o.add(buildThreatMatch()); |
242 return o; | 242 return o; |
243 } | 243 } |
244 | 244 |
245 checkUnnamed1068(core.List<api.ThreatMatch> o) { | 245 checkUnnamed1085(core.List<api.ThreatMatch> o) { |
246 unittest.expect(o, unittest.hasLength(2)); | 246 unittest.expect(o, unittest.hasLength(2)); |
247 checkThreatMatch(o[0]); | 247 checkThreatMatch(o[0]); |
248 checkThreatMatch(o[1]); | 248 checkThreatMatch(o[1]); |
249 } | 249 } |
250 | 250 |
251 core.int buildCounterFindFullHashesResponse = 0; | 251 core.int buildCounterFindFullHashesResponse = 0; |
252 buildFindFullHashesResponse() { | 252 buildFindFullHashesResponse() { |
253 var o = new api.FindFullHashesResponse(); | 253 var o = new api.FindFullHashesResponse(); |
254 buildCounterFindFullHashesResponse++; | 254 buildCounterFindFullHashesResponse++; |
255 if (buildCounterFindFullHashesResponse < 3) { | 255 if (buildCounterFindFullHashesResponse < 3) { |
256 o.matches = buildUnnamed1068(); | 256 o.matches = buildUnnamed1085(); |
257 o.minimumWaitDuration = "foo"; | 257 o.minimumWaitDuration = "foo"; |
258 o.negativeCacheDuration = "foo"; | 258 o.negativeCacheDuration = "foo"; |
259 } | 259 } |
260 buildCounterFindFullHashesResponse--; | 260 buildCounterFindFullHashesResponse--; |
261 return o; | 261 return o; |
262 } | 262 } |
263 | 263 |
264 checkFindFullHashesResponse(api.FindFullHashesResponse o) { | 264 checkFindFullHashesResponse(api.FindFullHashesResponse o) { |
265 buildCounterFindFullHashesResponse++; | 265 buildCounterFindFullHashesResponse++; |
266 if (buildCounterFindFullHashesResponse < 3) { | 266 if (buildCounterFindFullHashesResponse < 3) { |
267 checkUnnamed1068(o.matches); | 267 checkUnnamed1085(o.matches); |
268 unittest.expect(o.minimumWaitDuration, unittest.equals('foo')); | 268 unittest.expect(o.minimumWaitDuration, unittest.equals('foo')); |
269 unittest.expect(o.negativeCacheDuration, unittest.equals('foo')); | 269 unittest.expect(o.negativeCacheDuration, unittest.equals('foo')); |
270 } | 270 } |
271 buildCounterFindFullHashesResponse--; | 271 buildCounterFindFullHashesResponse--; |
272 } | 272 } |
273 | 273 |
274 core.int buildCounterFindThreatMatchesRequest = 0; | 274 core.int buildCounterFindThreatMatchesRequest = 0; |
275 buildFindThreatMatchesRequest() { | 275 buildFindThreatMatchesRequest() { |
276 var o = new api.FindThreatMatchesRequest(); | 276 var o = new api.FindThreatMatchesRequest(); |
277 buildCounterFindThreatMatchesRequest++; | 277 buildCounterFindThreatMatchesRequest++; |
278 if (buildCounterFindThreatMatchesRequest < 3) { | 278 if (buildCounterFindThreatMatchesRequest < 3) { |
279 o.client = buildClientInfo(); | 279 o.client = buildClientInfo(); |
280 o.threatInfo = buildThreatInfo(); | 280 o.threatInfo = buildThreatInfo(); |
281 } | 281 } |
282 buildCounterFindThreatMatchesRequest--; | 282 buildCounterFindThreatMatchesRequest--; |
283 return o; | 283 return o; |
284 } | 284 } |
285 | 285 |
286 checkFindThreatMatchesRequest(api.FindThreatMatchesRequest o) { | 286 checkFindThreatMatchesRequest(api.FindThreatMatchesRequest o) { |
287 buildCounterFindThreatMatchesRequest++; | 287 buildCounterFindThreatMatchesRequest++; |
288 if (buildCounterFindThreatMatchesRequest < 3) { | 288 if (buildCounterFindThreatMatchesRequest < 3) { |
289 checkClientInfo(o.client); | 289 checkClientInfo(o.client); |
290 checkThreatInfo(o.threatInfo); | 290 checkThreatInfo(o.threatInfo); |
291 } | 291 } |
292 buildCounterFindThreatMatchesRequest--; | 292 buildCounterFindThreatMatchesRequest--; |
293 } | 293 } |
294 | 294 |
295 buildUnnamed1069() { | 295 buildUnnamed1086() { |
296 var o = new core.List<api.ThreatMatch>(); | 296 var o = new core.List<api.ThreatMatch>(); |
297 o.add(buildThreatMatch()); | 297 o.add(buildThreatMatch()); |
298 o.add(buildThreatMatch()); | 298 o.add(buildThreatMatch()); |
299 return o; | 299 return o; |
300 } | 300 } |
301 | 301 |
302 checkUnnamed1069(core.List<api.ThreatMatch> o) { | 302 checkUnnamed1086(core.List<api.ThreatMatch> o) { |
303 unittest.expect(o, unittest.hasLength(2)); | 303 unittest.expect(o, unittest.hasLength(2)); |
304 checkThreatMatch(o[0]); | 304 checkThreatMatch(o[0]); |
305 checkThreatMatch(o[1]); | 305 checkThreatMatch(o[1]); |
306 } | 306 } |
307 | 307 |
308 core.int buildCounterFindThreatMatchesResponse = 0; | 308 core.int buildCounterFindThreatMatchesResponse = 0; |
309 buildFindThreatMatchesResponse() { | 309 buildFindThreatMatchesResponse() { |
310 var o = new api.FindThreatMatchesResponse(); | 310 var o = new api.FindThreatMatchesResponse(); |
311 buildCounterFindThreatMatchesResponse++; | 311 buildCounterFindThreatMatchesResponse++; |
312 if (buildCounterFindThreatMatchesResponse < 3) { | 312 if (buildCounterFindThreatMatchesResponse < 3) { |
313 o.matches = buildUnnamed1069(); | 313 o.matches = buildUnnamed1086(); |
314 } | 314 } |
315 buildCounterFindThreatMatchesResponse--; | 315 buildCounterFindThreatMatchesResponse--; |
316 return o; | 316 return o; |
317 } | 317 } |
318 | 318 |
319 checkFindThreatMatchesResponse(api.FindThreatMatchesResponse o) { | 319 checkFindThreatMatchesResponse(api.FindThreatMatchesResponse o) { |
320 buildCounterFindThreatMatchesResponse++; | 320 buildCounterFindThreatMatchesResponse++; |
321 if (buildCounterFindThreatMatchesResponse < 3) { | 321 if (buildCounterFindThreatMatchesResponse < 3) { |
322 checkUnnamed1069(o.matches); | 322 checkUnnamed1086(o.matches); |
323 } | 323 } |
324 buildCounterFindThreatMatchesResponse--; | 324 buildCounterFindThreatMatchesResponse--; |
325 } | 325 } |
326 | 326 |
327 buildUnnamed1070() { | 327 buildUnnamed1087() { |
328 var o = new core.List<api.ThreatListDescriptor>(); | 328 var o = new core.List<api.ThreatListDescriptor>(); |
329 o.add(buildThreatListDescriptor()); | 329 o.add(buildThreatListDescriptor()); |
330 o.add(buildThreatListDescriptor()); | 330 o.add(buildThreatListDescriptor()); |
331 return o; | 331 return o; |
332 } | 332 } |
333 | 333 |
334 checkUnnamed1070(core.List<api.ThreatListDescriptor> o) { | 334 checkUnnamed1087(core.List<api.ThreatListDescriptor> o) { |
335 unittest.expect(o, unittest.hasLength(2)); | 335 unittest.expect(o, unittest.hasLength(2)); |
336 checkThreatListDescriptor(o[0]); | 336 checkThreatListDescriptor(o[0]); |
337 checkThreatListDescriptor(o[1]); | 337 checkThreatListDescriptor(o[1]); |
338 } | 338 } |
339 | 339 |
340 core.int buildCounterListThreatListsResponse = 0; | 340 core.int buildCounterListThreatListsResponse = 0; |
341 buildListThreatListsResponse() { | 341 buildListThreatListsResponse() { |
342 var o = new api.ListThreatListsResponse(); | 342 var o = new api.ListThreatListsResponse(); |
343 buildCounterListThreatListsResponse++; | 343 buildCounterListThreatListsResponse++; |
344 if (buildCounterListThreatListsResponse < 3) { | 344 if (buildCounterListThreatListsResponse < 3) { |
345 o.threatLists = buildUnnamed1070(); | 345 o.threatLists = buildUnnamed1087(); |
346 } | 346 } |
347 buildCounterListThreatListsResponse--; | 347 buildCounterListThreatListsResponse--; |
348 return o; | 348 return o; |
349 } | 349 } |
350 | 350 |
351 checkListThreatListsResponse(api.ListThreatListsResponse o) { | 351 checkListThreatListsResponse(api.ListThreatListsResponse o) { |
352 buildCounterListThreatListsResponse++; | 352 buildCounterListThreatListsResponse++; |
353 if (buildCounterListThreatListsResponse < 3) { | 353 if (buildCounterListThreatListsResponse < 3) { |
354 checkUnnamed1070(o.threatLists); | 354 checkUnnamed1087(o.threatLists); |
355 } | 355 } |
356 buildCounterListThreatListsResponse--; | 356 buildCounterListThreatListsResponse--; |
357 } | 357 } |
358 | 358 |
359 core.int buildCounterListUpdateRequest = 0; | 359 core.int buildCounterListUpdateRequest = 0; |
360 buildListUpdateRequest() { | 360 buildListUpdateRequest() { |
361 var o = new api.ListUpdateRequest(); | 361 var o = new api.ListUpdateRequest(); |
362 buildCounterListUpdateRequest++; | 362 buildCounterListUpdateRequest++; |
363 if (buildCounterListUpdateRequest < 3) { | 363 if (buildCounterListUpdateRequest < 3) { |
364 o.constraints = buildConstraints(); | 364 o.constraints = buildConstraints(); |
(...skipping 11 matching lines...) Loading... |
376 if (buildCounterListUpdateRequest < 3) { | 376 if (buildCounterListUpdateRequest < 3) { |
377 checkConstraints(o.constraints); | 377 checkConstraints(o.constraints); |
378 unittest.expect(o.platformType, unittest.equals('foo')); | 378 unittest.expect(o.platformType, unittest.equals('foo')); |
379 unittest.expect(o.state, unittest.equals('foo')); | 379 unittest.expect(o.state, unittest.equals('foo')); |
380 unittest.expect(o.threatEntryType, unittest.equals('foo')); | 380 unittest.expect(o.threatEntryType, unittest.equals('foo')); |
381 unittest.expect(o.threatType, unittest.equals('foo')); | 381 unittest.expect(o.threatType, unittest.equals('foo')); |
382 } | 382 } |
383 buildCounterListUpdateRequest--; | 383 buildCounterListUpdateRequest--; |
384 } | 384 } |
385 | 385 |
386 buildUnnamed1071() { | 386 buildUnnamed1088() { |
387 var o = new core.List<api.ThreatEntrySet>(); | 387 var o = new core.List<api.ThreatEntrySet>(); |
388 o.add(buildThreatEntrySet()); | 388 o.add(buildThreatEntrySet()); |
389 o.add(buildThreatEntrySet()); | 389 o.add(buildThreatEntrySet()); |
390 return o; | 390 return o; |
391 } | 391 } |
392 | 392 |
393 checkUnnamed1071(core.List<api.ThreatEntrySet> o) { | 393 checkUnnamed1088(core.List<api.ThreatEntrySet> o) { |
394 unittest.expect(o, unittest.hasLength(2)); | 394 unittest.expect(o, unittest.hasLength(2)); |
395 checkThreatEntrySet(o[0]); | 395 checkThreatEntrySet(o[0]); |
396 checkThreatEntrySet(o[1]); | 396 checkThreatEntrySet(o[1]); |
397 } | 397 } |
398 | 398 |
399 buildUnnamed1072() { | 399 buildUnnamed1089() { |
400 var o = new core.List<api.ThreatEntrySet>(); | 400 var o = new core.List<api.ThreatEntrySet>(); |
401 o.add(buildThreatEntrySet()); | 401 o.add(buildThreatEntrySet()); |
402 o.add(buildThreatEntrySet()); | 402 o.add(buildThreatEntrySet()); |
403 return o; | 403 return o; |
404 } | 404 } |
405 | 405 |
406 checkUnnamed1072(core.List<api.ThreatEntrySet> o) { | 406 checkUnnamed1089(core.List<api.ThreatEntrySet> o) { |
407 unittest.expect(o, unittest.hasLength(2)); | 407 unittest.expect(o, unittest.hasLength(2)); |
408 checkThreatEntrySet(o[0]); | 408 checkThreatEntrySet(o[0]); |
409 checkThreatEntrySet(o[1]); | 409 checkThreatEntrySet(o[1]); |
410 } | 410 } |
411 | 411 |
412 core.int buildCounterListUpdateResponse = 0; | 412 core.int buildCounterListUpdateResponse = 0; |
413 buildListUpdateResponse() { | 413 buildListUpdateResponse() { |
414 var o = new api.ListUpdateResponse(); | 414 var o = new api.ListUpdateResponse(); |
415 buildCounterListUpdateResponse++; | 415 buildCounterListUpdateResponse++; |
416 if (buildCounterListUpdateResponse < 3) { | 416 if (buildCounterListUpdateResponse < 3) { |
417 o.additions = buildUnnamed1071(); | 417 o.additions = buildUnnamed1088(); |
418 o.checksum = buildChecksum(); | 418 o.checksum = buildChecksum(); |
419 o.newClientState = "foo"; | 419 o.newClientState = "foo"; |
420 o.platformType = "foo"; | 420 o.platformType = "foo"; |
421 o.removals = buildUnnamed1072(); | 421 o.removals = buildUnnamed1089(); |
422 o.responseType = "foo"; | 422 o.responseType = "foo"; |
423 o.threatEntryType = "foo"; | 423 o.threatEntryType = "foo"; |
424 o.threatType = "foo"; | 424 o.threatType = "foo"; |
425 } | 425 } |
426 buildCounterListUpdateResponse--; | 426 buildCounterListUpdateResponse--; |
427 return o; | 427 return o; |
428 } | 428 } |
429 | 429 |
430 checkListUpdateResponse(api.ListUpdateResponse o) { | 430 checkListUpdateResponse(api.ListUpdateResponse o) { |
431 buildCounterListUpdateResponse++; | 431 buildCounterListUpdateResponse++; |
432 if (buildCounterListUpdateResponse < 3) { | 432 if (buildCounterListUpdateResponse < 3) { |
433 checkUnnamed1071(o.additions); | 433 checkUnnamed1088(o.additions); |
434 checkChecksum(o.checksum); | 434 checkChecksum(o.checksum); |
435 unittest.expect(o.newClientState, unittest.equals('foo')); | 435 unittest.expect(o.newClientState, unittest.equals('foo')); |
436 unittest.expect(o.platformType, unittest.equals('foo')); | 436 unittest.expect(o.platformType, unittest.equals('foo')); |
437 checkUnnamed1072(o.removals); | 437 checkUnnamed1089(o.removals); |
438 unittest.expect(o.responseType, unittest.equals('foo')); | 438 unittest.expect(o.responseType, unittest.equals('foo')); |
439 unittest.expect(o.threatEntryType, unittest.equals('foo')); | 439 unittest.expect(o.threatEntryType, unittest.equals('foo')); |
440 unittest.expect(o.threatType, unittest.equals('foo')); | 440 unittest.expect(o.threatType, unittest.equals('foo')); |
441 } | 441 } |
442 buildCounterListUpdateResponse--; | 442 buildCounterListUpdateResponse--; |
443 } | 443 } |
444 | 444 |
445 core.int buildCounterMetadataEntry = 0; | 445 core.int buildCounterMetadataEntry = 0; |
446 buildMetadataEntry() { | 446 buildMetadataEntry() { |
447 var o = new api.MetadataEntry(); | 447 var o = new api.MetadataEntry(); |
(...skipping 29 matching lines...) Loading... |
477 | 477 |
478 checkRawHashes(api.RawHashes o) { | 478 checkRawHashes(api.RawHashes o) { |
479 buildCounterRawHashes++; | 479 buildCounterRawHashes++; |
480 if (buildCounterRawHashes < 3) { | 480 if (buildCounterRawHashes < 3) { |
481 unittest.expect(o.prefixSize, unittest.equals(42)); | 481 unittest.expect(o.prefixSize, unittest.equals(42)); |
482 unittest.expect(o.rawHashes, unittest.equals('foo')); | 482 unittest.expect(o.rawHashes, unittest.equals('foo')); |
483 } | 483 } |
484 buildCounterRawHashes--; | 484 buildCounterRawHashes--; |
485 } | 485 } |
486 | 486 |
487 buildUnnamed1073() { | 487 buildUnnamed1090() { |
488 var o = new core.List<core.int>(); | 488 var o = new core.List<core.int>(); |
489 o.add(42); | 489 o.add(42); |
490 o.add(42); | 490 o.add(42); |
491 return o; | 491 return o; |
492 } | 492 } |
493 | 493 |
494 checkUnnamed1073(core.List<core.int> o) { | 494 checkUnnamed1090(core.List<core.int> o) { |
495 unittest.expect(o, unittest.hasLength(2)); | 495 unittest.expect(o, unittest.hasLength(2)); |
496 unittest.expect(o[0], unittest.equals(42)); | 496 unittest.expect(o[0], unittest.equals(42)); |
497 unittest.expect(o[1], unittest.equals(42)); | 497 unittest.expect(o[1], unittest.equals(42)); |
498 } | 498 } |
499 | 499 |
500 core.int buildCounterRawIndices = 0; | 500 core.int buildCounterRawIndices = 0; |
501 buildRawIndices() { | 501 buildRawIndices() { |
502 var o = new api.RawIndices(); | 502 var o = new api.RawIndices(); |
503 buildCounterRawIndices++; | 503 buildCounterRawIndices++; |
504 if (buildCounterRawIndices < 3) { | 504 if (buildCounterRawIndices < 3) { |
505 o.indices = buildUnnamed1073(); | 505 o.indices = buildUnnamed1090(); |
506 } | 506 } |
507 buildCounterRawIndices--; | 507 buildCounterRawIndices--; |
508 return o; | 508 return o; |
509 } | 509 } |
510 | 510 |
511 checkRawIndices(api.RawIndices o) { | 511 checkRawIndices(api.RawIndices o) { |
512 buildCounterRawIndices++; | 512 buildCounterRawIndices++; |
513 if (buildCounterRawIndices < 3) { | 513 if (buildCounterRawIndices < 3) { |
514 checkUnnamed1073(o.indices); | 514 checkUnnamed1090(o.indices); |
515 } | 515 } |
516 buildCounterRawIndices--; | 516 buildCounterRawIndices--; |
517 } | 517 } |
518 | 518 |
519 core.int buildCounterRiceDeltaEncoding = 0; | 519 core.int buildCounterRiceDeltaEncoding = 0; |
520 buildRiceDeltaEncoding() { | 520 buildRiceDeltaEncoding() { |
521 var o = new api.RiceDeltaEncoding(); | 521 var o = new api.RiceDeltaEncoding(); |
522 buildCounterRiceDeltaEncoding++; | 522 buildCounterRiceDeltaEncoding++; |
523 if (buildCounterRiceDeltaEncoding < 3) { | 523 if (buildCounterRiceDeltaEncoding < 3) { |
524 o.encodedData = "foo"; | 524 o.encodedData = "foo"; |
(...skipping 32 matching lines...) Loading... |
557 checkThreatEntry(api.ThreatEntry o) { | 557 checkThreatEntry(api.ThreatEntry o) { |
558 buildCounterThreatEntry++; | 558 buildCounterThreatEntry++; |
559 if (buildCounterThreatEntry < 3) { | 559 if (buildCounterThreatEntry < 3) { |
560 unittest.expect(o.digest, unittest.equals('foo')); | 560 unittest.expect(o.digest, unittest.equals('foo')); |
561 unittest.expect(o.hash, unittest.equals('foo')); | 561 unittest.expect(o.hash, unittest.equals('foo')); |
562 unittest.expect(o.url, unittest.equals('foo')); | 562 unittest.expect(o.url, unittest.equals('foo')); |
563 } | 563 } |
564 buildCounterThreatEntry--; | 564 buildCounterThreatEntry--; |
565 } | 565 } |
566 | 566 |
567 buildUnnamed1074() { | 567 buildUnnamed1091() { |
568 var o = new core.List<api.MetadataEntry>(); | 568 var o = new core.List<api.MetadataEntry>(); |
569 o.add(buildMetadataEntry()); | 569 o.add(buildMetadataEntry()); |
570 o.add(buildMetadataEntry()); | 570 o.add(buildMetadataEntry()); |
571 return o; | 571 return o; |
572 } | 572 } |
573 | 573 |
574 checkUnnamed1074(core.List<api.MetadataEntry> o) { | 574 checkUnnamed1091(core.List<api.MetadataEntry> o) { |
575 unittest.expect(o, unittest.hasLength(2)); | 575 unittest.expect(o, unittest.hasLength(2)); |
576 checkMetadataEntry(o[0]); | 576 checkMetadataEntry(o[0]); |
577 checkMetadataEntry(o[1]); | 577 checkMetadataEntry(o[1]); |
578 } | 578 } |
579 | 579 |
580 core.int buildCounterThreatEntryMetadata = 0; | 580 core.int buildCounterThreatEntryMetadata = 0; |
581 buildThreatEntryMetadata() { | 581 buildThreatEntryMetadata() { |
582 var o = new api.ThreatEntryMetadata(); | 582 var o = new api.ThreatEntryMetadata(); |
583 buildCounterThreatEntryMetadata++; | 583 buildCounterThreatEntryMetadata++; |
584 if (buildCounterThreatEntryMetadata < 3) { | 584 if (buildCounterThreatEntryMetadata < 3) { |
585 o.entries = buildUnnamed1074(); | 585 o.entries = buildUnnamed1091(); |
586 } | 586 } |
587 buildCounterThreatEntryMetadata--; | 587 buildCounterThreatEntryMetadata--; |
588 return o; | 588 return o; |
589 } | 589 } |
590 | 590 |
591 checkThreatEntryMetadata(api.ThreatEntryMetadata o) { | 591 checkThreatEntryMetadata(api.ThreatEntryMetadata o) { |
592 buildCounterThreatEntryMetadata++; | 592 buildCounterThreatEntryMetadata++; |
593 if (buildCounterThreatEntryMetadata < 3) { | 593 if (buildCounterThreatEntryMetadata < 3) { |
594 checkUnnamed1074(o.entries); | 594 checkUnnamed1091(o.entries); |
595 } | 595 } |
596 buildCounterThreatEntryMetadata--; | 596 buildCounterThreatEntryMetadata--; |
597 } | 597 } |
598 | 598 |
599 core.int buildCounterThreatEntrySet = 0; | 599 core.int buildCounterThreatEntrySet = 0; |
600 buildThreatEntrySet() { | 600 buildThreatEntrySet() { |
601 var o = new api.ThreatEntrySet(); | 601 var o = new api.ThreatEntrySet(); |
602 buildCounterThreatEntrySet++; | 602 buildCounterThreatEntrySet++; |
603 if (buildCounterThreatEntrySet < 3) { | 603 if (buildCounterThreatEntrySet < 3) { |
604 o.compressionType = "foo"; | 604 o.compressionType = "foo"; |
(...skipping 11 matching lines...) Loading... |
616 if (buildCounterThreatEntrySet < 3) { | 616 if (buildCounterThreatEntrySet < 3) { |
617 unittest.expect(o.compressionType, unittest.equals('foo')); | 617 unittest.expect(o.compressionType, unittest.equals('foo')); |
618 checkRawHashes(o.rawHashes); | 618 checkRawHashes(o.rawHashes); |
619 checkRawIndices(o.rawIndices); | 619 checkRawIndices(o.rawIndices); |
620 checkRiceDeltaEncoding(o.riceHashes); | 620 checkRiceDeltaEncoding(o.riceHashes); |
621 checkRiceDeltaEncoding(o.riceIndices); | 621 checkRiceDeltaEncoding(o.riceIndices); |
622 } | 622 } |
623 buildCounterThreatEntrySet--; | 623 buildCounterThreatEntrySet--; |
624 } | 624 } |
625 | 625 |
626 buildUnnamed1075() { | 626 buildUnnamed1092() { |
627 var o = new core.List<core.String>(); | 627 var o = new core.List<core.String>(); |
628 o.add("foo"); | 628 o.add("foo"); |
629 o.add("foo"); | 629 o.add("foo"); |
630 return o; | 630 return o; |
631 } | 631 } |
632 | 632 |
633 checkUnnamed1075(core.List<core.String> o) { | 633 checkUnnamed1092(core.List<core.String> o) { |
634 unittest.expect(o, unittest.hasLength(2)); | 634 unittest.expect(o, unittest.hasLength(2)); |
635 unittest.expect(o[0], unittest.equals('foo')); | 635 unittest.expect(o[0], unittest.equals('foo')); |
636 unittest.expect(o[1], unittest.equals('foo')); | 636 unittest.expect(o[1], unittest.equals('foo')); |
637 } | 637 } |
638 | 638 |
639 buildUnnamed1076() { | 639 buildUnnamed1093() { |
640 var o = new core.List<api.ThreatEntry>(); | 640 var o = new core.List<api.ThreatEntry>(); |
641 o.add(buildThreatEntry()); | 641 o.add(buildThreatEntry()); |
642 o.add(buildThreatEntry()); | 642 o.add(buildThreatEntry()); |
643 return o; | 643 return o; |
644 } | 644 } |
645 | 645 |
646 checkUnnamed1076(core.List<api.ThreatEntry> o) { | 646 checkUnnamed1093(core.List<api.ThreatEntry> o) { |
647 unittest.expect(o, unittest.hasLength(2)); | 647 unittest.expect(o, unittest.hasLength(2)); |
648 checkThreatEntry(o[0]); | 648 checkThreatEntry(o[0]); |
649 checkThreatEntry(o[1]); | 649 checkThreatEntry(o[1]); |
650 } | 650 } |
651 | 651 |
652 buildUnnamed1077() { | 652 buildUnnamed1094() { |
653 var o = new core.List<core.String>(); | 653 var o = new core.List<core.String>(); |
654 o.add("foo"); | 654 o.add("foo"); |
655 o.add("foo"); | 655 o.add("foo"); |
656 return o; | 656 return o; |
657 } | 657 } |
658 | 658 |
659 checkUnnamed1077(core.List<core.String> o) { | 659 checkUnnamed1094(core.List<core.String> o) { |
660 unittest.expect(o, unittest.hasLength(2)); | 660 unittest.expect(o, unittest.hasLength(2)); |
661 unittest.expect(o[0], unittest.equals('foo')); | 661 unittest.expect(o[0], unittest.equals('foo')); |
662 unittest.expect(o[1], unittest.equals('foo')); | 662 unittest.expect(o[1], unittest.equals('foo')); |
663 } | 663 } |
664 | 664 |
665 buildUnnamed1078() { | 665 buildUnnamed1095() { |
666 var o = new core.List<core.String>(); | 666 var o = new core.List<core.String>(); |
667 o.add("foo"); | 667 o.add("foo"); |
668 o.add("foo"); | 668 o.add("foo"); |
669 return o; | 669 return o; |
670 } | 670 } |
671 | 671 |
672 checkUnnamed1078(core.List<core.String> o) { | 672 checkUnnamed1095(core.List<core.String> o) { |
673 unittest.expect(o, unittest.hasLength(2)); | 673 unittest.expect(o, unittest.hasLength(2)); |
674 unittest.expect(o[0], unittest.equals('foo')); | 674 unittest.expect(o[0], unittest.equals('foo')); |
675 unittest.expect(o[1], unittest.equals('foo')); | 675 unittest.expect(o[1], unittest.equals('foo')); |
676 } | 676 } |
677 | 677 |
678 core.int buildCounterThreatInfo = 0; | 678 core.int buildCounterThreatInfo = 0; |
679 buildThreatInfo() { | 679 buildThreatInfo() { |
680 var o = new api.ThreatInfo(); | 680 var o = new api.ThreatInfo(); |
681 buildCounterThreatInfo++; | 681 buildCounterThreatInfo++; |
682 if (buildCounterThreatInfo < 3) { | 682 if (buildCounterThreatInfo < 3) { |
683 o.platformTypes = buildUnnamed1075(); | 683 o.platformTypes = buildUnnamed1092(); |
684 o.threatEntries = buildUnnamed1076(); | 684 o.threatEntries = buildUnnamed1093(); |
685 o.threatEntryTypes = buildUnnamed1077(); | 685 o.threatEntryTypes = buildUnnamed1094(); |
686 o.threatTypes = buildUnnamed1078(); | 686 o.threatTypes = buildUnnamed1095(); |
687 } | 687 } |
688 buildCounterThreatInfo--; | 688 buildCounterThreatInfo--; |
689 return o; | 689 return o; |
690 } | 690 } |
691 | 691 |
692 checkThreatInfo(api.ThreatInfo o) { | 692 checkThreatInfo(api.ThreatInfo o) { |
693 buildCounterThreatInfo++; | 693 buildCounterThreatInfo++; |
694 if (buildCounterThreatInfo < 3) { | 694 if (buildCounterThreatInfo < 3) { |
695 checkUnnamed1075(o.platformTypes); | 695 checkUnnamed1092(o.platformTypes); |
696 checkUnnamed1076(o.threatEntries); | 696 checkUnnamed1093(o.threatEntries); |
697 checkUnnamed1077(o.threatEntryTypes); | 697 checkUnnamed1094(o.threatEntryTypes); |
698 checkUnnamed1078(o.threatTypes); | 698 checkUnnamed1095(o.threatTypes); |
699 } | 699 } |
700 buildCounterThreatInfo--; | 700 buildCounterThreatInfo--; |
701 } | 701 } |
702 | 702 |
703 core.int buildCounterThreatListDescriptor = 0; | 703 core.int buildCounterThreatListDescriptor = 0; |
704 buildThreatListDescriptor() { | 704 buildThreatListDescriptor() { |
705 var o = new api.ThreatListDescriptor(); | 705 var o = new api.ThreatListDescriptor(); |
706 buildCounterThreatListDescriptor++; | 706 buildCounterThreatListDescriptor++; |
707 if (buildCounterThreatListDescriptor < 3) { | 707 if (buildCounterThreatListDescriptor < 3) { |
708 o.platformType = "foo"; | 708 o.platformType = "foo"; |
(...skipping 242 matching lines...) Loading... |
951 }); | 951 }); |
952 }); | 952 }); |
953 | 953 |
954 | 954 |
955 unittest.group("resource-EncodedFullHashesResourceApi", () { | 955 unittest.group("resource-EncodedFullHashesResourceApi", () { |
956 unittest.test("method--get", () { | 956 unittest.test("method--get", () { |
957 | 957 |
958 var mock = new HttpServerMock(); | 958 var mock = new HttpServerMock(); |
959 api.EncodedFullHashesResourceApi res = new api.SafebrowsingApi(mock).encod
edFullHashes; | 959 api.EncodedFullHashesResourceApi res = new api.SafebrowsingApi(mock).encod
edFullHashes; |
960 var arg_encodedRequest = "foo"; | 960 var arg_encodedRequest = "foo"; |
| 961 var arg_clientId = "foo"; |
961 var arg_clientVersion = "foo"; | 962 var arg_clientVersion = "foo"; |
962 var arg_clientId = "foo"; | |
963 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 963 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
964 var path = (req.url).path; | 964 var path = (req.url).path; |
965 var pathOffset = 0; | 965 var pathOffset = 0; |
966 var index; | 966 var index; |
967 var subPart; | 967 var subPart; |
968 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 968 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
969 pathOffset += 1; | 969 pathOffset += 1; |
970 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("v4/encodedFullHashes/")); | 970 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("v4/encodedFullHashes/")); |
971 pathOffset += 21; | 971 pathOffset += 21; |
972 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 972 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
973 pathOffset = path.length; | 973 pathOffset = path.length; |
974 unittest.expect(subPart, unittest.equals("$arg_encodedRequest")); | 974 unittest.expect(subPart, unittest.equals("$arg_encodedRequest")); |
975 | 975 |
976 var query = (req.url).query; | 976 var query = (req.url).query; |
977 var queryOffset = 0; | 977 var queryOffset = 0; |
978 var queryMap = {}; | 978 var queryMap = {}; |
979 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 979 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
980 parseBool(n) { | 980 parseBool(n) { |
981 if (n == "true") return true; | 981 if (n == "true") return true; |
982 if (n == "false") return false; | 982 if (n == "false") return false; |
983 if (n == null) return null; | 983 if (n == null) return null; |
984 throw new core.ArgumentError("Invalid boolean: $n"); | 984 throw new core.ArgumentError("Invalid boolean: $n"); |
985 } | 985 } |
986 if (query.length > 0) { | 986 if (query.length > 0) { |
987 for (var part in query.split("&")) { | 987 for (var part in query.split("&")) { |
988 var keyvalue = part.split("="); | 988 var keyvalue = part.split("="); |
989 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 989 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
990 } | 990 } |
991 } | 991 } |
| 992 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); |
992 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli
entVersion)); | 993 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli
entVersion)); |
993 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); | |
994 | 994 |
995 | 995 |
996 var h = { | 996 var h = { |
997 "content-type" : "application/json; charset=utf-8", | 997 "content-type" : "application/json; charset=utf-8", |
998 }; | 998 }; |
999 var resp = convert.JSON.encode(buildFindFullHashesResponse()); | 999 var resp = convert.JSON.encode(buildFindFullHashesResponse()); |
1000 return new async.Future.value(stringResponse(200, h, resp)); | 1000 return new async.Future.value(stringResponse(200, h, resp)); |
1001 }), true); | 1001 }), true); |
1002 res.get(arg_encodedRequest, clientVersion: arg_clientVersion, clientId: ar
g_clientId).then(unittest.expectAsync1(((api.FindFullHashesResponse response) { | 1002 res.get(arg_encodedRequest, clientId: arg_clientId, clientVersion: arg_cli
entVersion).then(unittest.expectAsync1(((api.FindFullHashesResponse response) { |
1003 checkFindFullHashesResponse(response); | 1003 checkFindFullHashesResponse(response); |
1004 }))); | 1004 }))); |
1005 }); | 1005 }); |
1006 | 1006 |
1007 }); | 1007 }); |
1008 | 1008 |
1009 | 1009 |
1010 unittest.group("resource-EncodedUpdatesResourceApi", () { | 1010 unittest.group("resource-EncodedUpdatesResourceApi", () { |
1011 unittest.test("method--get", () { | 1011 unittest.test("method--get", () { |
1012 | 1012 |
1013 var mock = new HttpServerMock(); | 1013 var mock = new HttpServerMock(); |
1014 api.EncodedUpdatesResourceApi res = new api.SafebrowsingApi(mock).encodedU
pdates; | 1014 api.EncodedUpdatesResourceApi res = new api.SafebrowsingApi(mock).encodedU
pdates; |
1015 var arg_encodedRequest = "foo"; | 1015 var arg_encodedRequest = "foo"; |
| 1016 var arg_clientId = "foo"; |
1016 var arg_clientVersion = "foo"; | 1017 var arg_clientVersion = "foo"; |
1017 var arg_clientId = "foo"; | |
1018 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1018 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1019 var path = (req.url).path; | 1019 var path = (req.url).path; |
1020 var pathOffset = 0; | 1020 var pathOffset = 0; |
1021 var index; | 1021 var index; |
1022 var subPart; | 1022 var subPart; |
1023 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1023 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1024 pathOffset += 1; | 1024 pathOffset += 1; |
1025 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v4/encodedUpdates/")); | 1025 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v4/encodedUpdates/")); |
1026 pathOffset += 18; | 1026 pathOffset += 18; |
1027 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1027 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
1028 pathOffset = path.length; | 1028 pathOffset = path.length; |
1029 unittest.expect(subPart, unittest.equals("$arg_encodedRequest")); | 1029 unittest.expect(subPart, unittest.equals("$arg_encodedRequest")); |
1030 | 1030 |
1031 var query = (req.url).query; | 1031 var query = (req.url).query; |
1032 var queryOffset = 0; | 1032 var queryOffset = 0; |
1033 var queryMap = {}; | 1033 var queryMap = {}; |
1034 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1034 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1035 parseBool(n) { | 1035 parseBool(n) { |
1036 if (n == "true") return true; | 1036 if (n == "true") return true; |
1037 if (n == "false") return false; | 1037 if (n == "false") return false; |
1038 if (n == null) return null; | 1038 if (n == null) return null; |
1039 throw new core.ArgumentError("Invalid boolean: $n"); | 1039 throw new core.ArgumentError("Invalid boolean: $n"); |
1040 } | 1040 } |
1041 if (query.length > 0) { | 1041 if (query.length > 0) { |
1042 for (var part in query.split("&")) { | 1042 for (var part in query.split("&")) { |
1043 var keyvalue = part.split("="); | 1043 var keyvalue = part.split("="); |
1044 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1044 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
1045 } | 1045 } |
1046 } | 1046 } |
| 1047 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); |
1047 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli
entVersion)); | 1048 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli
entVersion)); |
1048 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); | |
1049 | 1049 |
1050 | 1050 |
1051 var h = { | 1051 var h = { |
1052 "content-type" : "application/json; charset=utf-8", | 1052 "content-type" : "application/json; charset=utf-8", |
1053 }; | 1053 }; |
1054 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse()); | 1054 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse()); |
1055 return new async.Future.value(stringResponse(200, h, resp)); | 1055 return new async.Future.value(stringResponse(200, h, resp)); |
1056 }), true); | 1056 }), true); |
1057 res.get(arg_encodedRequest, clientVersion: arg_clientVersion, clientId: ar
g_clientId).then(unittest.expectAsync1(((api.FetchThreatListUpdatesResponse resp
onse) { | 1057 res.get(arg_encodedRequest, clientId: arg_clientId, clientVersion: arg_cli
entVersion).then(unittest.expectAsync1(((api.FetchThreatListUpdatesResponse resp
onse) { |
1058 checkFetchThreatListUpdatesResponse(response); | 1058 checkFetchThreatListUpdatesResponse(response); |
1059 }))); | 1059 }))); |
1060 }); | 1060 }); |
1061 | 1061 |
1062 }); | 1062 }); |
1063 | 1063 |
1064 | 1064 |
1065 unittest.group("resource-FullHashesResourceApi", () { | 1065 unittest.group("resource-FullHashesResourceApi", () { |
1066 unittest.test("method--find", () { | 1066 unittest.test("method--find", () { |
1067 | 1067 |
(...skipping 189 matching lines...) Loading... |
1257 res.find(arg_request).then(unittest.expectAsync1(((api.FindThreatMatchesRe
sponse response) { | 1257 res.find(arg_request).then(unittest.expectAsync1(((api.FindThreatMatchesRe
sponse response) { |
1258 checkFindThreatMatchesResponse(response); | 1258 checkFindThreatMatchesResponse(response); |
1259 }))); | 1259 }))); |
1260 }); | 1260 }); |
1261 | 1261 |
1262 }); | 1262 }); |
1263 | 1263 |
1264 | 1264 |
1265 } | 1265 } |
1266 | 1266 |
OLD | NEW |