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:unittest/unittest.dart' as unittest; | 10 import 'package:test/test.dart' as unittest; |
11 | 11 |
12 import 'package:googleapis/safebrowsing/v4.dart' as api; | 12 import 'package:googleapis/safebrowsing/v4.dart' as api; |
13 | 13 |
14 class HttpServerMock extends http.BaseClient { | 14 class HttpServerMock extends http.BaseClient { |
15 core.Function _callback; | 15 core.Function _callback; |
16 core.bool _expectJson; | 16 core.bool _expectJson; |
17 | 17 |
18 void register(core.Function callback, core.bool expectJson) { | 18 void register(core.Function callback, core.bool expectJson) { |
19 _callback = callback; | 19 _callback = callback; |
20 _expectJson = expectJson; | 20 _expectJson = expectJson; |
(...skipping 18 matching lines...) Expand all Loading... |
39 } else { | 39 } else { |
40 return stream.toBytes().then((data) { | 40 return stream.toBytes().then((data) { |
41 return _callback(request, data); | 41 return _callback(request, data); |
42 }); | 42 }); |
43 } | 43 } |
44 } | 44 } |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 51 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 52 } |
53 | 53 |
54 core.int buildCounterChecksum = 0; | 54 core.int buildCounterChecksum = 0; |
55 buildChecksum() { | 55 buildChecksum() { |
56 var o = new api.Checksum(); | 56 var o = new api.Checksum(); |
57 buildCounterChecksum++; | 57 buildCounterChecksum++; |
58 if (buildCounterChecksum < 3) { | 58 if (buildCounterChecksum < 3) { |
59 o.sha256 = "foo"; | 59 o.sha256 = "foo"; |
(...skipping 24 matching lines...) Expand all 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 buildUnnamed1006() { | 94 buildUnnamed1013() { |
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 checkUnnamed1006(core.List<core.String> o) { | 101 checkUnnamed1013(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 = buildUnnamed1006(); | 115 o.supportedCompressions = buildUnnamed1013(); |
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 checkUnnamed1006(o.supportedCompressions); | 127 checkUnnamed1013(o.supportedCompressions); |
128 } | 128 } |
129 buildCounterConstraints--; | 129 buildCounterConstraints--; |
130 } | 130 } |
131 | 131 |
132 buildUnnamed1007() { | 132 buildUnnamed1014() { |
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 checkUnnamed1007(core.List<api.ListUpdateRequest> o) { | 139 checkUnnamed1014(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 = buildUnnamed1007(); | 151 o.listUpdateRequests = buildUnnamed1014(); |
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 checkUnnamed1007(o.listUpdateRequests); | 161 checkUnnamed1014(o.listUpdateRequests); |
162 } | 162 } |
163 buildCounterFetchThreatListUpdatesRequest--; | 163 buildCounterFetchThreatListUpdatesRequest--; |
164 } | 164 } |
165 | 165 |
166 buildUnnamed1008() { | 166 buildUnnamed1015() { |
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 checkUnnamed1008(core.List<api.ListUpdateResponse> o) { | 173 checkUnnamed1015(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 = buildUnnamed1008(); | 184 o.listUpdateResponses = buildUnnamed1015(); |
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 checkUnnamed1008(o.listUpdateResponses); | 194 checkUnnamed1015(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 buildUnnamed1009() { | 200 buildUnnamed1016() { |
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 checkUnnamed1009(core.List<core.String> o) { | 207 checkUnnamed1016(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 = buildUnnamed1009(); | 220 o.clientStates = buildUnnamed1016(); |
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 checkUnnamed1009(o.clientStates); | 232 checkUnnamed1016(o.clientStates); |
233 checkThreatInfo(o.threatInfo); | 233 checkThreatInfo(o.threatInfo); |
234 } | 234 } |
235 buildCounterFindFullHashesRequest--; | 235 buildCounterFindFullHashesRequest--; |
236 } | 236 } |
237 | 237 |
238 buildUnnamed1010() { | 238 buildUnnamed1017() { |
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 checkUnnamed1010(core.List<api.ThreatMatch> o) { | 245 checkUnnamed1017(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 = buildUnnamed1010(); | 256 o.matches = buildUnnamed1017(); |
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 checkUnnamed1010(o.matches); | 267 checkUnnamed1017(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 buildUnnamed1011() { | 295 buildUnnamed1018() { |
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 checkUnnamed1011(core.List<api.ThreatMatch> o) { | 302 checkUnnamed1018(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 = buildUnnamed1011(); | 313 o.matches = buildUnnamed1018(); |
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 checkUnnamed1011(o.matches); | 322 checkUnnamed1018(o.matches); |
323 } | 323 } |
324 buildCounterFindThreatMatchesResponse--; | 324 buildCounterFindThreatMatchesResponse--; |
325 } | 325 } |
326 | 326 |
327 buildUnnamed1012() { | 327 buildUnnamed1019() { |
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 checkUnnamed1012(core.List<api.ThreatListDescriptor> o) { | 334 checkUnnamed1019(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 = buildUnnamed1012(); | 345 o.threatLists = buildUnnamed1019(); |
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 checkUnnamed1012(o.threatLists); | 354 checkUnnamed1019(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...) Expand all 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 buildUnnamed1013() { | 386 buildUnnamed1020() { |
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 checkUnnamed1013(core.List<api.ThreatEntrySet> o) { | 393 checkUnnamed1020(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 buildUnnamed1014() { | 399 buildUnnamed1021() { |
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 checkUnnamed1014(core.List<api.ThreatEntrySet> o) { | 406 checkUnnamed1021(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 = buildUnnamed1013(); | 417 o.additions = buildUnnamed1020(); |
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 = buildUnnamed1014(); | 421 o.removals = buildUnnamed1021(); |
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 checkUnnamed1013(o.additions); | 433 checkUnnamed1020(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 checkUnnamed1014(o.removals); | 437 checkUnnamed1021(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...) Expand all 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 buildUnnamed1015() { | 487 buildUnnamed1022() { |
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 checkUnnamed1015(core.List<core.int> o) { | 494 checkUnnamed1022(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 = buildUnnamed1015(); | 505 o.indices = buildUnnamed1022(); |
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 checkUnnamed1015(o.indices); | 514 checkUnnamed1022(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...) Expand 10 before | Expand all | Expand 10 after 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 buildUnnamed1016() { | 567 buildUnnamed1023() { |
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 checkUnnamed1016(core.List<api.MetadataEntry> o) { | 574 checkUnnamed1023(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 = buildUnnamed1016(); | 585 o.entries = buildUnnamed1023(); |
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 checkUnnamed1016(o.entries); | 594 checkUnnamed1023(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...) Expand all 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 buildUnnamed1017() { | 626 buildUnnamed1024() { |
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 checkUnnamed1017(core.List<core.String> o) { | 633 checkUnnamed1024(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 buildUnnamed1018() { | 639 buildUnnamed1025() { |
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 checkUnnamed1018(core.List<api.ThreatEntry> o) { | 646 checkUnnamed1025(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 buildUnnamed1019() { | 652 buildUnnamed1026() { |
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 checkUnnamed1019(core.List<core.String> o) { | 659 checkUnnamed1026(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 buildUnnamed1020() { | 665 buildUnnamed1027() { |
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 checkUnnamed1020(core.List<core.String> o) { | 672 checkUnnamed1027(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 = buildUnnamed1017(); | 683 o.platformTypes = buildUnnamed1024(); |
684 o.threatEntries = buildUnnamed1018(); | 684 o.threatEntries = buildUnnamed1025(); |
685 o.threatEntryTypes = buildUnnamed1019(); | 685 o.threatEntryTypes = buildUnnamed1026(); |
686 o.threatTypes = buildUnnamed1020(); | 686 o.threatTypes = buildUnnamed1027(); |
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 checkUnnamed1017(o.platformTypes); | 695 checkUnnamed1024(o.platformTypes); |
696 checkUnnamed1018(o.threatEntries); | 696 checkUnnamed1025(o.threatEntries); |
697 checkUnnamed1019(o.threatEntryTypes); | 697 checkUnnamed1026(o.threatEntryTypes); |
698 checkUnnamed1020(o.threatTypes); | 698 checkUnnamed1027(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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_clientId = "foo"; |
962 var arg_clientVersion = "foo"; | 962 var arg_clientVersion = "foo"; |
963 mock.register(unittest.expectAsync((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; |
(...skipping 18 matching lines...) Expand all Loading... |
992 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); | 992 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); |
993 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli
entVersion)); | 993 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli
entVersion)); |
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, clientId: arg_clientId, clientVersion: arg_cli
entVersion).then(unittest.expectAsync(((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_clientVersion = "foo"; |
1016 var arg_clientId = "foo"; | 1017 var arg_clientId = "foo"; |
1017 var arg_clientVersion = "foo"; | 1018 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1018 mock.register(unittest.expectAsync((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["clientVersion"].first, unittest.equals(arg_cli
entVersion)); |
1047 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); | 1048 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId
)); |
1048 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli
entVersion)); | |
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, clientId: arg_clientId, clientVersion: arg_cli
entVersion).then(unittest.expectAsync(((api.FetchThreatListUpdatesResponse respo
nse) { | 1057 res.get(arg_encodedRequest, clientVersion: arg_clientVersion, clientId: ar
g_clientId).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 |
1068 var mock = new HttpServerMock(); | 1068 var mock = new HttpServerMock(); |
1069 api.FullHashesResourceApi res = new api.SafebrowsingApi(mock).fullHashes; | 1069 api.FullHashesResourceApi res = new api.SafebrowsingApi(mock).fullHashes; |
1070 var arg_request = buildFindFullHashesRequest(); | 1070 var arg_request = buildFindFullHashesRequest(); |
1071 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1071 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1072 var obj = new api.FindFullHashesRequest.fromJson(json); | 1072 var obj = new api.FindFullHashesRequest.fromJson(json); |
1073 checkFindFullHashesRequest(obj); | 1073 checkFindFullHashesRequest(obj); |
1074 | 1074 |
1075 var path = (req.url).path; | 1075 var path = (req.url).path; |
1076 var pathOffset = 0; | 1076 var pathOffset = 0; |
1077 var index; | 1077 var index; |
1078 var subPart; | 1078 var subPart; |
1079 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1079 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1080 pathOffset += 1; | 1080 pathOffset += 1; |
1081 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v4/fullHashes:find")); | 1081 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v4/fullHashes:find")); |
(...skipping 16 matching lines...) Expand all Loading... |
1098 } | 1098 } |
1099 } | 1099 } |
1100 | 1100 |
1101 | 1101 |
1102 var h = { | 1102 var h = { |
1103 "content-type" : "application/json; charset=utf-8", | 1103 "content-type" : "application/json; charset=utf-8", |
1104 }; | 1104 }; |
1105 var resp = convert.JSON.encode(buildFindFullHashesResponse()); | 1105 var resp = convert.JSON.encode(buildFindFullHashesResponse()); |
1106 return new async.Future.value(stringResponse(200, h, resp)); | 1106 return new async.Future.value(stringResponse(200, h, resp)); |
1107 }), true); | 1107 }), true); |
1108 res.find(arg_request).then(unittest.expectAsync(((api.FindFullHashesRespon
se response) { | 1108 res.find(arg_request).then(unittest.expectAsync1(((api.FindFullHashesRespo
nse response) { |
1109 checkFindFullHashesResponse(response); | 1109 checkFindFullHashesResponse(response); |
1110 }))); | 1110 }))); |
1111 }); | 1111 }); |
1112 | 1112 |
1113 }); | 1113 }); |
1114 | 1114 |
1115 | 1115 |
1116 unittest.group("resource-ThreatListUpdatesResourceApi", () { | 1116 unittest.group("resource-ThreatListUpdatesResourceApi", () { |
1117 unittest.test("method--fetch", () { | 1117 unittest.test("method--fetch", () { |
1118 | 1118 |
1119 var mock = new HttpServerMock(); | 1119 var mock = new HttpServerMock(); |
1120 api.ThreatListUpdatesResourceApi res = new api.SafebrowsingApi(mock).threa
tListUpdates; | 1120 api.ThreatListUpdatesResourceApi res = new api.SafebrowsingApi(mock).threa
tListUpdates; |
1121 var arg_request = buildFetchThreatListUpdatesRequest(); | 1121 var arg_request = buildFetchThreatListUpdatesRequest(); |
1122 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1122 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1123 var obj = new api.FetchThreatListUpdatesRequest.fromJson(json); | 1123 var obj = new api.FetchThreatListUpdatesRequest.fromJson(json); |
1124 checkFetchThreatListUpdatesRequest(obj); | 1124 checkFetchThreatListUpdatesRequest(obj); |
1125 | 1125 |
1126 var path = (req.url).path; | 1126 var path = (req.url).path; |
1127 var pathOffset = 0; | 1127 var pathOffset = 0; |
1128 var index; | 1128 var index; |
1129 var subPart; | 1129 var subPart; |
1130 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1130 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1131 pathOffset += 1; | 1131 pathOffset += 1; |
1132 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("v4/threatListUpdates:fetch")); | 1132 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("v4/threatListUpdates:fetch")); |
(...skipping 16 matching lines...) Expand all Loading... |
1149 } | 1149 } |
1150 } | 1150 } |
1151 | 1151 |
1152 | 1152 |
1153 var h = { | 1153 var h = { |
1154 "content-type" : "application/json; charset=utf-8", | 1154 "content-type" : "application/json; charset=utf-8", |
1155 }; | 1155 }; |
1156 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse()); | 1156 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse()); |
1157 return new async.Future.value(stringResponse(200, h, resp)); | 1157 return new async.Future.value(stringResponse(200, h, resp)); |
1158 }), true); | 1158 }), true); |
1159 res.fetch(arg_request).then(unittest.expectAsync(((api.FetchThreatListUpda
tesResponse response) { | 1159 res.fetch(arg_request).then(unittest.expectAsync1(((api.FetchThreatListUpd
atesResponse response) { |
1160 checkFetchThreatListUpdatesResponse(response); | 1160 checkFetchThreatListUpdatesResponse(response); |
1161 }))); | 1161 }))); |
1162 }); | 1162 }); |
1163 | 1163 |
1164 }); | 1164 }); |
1165 | 1165 |
1166 | 1166 |
1167 unittest.group("resource-ThreatListsResourceApi", () { | 1167 unittest.group("resource-ThreatListsResourceApi", () { |
1168 unittest.test("method--list", () { | 1168 unittest.test("method--list", () { |
1169 | 1169 |
1170 var mock = new HttpServerMock(); | 1170 var mock = new HttpServerMock(); |
1171 api.ThreatListsResourceApi res = new api.SafebrowsingApi(mock).threatLists
; | 1171 api.ThreatListsResourceApi res = new api.SafebrowsingApi(mock).threatLists
; |
1172 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1172 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1173 var path = (req.url).path; | 1173 var path = (req.url).path; |
1174 var pathOffset = 0; | 1174 var pathOffset = 0; |
1175 var index; | 1175 var index; |
1176 var subPart; | 1176 var subPart; |
1177 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1177 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1178 pathOffset += 1; | 1178 pathOffset += 1; |
1179 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v4/threatLists")); | 1179 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v4/threatLists")); |
1180 pathOffset += 14; | 1180 pathOffset += 14; |
1181 | 1181 |
1182 var query = (req.url).query; | 1182 var query = (req.url).query; |
(...skipping 13 matching lines...) Expand all Loading... |
1196 } | 1196 } |
1197 } | 1197 } |
1198 | 1198 |
1199 | 1199 |
1200 var h = { | 1200 var h = { |
1201 "content-type" : "application/json; charset=utf-8", | 1201 "content-type" : "application/json; charset=utf-8", |
1202 }; | 1202 }; |
1203 var resp = convert.JSON.encode(buildListThreatListsResponse()); | 1203 var resp = convert.JSON.encode(buildListThreatListsResponse()); |
1204 return new async.Future.value(stringResponse(200, h, resp)); | 1204 return new async.Future.value(stringResponse(200, h, resp)); |
1205 }), true); | 1205 }), true); |
1206 res.list().then(unittest.expectAsync(((api.ListThreatListsResponse respons
e) { | 1206 res.list().then(unittest.expectAsync1(((api.ListThreatListsResponse respon
se) { |
1207 checkListThreatListsResponse(response); | 1207 checkListThreatListsResponse(response); |
1208 }))); | 1208 }))); |
1209 }); | 1209 }); |
1210 | 1210 |
1211 }); | 1211 }); |
1212 | 1212 |
1213 | 1213 |
1214 unittest.group("resource-ThreatMatchesResourceApi", () { | 1214 unittest.group("resource-ThreatMatchesResourceApi", () { |
1215 unittest.test("method--find", () { | 1215 unittest.test("method--find", () { |
1216 | 1216 |
1217 var mock = new HttpServerMock(); | 1217 var mock = new HttpServerMock(); |
1218 api.ThreatMatchesResourceApi res = new api.SafebrowsingApi(mock).threatMat
ches; | 1218 api.ThreatMatchesResourceApi res = new api.SafebrowsingApi(mock).threatMat
ches; |
1219 var arg_request = buildFindThreatMatchesRequest(); | 1219 var arg_request = buildFindThreatMatchesRequest(); |
1220 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1220 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1221 var obj = new api.FindThreatMatchesRequest.fromJson(json); | 1221 var obj = new api.FindThreatMatchesRequest.fromJson(json); |
1222 checkFindThreatMatchesRequest(obj); | 1222 checkFindThreatMatchesRequest(obj); |
1223 | 1223 |
1224 var path = (req.url).path; | 1224 var path = (req.url).path; |
1225 var pathOffset = 0; | 1225 var pathOffset = 0; |
1226 var index; | 1226 var index; |
1227 var subPart; | 1227 var subPart; |
1228 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1228 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1229 pathOffset += 1; | 1229 pathOffset += 1; |
1230 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("v4/threatMatches:find")); | 1230 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("v4/threatMatches:find")); |
(...skipping 16 matching lines...) Expand all Loading... |
1247 } | 1247 } |
1248 } | 1248 } |
1249 | 1249 |
1250 | 1250 |
1251 var h = { | 1251 var h = { |
1252 "content-type" : "application/json; charset=utf-8", | 1252 "content-type" : "application/json; charset=utf-8", |
1253 }; | 1253 }; |
1254 var resp = convert.JSON.encode(buildFindThreatMatchesResponse()); | 1254 var resp = convert.JSON.encode(buildFindThreatMatchesResponse()); |
1255 return new async.Future.value(stringResponse(200, h, resp)); | 1255 return new async.Future.value(stringResponse(200, h, resp)); |
1256 }), true); | 1256 }), true); |
1257 res.find(arg_request).then(unittest.expectAsync(((api.FindThreatMatchesRes
ponse 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 |