Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: generated/googleapis/test/safebrowsing/v4_test.dart

Issue 3006323002: Api-Roll 54: 2017-09-11 (Closed)
Patch Set: use 2.0.0-dev.infinity sdk constraint in pubspecs Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
5 import "dart:async" as async; 4 import "dart:async" as async;
6 import "dart:convert" as convert; 5 import "dart:convert" as convert;
7 6
8 import 'package:http/http.dart' as http; 7 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing;
10 import 'package:test/test.dart' as unittest; 8 import 'package:test/test.dart' as unittest;
11 9
12 import 'package:googleapis/safebrowsing/v4.dart' as api; 10 import 'package:googleapis/safebrowsing/v4.dart' as api;
13 11
14 class HttpServerMock extends http.BaseClient { 12 class HttpServerMock extends http.BaseClient {
15 core.Function _callback; 13 core.Function _callback;
16 core.bool _expectJson; 14 core.bool _expectJson;
17 15
18 void register(core.Function callback, core.bool expectJson) { 16 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback; 17 _callback = callback;
20 _expectJson = expectJson; 18 _expectJson = expectJson;
21 } 19 }
22 20
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) {
24 if (_expectJson) { 22 if (_expectJson) {
25 return request.finalize() 23 return request
24 .finalize()
26 .transform(convert.UTF8.decoder) 25 .transform(convert.UTF8.decoder)
27 .join('') 26 .join('')
28 .then((core.String jsonString) { 27 .then((core.String jsonString) {
29 if (jsonString.isEmpty) { 28 if (jsonString.isEmpty) {
30 return _callback(request, null); 29 return _callback(request, null);
31 } else { 30 } else {
32 return _callback(request, convert.JSON.decode(jsonString)); 31 return _callback(request, convert.JSON.decode(jsonString));
33 } 32 }
34 }); 33 });
35 } else { 34 } else {
36 var stream = request.finalize(); 35 var stream = request.finalize();
37 if (stream == null) { 36 if (stream == null) {
38 return _callback(request, []); 37 return _callback(request, []);
39 } else { 38 } else {
40 return stream.toBytes().then((data) { 39 return stream.toBytes().then((data) {
41 return _callback(request, data); 40 return _callback(request, data);
42 }); 41 });
43 } 42 }
44 } 43 }
45 } 44 }
46 } 45 }
47 46
48 http.StreamedResponse stringResponse( 47 http.StreamedResponse stringResponse(core.int status,
49 core.int status, core.Map<core.String, core.String> headers, core.String bod y) { 48 core.Map<core.String, core.String> headers, core.String body) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers); 50 return new http.StreamedResponse(stream, status, headers: headers);
52 } 51 }
53 52
54 core.int buildCounterChecksum = 0; 53 core.int buildCounterChecksum = 0;
55 buildChecksum() { 54 buildChecksum() {
56 var o = new api.Checksum(); 55 var o = new api.Checksum();
57 buildCounterChecksum++; 56 buildCounterChecksum++;
58 if (buildCounterChecksum < 3) { 57 if (buildCounterChecksum < 3) {
59 o.sha256 = "foo"; 58 o.sha256 = "foo";
(...skipping 24 matching lines...) Expand all
84 83
85 checkClientInfo(api.ClientInfo o) { 84 checkClientInfo(api.ClientInfo o) {
86 buildCounterClientInfo++; 85 buildCounterClientInfo++;
87 if (buildCounterClientInfo < 3) { 86 if (buildCounterClientInfo < 3) {
88 unittest.expect(o.clientId, unittest.equals('foo')); 87 unittest.expect(o.clientId, unittest.equals('foo'));
89 unittest.expect(o.clientVersion, unittest.equals('foo')); 88 unittest.expect(o.clientVersion, unittest.equals('foo'));
90 } 89 }
91 buildCounterClientInfo--; 90 buildCounterClientInfo--;
92 } 91 }
93 92
94 buildUnnamed1081() { 93 buildUnnamed1084() {
95 var o = new core.List<core.String>(); 94 var o = new core.List<core.String>();
96 o.add("foo"); 95 o.add("foo");
97 o.add("foo"); 96 o.add("foo");
98 return o; 97 return o;
99 } 98 }
100 99
101 checkUnnamed1081(core.List<core.String> o) { 100 checkUnnamed1084(core.List<core.String> o) {
102 unittest.expect(o, unittest.hasLength(2)); 101 unittest.expect(o, unittest.hasLength(2));
103 unittest.expect(o[0], unittest.equals('foo')); 102 unittest.expect(o[0], unittest.equals('foo'));
104 unittest.expect(o[1], unittest.equals('foo')); 103 unittest.expect(o[1], unittest.equals('foo'));
105 } 104 }
106 105
107 core.int buildCounterConstraints = 0; 106 core.int buildCounterConstraints = 0;
108 buildConstraints() { 107 buildConstraints() {
109 var o = new api.Constraints(); 108 var o = new api.Constraints();
110 buildCounterConstraints++; 109 buildCounterConstraints++;
111 if (buildCounterConstraints < 3) { 110 if (buildCounterConstraints < 3) {
112 o.maxDatabaseEntries = 42; 111 o.maxDatabaseEntries = 42;
113 o.maxUpdateEntries = 42; 112 o.maxUpdateEntries = 42;
114 o.region = "foo"; 113 o.region = "foo";
115 o.supportedCompressions = buildUnnamed1081(); 114 o.supportedCompressions = buildUnnamed1084();
116 } 115 }
117 buildCounterConstraints--; 116 buildCounterConstraints--;
118 return o; 117 return o;
119 } 118 }
120 119
121 checkConstraints(api.Constraints o) { 120 checkConstraints(api.Constraints o) {
122 buildCounterConstraints++; 121 buildCounterConstraints++;
123 if (buildCounterConstraints < 3) { 122 if (buildCounterConstraints < 3) {
124 unittest.expect(o.maxDatabaseEntries, unittest.equals(42)); 123 unittest.expect(o.maxDatabaseEntries, unittest.equals(42));
125 unittest.expect(o.maxUpdateEntries, unittest.equals(42)); 124 unittest.expect(o.maxUpdateEntries, unittest.equals(42));
126 unittest.expect(o.region, unittest.equals('foo')); 125 unittest.expect(o.region, unittest.equals('foo'));
127 checkUnnamed1081(o.supportedCompressions); 126 checkUnnamed1084(o.supportedCompressions);
128 } 127 }
129 buildCounterConstraints--; 128 buildCounterConstraints--;
130 } 129 }
131 130
132 buildUnnamed1082() { 131 buildUnnamed1085() {
133 var o = new core.List<api.ListUpdateRequest>(); 132 var o = new core.List<api.ListUpdateRequest>();
134 o.add(buildListUpdateRequest()); 133 o.add(buildListUpdateRequest());
135 o.add(buildListUpdateRequest()); 134 o.add(buildListUpdateRequest());
136 return o; 135 return o;
137 } 136 }
138 137
139 checkUnnamed1082(core.List<api.ListUpdateRequest> o) { 138 checkUnnamed1085(core.List<api.ListUpdateRequest> o) {
140 unittest.expect(o, unittest.hasLength(2)); 139 unittest.expect(o, unittest.hasLength(2));
141 checkListUpdateRequest(o[0]); 140 checkListUpdateRequest(o[0]);
142 checkListUpdateRequest(o[1]); 141 checkListUpdateRequest(o[1]);
143 } 142 }
144 143
145 core.int buildCounterFetchThreatListUpdatesRequest = 0; 144 core.int buildCounterFetchThreatListUpdatesRequest = 0;
146 buildFetchThreatListUpdatesRequest() { 145 buildFetchThreatListUpdatesRequest() {
147 var o = new api.FetchThreatListUpdatesRequest(); 146 var o = new api.FetchThreatListUpdatesRequest();
148 buildCounterFetchThreatListUpdatesRequest++; 147 buildCounterFetchThreatListUpdatesRequest++;
149 if (buildCounterFetchThreatListUpdatesRequest < 3) { 148 if (buildCounterFetchThreatListUpdatesRequest < 3) {
150 o.client = buildClientInfo(); 149 o.client = buildClientInfo();
151 o.listUpdateRequests = buildUnnamed1082(); 150 o.listUpdateRequests = buildUnnamed1085();
152 } 151 }
153 buildCounterFetchThreatListUpdatesRequest--; 152 buildCounterFetchThreatListUpdatesRequest--;
154 return o; 153 return o;
155 } 154 }
156 155
157 checkFetchThreatListUpdatesRequest(api.FetchThreatListUpdatesRequest o) { 156 checkFetchThreatListUpdatesRequest(api.FetchThreatListUpdatesRequest o) {
158 buildCounterFetchThreatListUpdatesRequest++; 157 buildCounterFetchThreatListUpdatesRequest++;
159 if (buildCounterFetchThreatListUpdatesRequest < 3) { 158 if (buildCounterFetchThreatListUpdatesRequest < 3) {
160 checkClientInfo(o.client); 159 checkClientInfo(o.client);
161 checkUnnamed1082(o.listUpdateRequests); 160 checkUnnamed1085(o.listUpdateRequests);
162 } 161 }
163 buildCounterFetchThreatListUpdatesRequest--; 162 buildCounterFetchThreatListUpdatesRequest--;
164 } 163 }
165 164
166 buildUnnamed1083() { 165 buildUnnamed1086() {
167 var o = new core.List<api.ListUpdateResponse>(); 166 var o = new core.List<api.ListUpdateResponse>();
168 o.add(buildListUpdateResponse()); 167 o.add(buildListUpdateResponse());
169 o.add(buildListUpdateResponse()); 168 o.add(buildListUpdateResponse());
170 return o; 169 return o;
171 } 170 }
172 171
173 checkUnnamed1083(core.List<api.ListUpdateResponse> o) { 172 checkUnnamed1086(core.List<api.ListUpdateResponse> o) {
174 unittest.expect(o, unittest.hasLength(2)); 173 unittest.expect(o, unittest.hasLength(2));
175 checkListUpdateResponse(o[0]); 174 checkListUpdateResponse(o[0]);
176 checkListUpdateResponse(o[1]); 175 checkListUpdateResponse(o[1]);
177 } 176 }
178 177
179 core.int buildCounterFetchThreatListUpdatesResponse = 0; 178 core.int buildCounterFetchThreatListUpdatesResponse = 0;
180 buildFetchThreatListUpdatesResponse() { 179 buildFetchThreatListUpdatesResponse() {
181 var o = new api.FetchThreatListUpdatesResponse(); 180 var o = new api.FetchThreatListUpdatesResponse();
182 buildCounterFetchThreatListUpdatesResponse++; 181 buildCounterFetchThreatListUpdatesResponse++;
183 if (buildCounterFetchThreatListUpdatesResponse < 3) { 182 if (buildCounterFetchThreatListUpdatesResponse < 3) {
184 o.listUpdateResponses = buildUnnamed1083(); 183 o.listUpdateResponses = buildUnnamed1086();
185 o.minimumWaitDuration = "foo"; 184 o.minimumWaitDuration = "foo";
186 } 185 }
187 buildCounterFetchThreatListUpdatesResponse--; 186 buildCounterFetchThreatListUpdatesResponse--;
188 return o; 187 return o;
189 } 188 }
190 189
191 checkFetchThreatListUpdatesResponse(api.FetchThreatListUpdatesResponse o) { 190 checkFetchThreatListUpdatesResponse(api.FetchThreatListUpdatesResponse o) {
192 buildCounterFetchThreatListUpdatesResponse++; 191 buildCounterFetchThreatListUpdatesResponse++;
193 if (buildCounterFetchThreatListUpdatesResponse < 3) { 192 if (buildCounterFetchThreatListUpdatesResponse < 3) {
194 checkUnnamed1083(o.listUpdateResponses); 193 checkUnnamed1086(o.listUpdateResponses);
195 unittest.expect(o.minimumWaitDuration, unittest.equals('foo')); 194 unittest.expect(o.minimumWaitDuration, unittest.equals('foo'));
196 } 195 }
197 buildCounterFetchThreatListUpdatesResponse--; 196 buildCounterFetchThreatListUpdatesResponse--;
198 } 197 }
199 198
200 buildUnnamed1084() { 199 buildUnnamed1087() {
201 var o = new core.List<core.String>(); 200 var o = new core.List<core.String>();
202 o.add("foo"); 201 o.add("foo");
203 o.add("foo"); 202 o.add("foo");
204 return o; 203 return o;
205 } 204 }
206 205
207 checkUnnamed1084(core.List<core.String> o) { 206 checkUnnamed1087(core.List<core.String> o) {
208 unittest.expect(o, unittest.hasLength(2)); 207 unittest.expect(o, unittest.hasLength(2));
209 unittest.expect(o[0], unittest.equals('foo')); 208 unittest.expect(o[0], unittest.equals('foo'));
210 unittest.expect(o[1], unittest.equals('foo')); 209 unittest.expect(o[1], unittest.equals('foo'));
211 } 210 }
212 211
213 core.int buildCounterFindFullHashesRequest = 0; 212 core.int buildCounterFindFullHashesRequest = 0;
214 buildFindFullHashesRequest() { 213 buildFindFullHashesRequest() {
215 var o = new api.FindFullHashesRequest(); 214 var o = new api.FindFullHashesRequest();
216 buildCounterFindFullHashesRequest++; 215 buildCounterFindFullHashesRequest++;
217 if (buildCounterFindFullHashesRequest < 3) { 216 if (buildCounterFindFullHashesRequest < 3) {
218 o.apiClient = buildClientInfo(); 217 o.apiClient = buildClientInfo();
219 o.client = buildClientInfo(); 218 o.client = buildClientInfo();
220 o.clientStates = buildUnnamed1084(); 219 o.clientStates = buildUnnamed1087();
221 o.threatInfo = buildThreatInfo(); 220 o.threatInfo = buildThreatInfo();
222 } 221 }
223 buildCounterFindFullHashesRequest--; 222 buildCounterFindFullHashesRequest--;
224 return o; 223 return o;
225 } 224 }
226 225
227 checkFindFullHashesRequest(api.FindFullHashesRequest o) { 226 checkFindFullHashesRequest(api.FindFullHashesRequest o) {
228 buildCounterFindFullHashesRequest++; 227 buildCounterFindFullHashesRequest++;
229 if (buildCounterFindFullHashesRequest < 3) { 228 if (buildCounterFindFullHashesRequest < 3) {
230 checkClientInfo(o.apiClient); 229 checkClientInfo(o.apiClient);
231 checkClientInfo(o.client); 230 checkClientInfo(o.client);
232 checkUnnamed1084(o.clientStates); 231 checkUnnamed1087(o.clientStates);
233 checkThreatInfo(o.threatInfo); 232 checkThreatInfo(o.threatInfo);
234 } 233 }
235 buildCounterFindFullHashesRequest--; 234 buildCounterFindFullHashesRequest--;
236 } 235 }
237 236
238 buildUnnamed1085() { 237 buildUnnamed1088() {
239 var o = new core.List<api.ThreatMatch>(); 238 var o = new core.List<api.ThreatMatch>();
240 o.add(buildThreatMatch()); 239 o.add(buildThreatMatch());
241 o.add(buildThreatMatch()); 240 o.add(buildThreatMatch());
242 return o; 241 return o;
243 } 242 }
244 243
245 checkUnnamed1085(core.List<api.ThreatMatch> o) { 244 checkUnnamed1088(core.List<api.ThreatMatch> o) {
246 unittest.expect(o, unittest.hasLength(2)); 245 unittest.expect(o, unittest.hasLength(2));
247 checkThreatMatch(o[0]); 246 checkThreatMatch(o[0]);
248 checkThreatMatch(o[1]); 247 checkThreatMatch(o[1]);
249 } 248 }
250 249
251 core.int buildCounterFindFullHashesResponse = 0; 250 core.int buildCounterFindFullHashesResponse = 0;
252 buildFindFullHashesResponse() { 251 buildFindFullHashesResponse() {
253 var o = new api.FindFullHashesResponse(); 252 var o = new api.FindFullHashesResponse();
254 buildCounterFindFullHashesResponse++; 253 buildCounterFindFullHashesResponse++;
255 if (buildCounterFindFullHashesResponse < 3) { 254 if (buildCounterFindFullHashesResponse < 3) {
256 o.matches = buildUnnamed1085(); 255 o.matches = buildUnnamed1088();
257 o.minimumWaitDuration = "foo"; 256 o.minimumWaitDuration = "foo";
258 o.negativeCacheDuration = "foo"; 257 o.negativeCacheDuration = "foo";
259 } 258 }
260 buildCounterFindFullHashesResponse--; 259 buildCounterFindFullHashesResponse--;
261 return o; 260 return o;
262 } 261 }
263 262
264 checkFindFullHashesResponse(api.FindFullHashesResponse o) { 263 checkFindFullHashesResponse(api.FindFullHashesResponse o) {
265 buildCounterFindFullHashesResponse++; 264 buildCounterFindFullHashesResponse++;
266 if (buildCounterFindFullHashesResponse < 3) { 265 if (buildCounterFindFullHashesResponse < 3) {
267 checkUnnamed1085(o.matches); 266 checkUnnamed1088(o.matches);
268 unittest.expect(o.minimumWaitDuration, unittest.equals('foo')); 267 unittest.expect(o.minimumWaitDuration, unittest.equals('foo'));
269 unittest.expect(o.negativeCacheDuration, unittest.equals('foo')); 268 unittest.expect(o.negativeCacheDuration, unittest.equals('foo'));
270 } 269 }
271 buildCounterFindFullHashesResponse--; 270 buildCounterFindFullHashesResponse--;
272 } 271 }
273 272
274 core.int buildCounterFindThreatMatchesRequest = 0; 273 core.int buildCounterFindThreatMatchesRequest = 0;
275 buildFindThreatMatchesRequest() { 274 buildFindThreatMatchesRequest() {
276 var o = new api.FindThreatMatchesRequest(); 275 var o = new api.FindThreatMatchesRequest();
277 buildCounterFindThreatMatchesRequest++; 276 buildCounterFindThreatMatchesRequest++;
278 if (buildCounterFindThreatMatchesRequest < 3) { 277 if (buildCounterFindThreatMatchesRequest < 3) {
279 o.client = buildClientInfo(); 278 o.client = buildClientInfo();
280 o.threatInfo = buildThreatInfo(); 279 o.threatInfo = buildThreatInfo();
281 } 280 }
282 buildCounterFindThreatMatchesRequest--; 281 buildCounterFindThreatMatchesRequest--;
283 return o; 282 return o;
284 } 283 }
285 284
286 checkFindThreatMatchesRequest(api.FindThreatMatchesRequest o) { 285 checkFindThreatMatchesRequest(api.FindThreatMatchesRequest o) {
287 buildCounterFindThreatMatchesRequest++; 286 buildCounterFindThreatMatchesRequest++;
288 if (buildCounterFindThreatMatchesRequest < 3) { 287 if (buildCounterFindThreatMatchesRequest < 3) {
289 checkClientInfo(o.client); 288 checkClientInfo(o.client);
290 checkThreatInfo(o.threatInfo); 289 checkThreatInfo(o.threatInfo);
291 } 290 }
292 buildCounterFindThreatMatchesRequest--; 291 buildCounterFindThreatMatchesRequest--;
293 } 292 }
294 293
295 buildUnnamed1086() { 294 buildUnnamed1089() {
296 var o = new core.List<api.ThreatMatch>(); 295 var o = new core.List<api.ThreatMatch>();
297 o.add(buildThreatMatch()); 296 o.add(buildThreatMatch());
298 o.add(buildThreatMatch()); 297 o.add(buildThreatMatch());
299 return o; 298 return o;
300 } 299 }
301 300
302 checkUnnamed1086(core.List<api.ThreatMatch> o) { 301 checkUnnamed1089(core.List<api.ThreatMatch> o) {
303 unittest.expect(o, unittest.hasLength(2)); 302 unittest.expect(o, unittest.hasLength(2));
304 checkThreatMatch(o[0]); 303 checkThreatMatch(o[0]);
305 checkThreatMatch(o[1]); 304 checkThreatMatch(o[1]);
306 } 305 }
307 306
308 core.int buildCounterFindThreatMatchesResponse = 0; 307 core.int buildCounterFindThreatMatchesResponse = 0;
309 buildFindThreatMatchesResponse() { 308 buildFindThreatMatchesResponse() {
310 var o = new api.FindThreatMatchesResponse(); 309 var o = new api.FindThreatMatchesResponse();
311 buildCounterFindThreatMatchesResponse++; 310 buildCounterFindThreatMatchesResponse++;
312 if (buildCounterFindThreatMatchesResponse < 3) { 311 if (buildCounterFindThreatMatchesResponse < 3) {
313 o.matches = buildUnnamed1086(); 312 o.matches = buildUnnamed1089();
314 } 313 }
315 buildCounterFindThreatMatchesResponse--; 314 buildCounterFindThreatMatchesResponse--;
316 return o; 315 return o;
317 } 316 }
318 317
319 checkFindThreatMatchesResponse(api.FindThreatMatchesResponse o) { 318 checkFindThreatMatchesResponse(api.FindThreatMatchesResponse o) {
320 buildCounterFindThreatMatchesResponse++; 319 buildCounterFindThreatMatchesResponse++;
321 if (buildCounterFindThreatMatchesResponse < 3) { 320 if (buildCounterFindThreatMatchesResponse < 3) {
322 checkUnnamed1086(o.matches); 321 checkUnnamed1089(o.matches);
323 } 322 }
324 buildCounterFindThreatMatchesResponse--; 323 buildCounterFindThreatMatchesResponse--;
325 } 324 }
326 325
327 buildUnnamed1087() { 326 buildUnnamed1090() {
328 var o = new core.List<api.ThreatListDescriptor>(); 327 var o = new core.List<api.ThreatListDescriptor>();
329 o.add(buildThreatListDescriptor()); 328 o.add(buildThreatListDescriptor());
330 o.add(buildThreatListDescriptor()); 329 o.add(buildThreatListDescriptor());
331 return o; 330 return o;
332 } 331 }
333 332
334 checkUnnamed1087(core.List<api.ThreatListDescriptor> o) { 333 checkUnnamed1090(core.List<api.ThreatListDescriptor> o) {
335 unittest.expect(o, unittest.hasLength(2)); 334 unittest.expect(o, unittest.hasLength(2));
336 checkThreatListDescriptor(o[0]); 335 checkThreatListDescriptor(o[0]);
337 checkThreatListDescriptor(o[1]); 336 checkThreatListDescriptor(o[1]);
338 } 337 }
339 338
340 core.int buildCounterListThreatListsResponse = 0; 339 core.int buildCounterListThreatListsResponse = 0;
341 buildListThreatListsResponse() { 340 buildListThreatListsResponse() {
342 var o = new api.ListThreatListsResponse(); 341 var o = new api.ListThreatListsResponse();
343 buildCounterListThreatListsResponse++; 342 buildCounterListThreatListsResponse++;
344 if (buildCounterListThreatListsResponse < 3) { 343 if (buildCounterListThreatListsResponse < 3) {
345 o.threatLists = buildUnnamed1087(); 344 o.threatLists = buildUnnamed1090();
346 } 345 }
347 buildCounterListThreatListsResponse--; 346 buildCounterListThreatListsResponse--;
348 return o; 347 return o;
349 } 348 }
350 349
351 checkListThreatListsResponse(api.ListThreatListsResponse o) { 350 checkListThreatListsResponse(api.ListThreatListsResponse o) {
352 buildCounterListThreatListsResponse++; 351 buildCounterListThreatListsResponse++;
353 if (buildCounterListThreatListsResponse < 3) { 352 if (buildCounterListThreatListsResponse < 3) {
354 checkUnnamed1087(o.threatLists); 353 checkUnnamed1090(o.threatLists);
355 } 354 }
356 buildCounterListThreatListsResponse--; 355 buildCounterListThreatListsResponse--;
357 } 356 }
358 357
359 core.int buildCounterListUpdateRequest = 0; 358 core.int buildCounterListUpdateRequest = 0;
360 buildListUpdateRequest() { 359 buildListUpdateRequest() {
361 var o = new api.ListUpdateRequest(); 360 var o = new api.ListUpdateRequest();
362 buildCounterListUpdateRequest++; 361 buildCounterListUpdateRequest++;
363 if (buildCounterListUpdateRequest < 3) { 362 if (buildCounterListUpdateRequest < 3) {
364 o.constraints = buildConstraints(); 363 o.constraints = buildConstraints();
(...skipping 11 matching lines...) Expand all
376 if (buildCounterListUpdateRequest < 3) { 375 if (buildCounterListUpdateRequest < 3) {
377 checkConstraints(o.constraints); 376 checkConstraints(o.constraints);
378 unittest.expect(o.platformType, unittest.equals('foo')); 377 unittest.expect(o.platformType, unittest.equals('foo'));
379 unittest.expect(o.state, unittest.equals('foo')); 378 unittest.expect(o.state, unittest.equals('foo'));
380 unittest.expect(o.threatEntryType, unittest.equals('foo')); 379 unittest.expect(o.threatEntryType, unittest.equals('foo'));
381 unittest.expect(o.threatType, unittest.equals('foo')); 380 unittest.expect(o.threatType, unittest.equals('foo'));
382 } 381 }
383 buildCounterListUpdateRequest--; 382 buildCounterListUpdateRequest--;
384 } 383 }
385 384
386 buildUnnamed1088() { 385 buildUnnamed1091() {
387 var o = new core.List<api.ThreatEntrySet>(); 386 var o = new core.List<api.ThreatEntrySet>();
388 o.add(buildThreatEntrySet()); 387 o.add(buildThreatEntrySet());
389 o.add(buildThreatEntrySet()); 388 o.add(buildThreatEntrySet());
390 return o; 389 return o;
391 } 390 }
392 391
393 checkUnnamed1088(core.List<api.ThreatEntrySet> o) { 392 checkUnnamed1091(core.List<api.ThreatEntrySet> o) {
394 unittest.expect(o, unittest.hasLength(2)); 393 unittest.expect(o, unittest.hasLength(2));
395 checkThreatEntrySet(o[0]); 394 checkThreatEntrySet(o[0]);
396 checkThreatEntrySet(o[1]); 395 checkThreatEntrySet(o[1]);
397 } 396 }
398 397
399 buildUnnamed1089() { 398 buildUnnamed1092() {
400 var o = new core.List<api.ThreatEntrySet>(); 399 var o = new core.List<api.ThreatEntrySet>();
401 o.add(buildThreatEntrySet()); 400 o.add(buildThreatEntrySet());
402 o.add(buildThreatEntrySet()); 401 o.add(buildThreatEntrySet());
403 return o; 402 return o;
404 } 403 }
405 404
406 checkUnnamed1089(core.List<api.ThreatEntrySet> o) { 405 checkUnnamed1092(core.List<api.ThreatEntrySet> o) {
407 unittest.expect(o, unittest.hasLength(2)); 406 unittest.expect(o, unittest.hasLength(2));
408 checkThreatEntrySet(o[0]); 407 checkThreatEntrySet(o[0]);
409 checkThreatEntrySet(o[1]); 408 checkThreatEntrySet(o[1]);
410 } 409 }
411 410
412 core.int buildCounterListUpdateResponse = 0; 411 core.int buildCounterListUpdateResponse = 0;
413 buildListUpdateResponse() { 412 buildListUpdateResponse() {
414 var o = new api.ListUpdateResponse(); 413 var o = new api.ListUpdateResponse();
415 buildCounterListUpdateResponse++; 414 buildCounterListUpdateResponse++;
416 if (buildCounterListUpdateResponse < 3) { 415 if (buildCounterListUpdateResponse < 3) {
417 o.additions = buildUnnamed1088(); 416 o.additions = buildUnnamed1091();
418 o.checksum = buildChecksum(); 417 o.checksum = buildChecksum();
419 o.newClientState = "foo"; 418 o.newClientState = "foo";
420 o.platformType = "foo"; 419 o.platformType = "foo";
421 o.removals = buildUnnamed1089(); 420 o.removals = buildUnnamed1092();
422 o.responseType = "foo"; 421 o.responseType = "foo";
423 o.threatEntryType = "foo"; 422 o.threatEntryType = "foo";
424 o.threatType = "foo"; 423 o.threatType = "foo";
425 } 424 }
426 buildCounterListUpdateResponse--; 425 buildCounterListUpdateResponse--;
427 return o; 426 return o;
428 } 427 }
429 428
430 checkListUpdateResponse(api.ListUpdateResponse o) { 429 checkListUpdateResponse(api.ListUpdateResponse o) {
431 buildCounterListUpdateResponse++; 430 buildCounterListUpdateResponse++;
432 if (buildCounterListUpdateResponse < 3) { 431 if (buildCounterListUpdateResponse < 3) {
433 checkUnnamed1088(o.additions); 432 checkUnnamed1091(o.additions);
434 checkChecksum(o.checksum); 433 checkChecksum(o.checksum);
435 unittest.expect(o.newClientState, unittest.equals('foo')); 434 unittest.expect(o.newClientState, unittest.equals('foo'));
436 unittest.expect(o.platformType, unittest.equals('foo')); 435 unittest.expect(o.platformType, unittest.equals('foo'));
437 checkUnnamed1089(o.removals); 436 checkUnnamed1092(o.removals);
438 unittest.expect(o.responseType, unittest.equals('foo')); 437 unittest.expect(o.responseType, unittest.equals('foo'));
439 unittest.expect(o.threatEntryType, unittest.equals('foo')); 438 unittest.expect(o.threatEntryType, unittest.equals('foo'));
440 unittest.expect(o.threatType, unittest.equals('foo')); 439 unittest.expect(o.threatType, unittest.equals('foo'));
441 } 440 }
442 buildCounterListUpdateResponse--; 441 buildCounterListUpdateResponse--;
443 } 442 }
444 443
445 core.int buildCounterMetadataEntry = 0; 444 core.int buildCounterMetadataEntry = 0;
446 buildMetadataEntry() { 445 buildMetadataEntry() {
447 var o = new api.MetadataEntry(); 446 var o = new api.MetadataEntry();
(...skipping 29 matching lines...) Expand all
477 476
478 checkRawHashes(api.RawHashes o) { 477 checkRawHashes(api.RawHashes o) {
479 buildCounterRawHashes++; 478 buildCounterRawHashes++;
480 if (buildCounterRawHashes < 3) { 479 if (buildCounterRawHashes < 3) {
481 unittest.expect(o.prefixSize, unittest.equals(42)); 480 unittest.expect(o.prefixSize, unittest.equals(42));
482 unittest.expect(o.rawHashes, unittest.equals('foo')); 481 unittest.expect(o.rawHashes, unittest.equals('foo'));
483 } 482 }
484 buildCounterRawHashes--; 483 buildCounterRawHashes--;
485 } 484 }
486 485
487 buildUnnamed1090() { 486 buildUnnamed1093() {
488 var o = new core.List<core.int>(); 487 var o = new core.List<core.int>();
489 o.add(42); 488 o.add(42);
490 o.add(42); 489 o.add(42);
491 return o; 490 return o;
492 } 491 }
493 492
494 checkUnnamed1090(core.List<core.int> o) { 493 checkUnnamed1093(core.List<core.int> o) {
495 unittest.expect(o, unittest.hasLength(2)); 494 unittest.expect(o, unittest.hasLength(2));
496 unittest.expect(o[0], unittest.equals(42)); 495 unittest.expect(o[0], unittest.equals(42));
497 unittest.expect(o[1], unittest.equals(42)); 496 unittest.expect(o[1], unittest.equals(42));
498 } 497 }
499 498
500 core.int buildCounterRawIndices = 0; 499 core.int buildCounterRawIndices = 0;
501 buildRawIndices() { 500 buildRawIndices() {
502 var o = new api.RawIndices(); 501 var o = new api.RawIndices();
503 buildCounterRawIndices++; 502 buildCounterRawIndices++;
504 if (buildCounterRawIndices < 3) { 503 if (buildCounterRawIndices < 3) {
505 o.indices = buildUnnamed1090(); 504 o.indices = buildUnnamed1093();
506 } 505 }
507 buildCounterRawIndices--; 506 buildCounterRawIndices--;
508 return o; 507 return o;
509 } 508 }
510 509
511 checkRawIndices(api.RawIndices o) { 510 checkRawIndices(api.RawIndices o) {
512 buildCounterRawIndices++; 511 buildCounterRawIndices++;
513 if (buildCounterRawIndices < 3) { 512 if (buildCounterRawIndices < 3) {
514 checkUnnamed1090(o.indices); 513 checkUnnamed1093(o.indices);
515 } 514 }
516 buildCounterRawIndices--; 515 buildCounterRawIndices--;
517 } 516 }
518 517
519 core.int buildCounterRiceDeltaEncoding = 0; 518 core.int buildCounterRiceDeltaEncoding = 0;
520 buildRiceDeltaEncoding() { 519 buildRiceDeltaEncoding() {
521 var o = new api.RiceDeltaEncoding(); 520 var o = new api.RiceDeltaEncoding();
522 buildCounterRiceDeltaEncoding++; 521 buildCounterRiceDeltaEncoding++;
523 if (buildCounterRiceDeltaEncoding < 3) { 522 if (buildCounterRiceDeltaEncoding < 3) {
524 o.encodedData = "foo"; 523 o.encodedData = "foo";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 checkThreatEntry(api.ThreatEntry o) { 556 checkThreatEntry(api.ThreatEntry o) {
558 buildCounterThreatEntry++; 557 buildCounterThreatEntry++;
559 if (buildCounterThreatEntry < 3) { 558 if (buildCounterThreatEntry < 3) {
560 unittest.expect(o.digest, unittest.equals('foo')); 559 unittest.expect(o.digest, unittest.equals('foo'));
561 unittest.expect(o.hash, unittest.equals('foo')); 560 unittest.expect(o.hash, unittest.equals('foo'));
562 unittest.expect(o.url, unittest.equals('foo')); 561 unittest.expect(o.url, unittest.equals('foo'));
563 } 562 }
564 buildCounterThreatEntry--; 563 buildCounterThreatEntry--;
565 } 564 }
566 565
567 buildUnnamed1091() { 566 buildUnnamed1094() {
568 var o = new core.List<api.MetadataEntry>(); 567 var o = new core.List<api.MetadataEntry>();
569 o.add(buildMetadataEntry()); 568 o.add(buildMetadataEntry());
570 o.add(buildMetadataEntry()); 569 o.add(buildMetadataEntry());
571 return o; 570 return o;
572 } 571 }
573 572
574 checkUnnamed1091(core.List<api.MetadataEntry> o) { 573 checkUnnamed1094(core.List<api.MetadataEntry> o) {
575 unittest.expect(o, unittest.hasLength(2)); 574 unittest.expect(o, unittest.hasLength(2));
576 checkMetadataEntry(o[0]); 575 checkMetadataEntry(o[0]);
577 checkMetadataEntry(o[1]); 576 checkMetadataEntry(o[1]);
578 } 577 }
579 578
580 core.int buildCounterThreatEntryMetadata = 0; 579 core.int buildCounterThreatEntryMetadata = 0;
581 buildThreatEntryMetadata() { 580 buildThreatEntryMetadata() {
582 var o = new api.ThreatEntryMetadata(); 581 var o = new api.ThreatEntryMetadata();
583 buildCounterThreatEntryMetadata++; 582 buildCounterThreatEntryMetadata++;
584 if (buildCounterThreatEntryMetadata < 3) { 583 if (buildCounterThreatEntryMetadata < 3) {
585 o.entries = buildUnnamed1091(); 584 o.entries = buildUnnamed1094();
586 } 585 }
587 buildCounterThreatEntryMetadata--; 586 buildCounterThreatEntryMetadata--;
588 return o; 587 return o;
589 } 588 }
590 589
591 checkThreatEntryMetadata(api.ThreatEntryMetadata o) { 590 checkThreatEntryMetadata(api.ThreatEntryMetadata o) {
592 buildCounterThreatEntryMetadata++; 591 buildCounterThreatEntryMetadata++;
593 if (buildCounterThreatEntryMetadata < 3) { 592 if (buildCounterThreatEntryMetadata < 3) {
594 checkUnnamed1091(o.entries); 593 checkUnnamed1094(o.entries);
595 } 594 }
596 buildCounterThreatEntryMetadata--; 595 buildCounterThreatEntryMetadata--;
597 } 596 }
598 597
599 core.int buildCounterThreatEntrySet = 0; 598 core.int buildCounterThreatEntrySet = 0;
600 buildThreatEntrySet() { 599 buildThreatEntrySet() {
601 var o = new api.ThreatEntrySet(); 600 var o = new api.ThreatEntrySet();
602 buildCounterThreatEntrySet++; 601 buildCounterThreatEntrySet++;
603 if (buildCounterThreatEntrySet < 3) { 602 if (buildCounterThreatEntrySet < 3) {
604 o.compressionType = "foo"; 603 o.compressionType = "foo";
(...skipping 11 matching lines...) Expand all
616 if (buildCounterThreatEntrySet < 3) { 615 if (buildCounterThreatEntrySet < 3) {
617 unittest.expect(o.compressionType, unittest.equals('foo')); 616 unittest.expect(o.compressionType, unittest.equals('foo'));
618 checkRawHashes(o.rawHashes); 617 checkRawHashes(o.rawHashes);
619 checkRawIndices(o.rawIndices); 618 checkRawIndices(o.rawIndices);
620 checkRiceDeltaEncoding(o.riceHashes); 619 checkRiceDeltaEncoding(o.riceHashes);
621 checkRiceDeltaEncoding(o.riceIndices); 620 checkRiceDeltaEncoding(o.riceIndices);
622 } 621 }
623 buildCounterThreatEntrySet--; 622 buildCounterThreatEntrySet--;
624 } 623 }
625 624
626 buildUnnamed1092() {
627 var o = new core.List<core.String>();
628 o.add("foo");
629 o.add("foo");
630 return o;
631 }
632
633 checkUnnamed1092(core.List<core.String> o) {
634 unittest.expect(o, unittest.hasLength(2));
635 unittest.expect(o[0], unittest.equals('foo'));
636 unittest.expect(o[1], unittest.equals('foo'));
637 }
638
639 buildUnnamed1093() {
640 var o = new core.List<api.ThreatEntry>();
641 o.add(buildThreatEntry());
642 o.add(buildThreatEntry());
643 return o;
644 }
645
646 checkUnnamed1093(core.List<api.ThreatEntry> o) {
647 unittest.expect(o, unittest.hasLength(2));
648 checkThreatEntry(o[0]);
649 checkThreatEntry(o[1]);
650 }
651
652 buildUnnamed1094() {
653 var o = new core.List<core.String>();
654 o.add("foo");
655 o.add("foo");
656 return o;
657 }
658
659 checkUnnamed1094(core.List<core.String> o) {
660 unittest.expect(o, unittest.hasLength(2));
661 unittest.expect(o[0], unittest.equals('foo'));
662 unittest.expect(o[1], unittest.equals('foo'));
663 }
664
665 buildUnnamed1095() { 625 buildUnnamed1095() {
666 var o = new core.List<core.String>(); 626 var o = new core.List<core.String>();
667 o.add("foo"); 627 o.add("foo");
668 o.add("foo"); 628 o.add("foo");
669 return o; 629 return o;
670 } 630 }
671 631
672 checkUnnamed1095(core.List<core.String> o) { 632 checkUnnamed1095(core.List<core.String> o) {
673 unittest.expect(o, unittest.hasLength(2)); 633 unittest.expect(o, unittest.hasLength(2));
674 unittest.expect(o[0], unittest.equals('foo')); 634 unittest.expect(o[0], unittest.equals('foo'));
675 unittest.expect(o[1], unittest.equals('foo')); 635 unittest.expect(o[1], unittest.equals('foo'));
636 }
637
638 buildUnnamed1096() {
639 var o = new core.List<api.ThreatEntry>();
640 o.add(buildThreatEntry());
641 o.add(buildThreatEntry());
642 return o;
643 }
644
645 checkUnnamed1096(core.List<api.ThreatEntry> o) {
646 unittest.expect(o, unittest.hasLength(2));
647 checkThreatEntry(o[0]);
648 checkThreatEntry(o[1]);
649 }
650
651 buildUnnamed1097() {
652 var o = new core.List<core.String>();
653 o.add("foo");
654 o.add("foo");
655 return o;
656 }
657
658 checkUnnamed1097(core.List<core.String> o) {
659 unittest.expect(o, unittest.hasLength(2));
660 unittest.expect(o[0], unittest.equals('foo'));
661 unittest.expect(o[1], unittest.equals('foo'));
662 }
663
664 buildUnnamed1098() {
665 var o = new core.List<core.String>();
666 o.add("foo");
667 o.add("foo");
668 return o;
669 }
670
671 checkUnnamed1098(core.List<core.String> o) {
672 unittest.expect(o, unittest.hasLength(2));
673 unittest.expect(o[0], unittest.equals('foo'));
674 unittest.expect(o[1], unittest.equals('foo'));
676 } 675 }
677 676
678 core.int buildCounterThreatInfo = 0; 677 core.int buildCounterThreatInfo = 0;
679 buildThreatInfo() { 678 buildThreatInfo() {
680 var o = new api.ThreatInfo(); 679 var o = new api.ThreatInfo();
681 buildCounterThreatInfo++; 680 buildCounterThreatInfo++;
682 if (buildCounterThreatInfo < 3) { 681 if (buildCounterThreatInfo < 3) {
683 o.platformTypes = buildUnnamed1092(); 682 o.platformTypes = buildUnnamed1095();
684 o.threatEntries = buildUnnamed1093(); 683 o.threatEntries = buildUnnamed1096();
685 o.threatEntryTypes = buildUnnamed1094(); 684 o.threatEntryTypes = buildUnnamed1097();
686 o.threatTypes = buildUnnamed1095(); 685 o.threatTypes = buildUnnamed1098();
687 } 686 }
688 buildCounterThreatInfo--; 687 buildCounterThreatInfo--;
689 return o; 688 return o;
690 } 689 }
691 690
692 checkThreatInfo(api.ThreatInfo o) { 691 checkThreatInfo(api.ThreatInfo o) {
693 buildCounterThreatInfo++; 692 buildCounterThreatInfo++;
694 if (buildCounterThreatInfo < 3) { 693 if (buildCounterThreatInfo < 3) {
695 checkUnnamed1092(o.platformTypes); 694 checkUnnamed1095(o.platformTypes);
696 checkUnnamed1093(o.threatEntries); 695 checkUnnamed1096(o.threatEntries);
697 checkUnnamed1094(o.threatEntryTypes); 696 checkUnnamed1097(o.threatEntryTypes);
698 checkUnnamed1095(o.threatTypes); 697 checkUnnamed1098(o.threatTypes);
699 } 698 }
700 buildCounterThreatInfo--; 699 buildCounterThreatInfo--;
701 } 700 }
702 701
703 core.int buildCounterThreatListDescriptor = 0; 702 core.int buildCounterThreatListDescriptor = 0;
704 buildThreatListDescriptor() { 703 buildThreatListDescriptor() {
705 var o = new api.ThreatListDescriptor(); 704 var o = new api.ThreatListDescriptor();
706 buildCounterThreatListDescriptor++; 705 buildCounterThreatListDescriptor++;
707 if (buildCounterThreatListDescriptor < 3) { 706 if (buildCounterThreatListDescriptor < 3) {
708 o.platformType = "foo"; 707 o.platformType = "foo";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 unittest.expect(o.cacheDuration, unittest.equals('foo')); 744 unittest.expect(o.cacheDuration, unittest.equals('foo'));
746 unittest.expect(o.platformType, unittest.equals('foo')); 745 unittest.expect(o.platformType, unittest.equals('foo'));
747 checkThreatEntry(o.threat); 746 checkThreatEntry(o.threat);
748 checkThreatEntryMetadata(o.threatEntryMetadata); 747 checkThreatEntryMetadata(o.threatEntryMetadata);
749 unittest.expect(o.threatEntryType, unittest.equals('foo')); 748 unittest.expect(o.threatEntryType, unittest.equals('foo'));
750 unittest.expect(o.threatType, unittest.equals('foo')); 749 unittest.expect(o.threatType, unittest.equals('foo'));
751 } 750 }
752 buildCounterThreatMatch--; 751 buildCounterThreatMatch--;
753 } 752 }
754 753
755
756 main() { 754 main() {
757 unittest.group("obj-schema-Checksum", () { 755 unittest.group("obj-schema-Checksum", () {
758 unittest.test("to-json--from-json", () { 756 unittest.test("to-json--from-json", () {
759 var o = buildChecksum(); 757 var o = buildChecksum();
760 var od = new api.Checksum.fromJson(o.toJson()); 758 var od = new api.Checksum.fromJson(o.toJson());
761 checkChecksum(od); 759 checkChecksum(od);
762 }); 760 });
763 }); 761 });
764 762
765
766 unittest.group("obj-schema-ClientInfo", () { 763 unittest.group("obj-schema-ClientInfo", () {
767 unittest.test("to-json--from-json", () { 764 unittest.test("to-json--from-json", () {
768 var o = buildClientInfo(); 765 var o = buildClientInfo();
769 var od = new api.ClientInfo.fromJson(o.toJson()); 766 var od = new api.ClientInfo.fromJson(o.toJson());
770 checkClientInfo(od); 767 checkClientInfo(od);
771 }); 768 });
772 }); 769 });
773 770
774
775 unittest.group("obj-schema-Constraints", () { 771 unittest.group("obj-schema-Constraints", () {
776 unittest.test("to-json--from-json", () { 772 unittest.test("to-json--from-json", () {
777 var o = buildConstraints(); 773 var o = buildConstraints();
778 var od = new api.Constraints.fromJson(o.toJson()); 774 var od = new api.Constraints.fromJson(o.toJson());
779 checkConstraints(od); 775 checkConstraints(od);
780 }); 776 });
781 }); 777 });
782 778
783
784 unittest.group("obj-schema-FetchThreatListUpdatesRequest", () { 779 unittest.group("obj-schema-FetchThreatListUpdatesRequest", () {
785 unittest.test("to-json--from-json", () { 780 unittest.test("to-json--from-json", () {
786 var o = buildFetchThreatListUpdatesRequest(); 781 var o = buildFetchThreatListUpdatesRequest();
787 var od = new api.FetchThreatListUpdatesRequest.fromJson(o.toJson()); 782 var od = new api.FetchThreatListUpdatesRequest.fromJson(o.toJson());
788 checkFetchThreatListUpdatesRequest(od); 783 checkFetchThreatListUpdatesRequest(od);
789 }); 784 });
790 }); 785 });
791 786
792
793 unittest.group("obj-schema-FetchThreatListUpdatesResponse", () { 787 unittest.group("obj-schema-FetchThreatListUpdatesResponse", () {
794 unittest.test("to-json--from-json", () { 788 unittest.test("to-json--from-json", () {
795 var o = buildFetchThreatListUpdatesResponse(); 789 var o = buildFetchThreatListUpdatesResponse();
796 var od = new api.FetchThreatListUpdatesResponse.fromJson(o.toJson()); 790 var od = new api.FetchThreatListUpdatesResponse.fromJson(o.toJson());
797 checkFetchThreatListUpdatesResponse(od); 791 checkFetchThreatListUpdatesResponse(od);
798 }); 792 });
799 }); 793 });
800 794
801
802 unittest.group("obj-schema-FindFullHashesRequest", () { 795 unittest.group("obj-schema-FindFullHashesRequest", () {
803 unittest.test("to-json--from-json", () { 796 unittest.test("to-json--from-json", () {
804 var o = buildFindFullHashesRequest(); 797 var o = buildFindFullHashesRequest();
805 var od = new api.FindFullHashesRequest.fromJson(o.toJson()); 798 var od = new api.FindFullHashesRequest.fromJson(o.toJson());
806 checkFindFullHashesRequest(od); 799 checkFindFullHashesRequest(od);
807 }); 800 });
808 }); 801 });
809 802
810
811 unittest.group("obj-schema-FindFullHashesResponse", () { 803 unittest.group("obj-schema-FindFullHashesResponse", () {
812 unittest.test("to-json--from-json", () { 804 unittest.test("to-json--from-json", () {
813 var o = buildFindFullHashesResponse(); 805 var o = buildFindFullHashesResponse();
814 var od = new api.FindFullHashesResponse.fromJson(o.toJson()); 806 var od = new api.FindFullHashesResponse.fromJson(o.toJson());
815 checkFindFullHashesResponse(od); 807 checkFindFullHashesResponse(od);
816 }); 808 });
817 }); 809 });
818 810
819
820 unittest.group("obj-schema-FindThreatMatchesRequest", () { 811 unittest.group("obj-schema-FindThreatMatchesRequest", () {
821 unittest.test("to-json--from-json", () { 812 unittest.test("to-json--from-json", () {
822 var o = buildFindThreatMatchesRequest(); 813 var o = buildFindThreatMatchesRequest();
823 var od = new api.FindThreatMatchesRequest.fromJson(o.toJson()); 814 var od = new api.FindThreatMatchesRequest.fromJson(o.toJson());
824 checkFindThreatMatchesRequest(od); 815 checkFindThreatMatchesRequest(od);
825 }); 816 });
826 }); 817 });
827 818
828
829 unittest.group("obj-schema-FindThreatMatchesResponse", () { 819 unittest.group("obj-schema-FindThreatMatchesResponse", () {
830 unittest.test("to-json--from-json", () { 820 unittest.test("to-json--from-json", () {
831 var o = buildFindThreatMatchesResponse(); 821 var o = buildFindThreatMatchesResponse();
832 var od = new api.FindThreatMatchesResponse.fromJson(o.toJson()); 822 var od = new api.FindThreatMatchesResponse.fromJson(o.toJson());
833 checkFindThreatMatchesResponse(od); 823 checkFindThreatMatchesResponse(od);
834 }); 824 });
835 }); 825 });
836 826
837
838 unittest.group("obj-schema-ListThreatListsResponse", () { 827 unittest.group("obj-schema-ListThreatListsResponse", () {
839 unittest.test("to-json--from-json", () { 828 unittest.test("to-json--from-json", () {
840 var o = buildListThreatListsResponse(); 829 var o = buildListThreatListsResponse();
841 var od = new api.ListThreatListsResponse.fromJson(o.toJson()); 830 var od = new api.ListThreatListsResponse.fromJson(o.toJson());
842 checkListThreatListsResponse(od); 831 checkListThreatListsResponse(od);
843 }); 832 });
844 }); 833 });
845 834
846
847 unittest.group("obj-schema-ListUpdateRequest", () { 835 unittest.group("obj-schema-ListUpdateRequest", () {
848 unittest.test("to-json--from-json", () { 836 unittest.test("to-json--from-json", () {
849 var o = buildListUpdateRequest(); 837 var o = buildListUpdateRequest();
850 var od = new api.ListUpdateRequest.fromJson(o.toJson()); 838 var od = new api.ListUpdateRequest.fromJson(o.toJson());
851 checkListUpdateRequest(od); 839 checkListUpdateRequest(od);
852 }); 840 });
853 }); 841 });
854 842
855
856 unittest.group("obj-schema-ListUpdateResponse", () { 843 unittest.group("obj-schema-ListUpdateResponse", () {
857 unittest.test("to-json--from-json", () { 844 unittest.test("to-json--from-json", () {
858 var o = buildListUpdateResponse(); 845 var o = buildListUpdateResponse();
859 var od = new api.ListUpdateResponse.fromJson(o.toJson()); 846 var od = new api.ListUpdateResponse.fromJson(o.toJson());
860 checkListUpdateResponse(od); 847 checkListUpdateResponse(od);
861 }); 848 });
862 }); 849 });
863 850
864
865 unittest.group("obj-schema-MetadataEntry", () { 851 unittest.group("obj-schema-MetadataEntry", () {
866 unittest.test("to-json--from-json", () { 852 unittest.test("to-json--from-json", () {
867 var o = buildMetadataEntry(); 853 var o = buildMetadataEntry();
868 var od = new api.MetadataEntry.fromJson(o.toJson()); 854 var od = new api.MetadataEntry.fromJson(o.toJson());
869 checkMetadataEntry(od); 855 checkMetadataEntry(od);
870 }); 856 });
871 }); 857 });
872 858
873
874 unittest.group("obj-schema-RawHashes", () { 859 unittest.group("obj-schema-RawHashes", () {
875 unittest.test("to-json--from-json", () { 860 unittest.test("to-json--from-json", () {
876 var o = buildRawHashes(); 861 var o = buildRawHashes();
877 var od = new api.RawHashes.fromJson(o.toJson()); 862 var od = new api.RawHashes.fromJson(o.toJson());
878 checkRawHashes(od); 863 checkRawHashes(od);
879 }); 864 });
880 }); 865 });
881 866
882
883 unittest.group("obj-schema-RawIndices", () { 867 unittest.group("obj-schema-RawIndices", () {
884 unittest.test("to-json--from-json", () { 868 unittest.test("to-json--from-json", () {
885 var o = buildRawIndices(); 869 var o = buildRawIndices();
886 var od = new api.RawIndices.fromJson(o.toJson()); 870 var od = new api.RawIndices.fromJson(o.toJson());
887 checkRawIndices(od); 871 checkRawIndices(od);
888 }); 872 });
889 }); 873 });
890 874
891
892 unittest.group("obj-schema-RiceDeltaEncoding", () { 875 unittest.group("obj-schema-RiceDeltaEncoding", () {
893 unittest.test("to-json--from-json", () { 876 unittest.test("to-json--from-json", () {
894 var o = buildRiceDeltaEncoding(); 877 var o = buildRiceDeltaEncoding();
895 var od = new api.RiceDeltaEncoding.fromJson(o.toJson()); 878 var od = new api.RiceDeltaEncoding.fromJson(o.toJson());
896 checkRiceDeltaEncoding(od); 879 checkRiceDeltaEncoding(od);
897 }); 880 });
898 }); 881 });
899 882
900
901 unittest.group("obj-schema-ThreatEntry", () { 883 unittest.group("obj-schema-ThreatEntry", () {
902 unittest.test("to-json--from-json", () { 884 unittest.test("to-json--from-json", () {
903 var o = buildThreatEntry(); 885 var o = buildThreatEntry();
904 var od = new api.ThreatEntry.fromJson(o.toJson()); 886 var od = new api.ThreatEntry.fromJson(o.toJson());
905 checkThreatEntry(od); 887 checkThreatEntry(od);
906 }); 888 });
907 }); 889 });
908 890
909
910 unittest.group("obj-schema-ThreatEntryMetadata", () { 891 unittest.group("obj-schema-ThreatEntryMetadata", () {
911 unittest.test("to-json--from-json", () { 892 unittest.test("to-json--from-json", () {
912 var o = buildThreatEntryMetadata(); 893 var o = buildThreatEntryMetadata();
913 var od = new api.ThreatEntryMetadata.fromJson(o.toJson()); 894 var od = new api.ThreatEntryMetadata.fromJson(o.toJson());
914 checkThreatEntryMetadata(od); 895 checkThreatEntryMetadata(od);
915 }); 896 });
916 }); 897 });
917 898
918
919 unittest.group("obj-schema-ThreatEntrySet", () { 899 unittest.group("obj-schema-ThreatEntrySet", () {
920 unittest.test("to-json--from-json", () { 900 unittest.test("to-json--from-json", () {
921 var o = buildThreatEntrySet(); 901 var o = buildThreatEntrySet();
922 var od = new api.ThreatEntrySet.fromJson(o.toJson()); 902 var od = new api.ThreatEntrySet.fromJson(o.toJson());
923 checkThreatEntrySet(od); 903 checkThreatEntrySet(od);
924 }); 904 });
925 }); 905 });
926 906
927
928 unittest.group("obj-schema-ThreatInfo", () { 907 unittest.group("obj-schema-ThreatInfo", () {
929 unittest.test("to-json--from-json", () { 908 unittest.test("to-json--from-json", () {
930 var o = buildThreatInfo(); 909 var o = buildThreatInfo();
931 var od = new api.ThreatInfo.fromJson(o.toJson()); 910 var od = new api.ThreatInfo.fromJson(o.toJson());
932 checkThreatInfo(od); 911 checkThreatInfo(od);
933 }); 912 });
934 }); 913 });
935 914
936
937 unittest.group("obj-schema-ThreatListDescriptor", () { 915 unittest.group("obj-schema-ThreatListDescriptor", () {
938 unittest.test("to-json--from-json", () { 916 unittest.test("to-json--from-json", () {
939 var o = buildThreatListDescriptor(); 917 var o = buildThreatListDescriptor();
940 var od = new api.ThreatListDescriptor.fromJson(o.toJson()); 918 var od = new api.ThreatListDescriptor.fromJson(o.toJson());
941 checkThreatListDescriptor(od); 919 checkThreatListDescriptor(od);
942 }); 920 });
943 }); 921 });
944 922
945
946 unittest.group("obj-schema-ThreatMatch", () { 923 unittest.group("obj-schema-ThreatMatch", () {
947 unittest.test("to-json--from-json", () { 924 unittest.test("to-json--from-json", () {
948 var o = buildThreatMatch(); 925 var o = buildThreatMatch();
949 var od = new api.ThreatMatch.fromJson(o.toJson()); 926 var od = new api.ThreatMatch.fromJson(o.toJson());
950 checkThreatMatch(od); 927 checkThreatMatch(od);
951 }); 928 });
952 }); 929 });
953 930
954
955 unittest.group("resource-EncodedFullHashesResourceApi", () { 931 unittest.group("resource-EncodedFullHashesResourceApi", () {
956 unittest.test("method--get", () { 932 unittest.test("method--get", () {
957
958 var mock = new HttpServerMock(); 933 var mock = new HttpServerMock();
959 api.EncodedFullHashesResourceApi res = new api.SafebrowsingApi(mock).encod edFullHashes; 934 api.EncodedFullHashesResourceApi res =
935 new api.SafebrowsingApi(mock).encodedFullHashes;
960 var arg_encodedRequest = "foo"; 936 var arg_encodedRequest = "foo";
937 var arg_clientVersion = "foo";
961 var arg_clientId = "foo"; 938 var arg_clientId = "foo";
962 var arg_clientVersion = "foo";
963 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 939 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
964 var path = (req.url).path; 940 var path = (req.url).path;
965 var pathOffset = 0; 941 var pathOffset = 0;
966 var index; 942 var index;
967 var subPart; 943 var subPart;
968 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 944 unittest.expect(
945 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
969 pathOffset += 1; 946 pathOffset += 1;
970 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq uals("v4/encodedFullHashes/")); 947 unittest.expect(path.substring(pathOffset, pathOffset + 21),
948 unittest.equals("v4/encodedFullHashes/"));
971 pathOffset += 21; 949 pathOffset += 21;
972 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); 950 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
973 pathOffset = path.length; 951 pathOffset = path.length;
974 unittest.expect(subPart, unittest.equals("$arg_encodedRequest")); 952 unittest.expect(subPart, unittest.equals("$arg_encodedRequest"));
975 953
976 var query = (req.url).query; 954 var query = (req.url).query;
977 var queryOffset = 0; 955 var queryOffset = 0;
978 var queryMap = {}; 956 var queryMap = {};
979 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 957 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
980 parseBool(n) { 958 parseBool(n) {
981 if (n == "true") return true; 959 if (n == "true") return true;
982 if (n == "false") return false; 960 if (n == "false") return false;
983 if (n == null) return null; 961 if (n == null) return null;
984 throw new core.ArgumentError("Invalid boolean: $n"); 962 throw new core.ArgumentError("Invalid boolean: $n");
985 } 963 }
964
986 if (query.length > 0) { 965 if (query.length > 0) {
987 for (var part in query.split("&")) { 966 for (var part in query.split("&")) {
988 var keyvalue = part.split("="); 967 var keyvalue = part.split("=");
989 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 968 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
969 core.Uri.decodeQueryComponent(keyvalue[1]));
990 } 970 }
991 } 971 }
992 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId )); 972 unittest.expect(queryMap["clientVersion"].first,
993 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli entVersion)); 973 unittest.equals(arg_clientVersion));
994 974 unittest.expect(
975 queryMap["clientId"].first, unittest.equals(arg_clientId));
995 976
996 var h = { 977 var h = {
997 "content-type" : "application/json; charset=utf-8", 978 "content-type": "application/json; charset=utf-8",
998 }; 979 };
999 var resp = convert.JSON.encode(buildFindFullHashesResponse()); 980 var resp = convert.JSON.encode(buildFindFullHashesResponse());
1000 return new async.Future.value(stringResponse(200, h, resp)); 981 return new async.Future.value(stringResponse(200, h, resp));
1001 }), true); 982 }), true);
1002 res.get(arg_encodedRequest, clientId: arg_clientId, clientVersion: arg_cli entVersion).then(unittest.expectAsync1(((api.FindFullHashesResponse response) { 983 res
984 .get(arg_encodedRequest,
985 clientVersion: arg_clientVersion, clientId: arg_clientId)
986 .then(unittest.expectAsync1(((api.FindFullHashesResponse response) {
1003 checkFindFullHashesResponse(response); 987 checkFindFullHashesResponse(response);
1004 }))); 988 })));
1005 }); 989 });
1006
1007 }); 990 });
1008 991
1009
1010 unittest.group("resource-EncodedUpdatesResourceApi", () { 992 unittest.group("resource-EncodedUpdatesResourceApi", () {
1011 unittest.test("method--get", () { 993 unittest.test("method--get", () {
1012
1013 var mock = new HttpServerMock(); 994 var mock = new HttpServerMock();
1014 api.EncodedUpdatesResourceApi res = new api.SafebrowsingApi(mock).encodedU pdates; 995 api.EncodedUpdatesResourceApi res =
996 new api.SafebrowsingApi(mock).encodedUpdates;
1015 var arg_encodedRequest = "foo"; 997 var arg_encodedRequest = "foo";
1016 var arg_clientId = "foo"; 998 var arg_clientId = "foo";
1017 var arg_clientVersion = "foo"; 999 var arg_clientVersion = "foo";
1018 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1000 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1019 var path = (req.url).path; 1001 var path = (req.url).path;
1020 var pathOffset = 0; 1002 var pathOffset = 0;
1021 var index; 1003 var index;
1022 var subPart; 1004 var subPart;
1023 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1005 unittest.expect(
1006 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1024 pathOffset += 1; 1007 pathOffset += 1;
1025 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq uals("v4/encodedUpdates/")); 1008 unittest.expect(path.substring(pathOffset, pathOffset + 18),
1009 unittest.equals("v4/encodedUpdates/"));
1026 pathOffset += 18; 1010 pathOffset += 18;
1027 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); 1011 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
1028 pathOffset = path.length; 1012 pathOffset = path.length;
1029 unittest.expect(subPart, unittest.equals("$arg_encodedRequest")); 1013 unittest.expect(subPart, unittest.equals("$arg_encodedRequest"));
1030 1014
1031 var query = (req.url).query; 1015 var query = (req.url).query;
1032 var queryOffset = 0; 1016 var queryOffset = 0;
1033 var queryMap = {}; 1017 var queryMap = {};
1034 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1018 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1035 parseBool(n) { 1019 parseBool(n) {
1036 if (n == "true") return true; 1020 if (n == "true") return true;
1037 if (n == "false") return false; 1021 if (n == "false") return false;
1038 if (n == null) return null; 1022 if (n == null) return null;
1039 throw new core.ArgumentError("Invalid boolean: $n"); 1023 throw new core.ArgumentError("Invalid boolean: $n");
1040 } 1024 }
1025
1041 if (query.length > 0) { 1026 if (query.length > 0) {
1042 for (var part in query.split("&")) { 1027 for (var part in query.split("&")) {
1043 var keyvalue = part.split("="); 1028 var keyvalue = part.split("=");
1044 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1029 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1030 core.Uri.decodeQueryComponent(keyvalue[1]));
1045 } 1031 }
1046 } 1032 }
1047 unittest.expect(queryMap["clientId"].first, unittest.equals(arg_clientId )); 1033 unittest.expect(
1048 unittest.expect(queryMap["clientVersion"].first, unittest.equals(arg_cli entVersion)); 1034 queryMap["clientId"].first, unittest.equals(arg_clientId));
1049 1035 unittest.expect(queryMap["clientVersion"].first,
1036 unittest.equals(arg_clientVersion));
1050 1037
1051 var h = { 1038 var h = {
1052 "content-type" : "application/json; charset=utf-8", 1039 "content-type": "application/json; charset=utf-8",
1053 }; 1040 };
1054 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse()); 1041 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse());
1055 return new async.Future.value(stringResponse(200, h, resp)); 1042 return new async.Future.value(stringResponse(200, h, resp));
1056 }), true); 1043 }), true);
1057 res.get(arg_encodedRequest, clientId: arg_clientId, clientVersion: arg_cli entVersion).then(unittest.expectAsync1(((api.FetchThreatListUpdatesResponse resp onse) { 1044 res
1045 .get(arg_encodedRequest,
1046 clientId: arg_clientId, clientVersion: arg_clientVersion)
1047 .then(unittest
1048 .expectAsync1(((api.FetchThreatListUpdatesResponse response) {
1058 checkFetchThreatListUpdatesResponse(response); 1049 checkFetchThreatListUpdatesResponse(response);
1059 }))); 1050 })));
1060 }); 1051 });
1061
1062 }); 1052 });
1063 1053
1064
1065 unittest.group("resource-FullHashesResourceApi", () { 1054 unittest.group("resource-FullHashesResourceApi", () {
1066 unittest.test("method--find", () { 1055 unittest.test("method--find", () {
1067
1068 var mock = new HttpServerMock(); 1056 var mock = new HttpServerMock();
1069 api.FullHashesResourceApi res = new api.SafebrowsingApi(mock).fullHashes; 1057 api.FullHashesResourceApi res = new api.SafebrowsingApi(mock).fullHashes;
1070 var arg_request = buildFindFullHashesRequest(); 1058 var arg_request = buildFindFullHashesRequest();
1071 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1059 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1072 var obj = new api.FindFullHashesRequest.fromJson(json); 1060 var obj = new api.FindFullHashesRequest.fromJson(json);
1073 checkFindFullHashesRequest(obj); 1061 checkFindFullHashesRequest(obj);
1074 1062
1075 var path = (req.url).path; 1063 var path = (req.url).path;
1076 var pathOffset = 0; 1064 var pathOffset = 0;
1077 var index; 1065 var index;
1078 var subPart; 1066 var subPart;
1079 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1067 unittest.expect(
1068 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1080 pathOffset += 1; 1069 pathOffset += 1;
1081 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq uals("v4/fullHashes:find")); 1070 unittest.expect(path.substring(pathOffset, pathOffset + 18),
1071 unittest.equals("v4/fullHashes:find"));
1082 pathOffset += 18; 1072 pathOffset += 18;
1083 1073
1084 var query = (req.url).query; 1074 var query = (req.url).query;
1085 var queryOffset = 0; 1075 var queryOffset = 0;
1086 var queryMap = {}; 1076 var queryMap = {};
1087 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1077 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1088 parseBool(n) { 1078 parseBool(n) {
1089 if (n == "true") return true; 1079 if (n == "true") return true;
1090 if (n == "false") return false; 1080 if (n == "false") return false;
1091 if (n == null) return null; 1081 if (n == null) return null;
1092 throw new core.ArgumentError("Invalid boolean: $n"); 1082 throw new core.ArgumentError("Invalid boolean: $n");
1093 } 1083 }
1084
1094 if (query.length > 0) { 1085 if (query.length > 0) {
1095 for (var part in query.split("&")) { 1086 for (var part in query.split("&")) {
1096 var keyvalue = part.split("="); 1087 var keyvalue = part.split("=");
1097 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1088 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1089 core.Uri.decodeQueryComponent(keyvalue[1]));
1098 } 1090 }
1099 } 1091 }
1100 1092
1101
1102 var h = { 1093 var h = {
1103 "content-type" : "application/json; charset=utf-8", 1094 "content-type": "application/json; charset=utf-8",
1104 }; 1095 };
1105 var resp = convert.JSON.encode(buildFindFullHashesResponse()); 1096 var resp = convert.JSON.encode(buildFindFullHashesResponse());
1106 return new async.Future.value(stringResponse(200, h, resp)); 1097 return new async.Future.value(stringResponse(200, h, resp));
1107 }), true); 1098 }), true);
1108 res.find(arg_request).then(unittest.expectAsync1(((api.FindFullHashesRespo nse response) { 1099 res
1100 .find(arg_request)
1101 .then(unittest.expectAsync1(((api.FindFullHashesResponse response) {
1109 checkFindFullHashesResponse(response); 1102 checkFindFullHashesResponse(response);
1110 }))); 1103 })));
1111 }); 1104 });
1112
1113 }); 1105 });
1114 1106
1115
1116 unittest.group("resource-ThreatListUpdatesResourceApi", () { 1107 unittest.group("resource-ThreatListUpdatesResourceApi", () {
1117 unittest.test("method--fetch", () { 1108 unittest.test("method--fetch", () {
1118
1119 var mock = new HttpServerMock(); 1109 var mock = new HttpServerMock();
1120 api.ThreatListUpdatesResourceApi res = new api.SafebrowsingApi(mock).threa tListUpdates; 1110 api.ThreatListUpdatesResourceApi res =
1111 new api.SafebrowsingApi(mock).threatListUpdates;
1121 var arg_request = buildFetchThreatListUpdatesRequest(); 1112 var arg_request = buildFetchThreatListUpdatesRequest();
1122 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1113 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1123 var obj = new api.FetchThreatListUpdatesRequest.fromJson(json); 1114 var obj = new api.FetchThreatListUpdatesRequest.fromJson(json);
1124 checkFetchThreatListUpdatesRequest(obj); 1115 checkFetchThreatListUpdatesRequest(obj);
1125 1116
1126 var path = (req.url).path; 1117 var path = (req.url).path;
1127 var pathOffset = 0; 1118 var pathOffset = 0;
1128 var index; 1119 var index;
1129 var subPart; 1120 var subPart;
1130 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1121 unittest.expect(
1122 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1131 pathOffset += 1; 1123 pathOffset += 1;
1132 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq uals("v4/threatListUpdates:fetch")); 1124 unittest.expect(path.substring(pathOffset, pathOffset + 26),
1125 unittest.equals("v4/threatListUpdates:fetch"));
1133 pathOffset += 26; 1126 pathOffset += 26;
1134 1127
1135 var query = (req.url).query; 1128 var query = (req.url).query;
1136 var queryOffset = 0; 1129 var queryOffset = 0;
1137 var queryMap = {}; 1130 var queryMap = {};
1138 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1131 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1139 parseBool(n) { 1132 parseBool(n) {
1140 if (n == "true") return true; 1133 if (n == "true") return true;
1141 if (n == "false") return false; 1134 if (n == "false") return false;
1142 if (n == null) return null; 1135 if (n == null) return null;
1143 throw new core.ArgumentError("Invalid boolean: $n"); 1136 throw new core.ArgumentError("Invalid boolean: $n");
1144 } 1137 }
1138
1145 if (query.length > 0) { 1139 if (query.length > 0) {
1146 for (var part in query.split("&")) { 1140 for (var part in query.split("&")) {
1147 var keyvalue = part.split("="); 1141 var keyvalue = part.split("=");
1148 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1142 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1143 core.Uri.decodeQueryComponent(keyvalue[1]));
1149 } 1144 }
1150 } 1145 }
1151 1146
1152
1153 var h = { 1147 var h = {
1154 "content-type" : "application/json; charset=utf-8", 1148 "content-type": "application/json; charset=utf-8",
1155 }; 1149 };
1156 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse()); 1150 var resp = convert.JSON.encode(buildFetchThreatListUpdatesResponse());
1157 return new async.Future.value(stringResponse(200, h, resp)); 1151 return new async.Future.value(stringResponse(200, h, resp));
1158 }), true); 1152 }), true);
1159 res.fetch(arg_request).then(unittest.expectAsync1(((api.FetchThreatListUpd atesResponse response) { 1153 res.fetch(arg_request).then(
1154 unittest.expectAsync1(((api.FetchThreatListUpdatesResponse response) {
1160 checkFetchThreatListUpdatesResponse(response); 1155 checkFetchThreatListUpdatesResponse(response);
1161 }))); 1156 })));
1162 }); 1157 });
1163
1164 }); 1158 });
1165 1159
1166
1167 unittest.group("resource-ThreatListsResourceApi", () { 1160 unittest.group("resource-ThreatListsResourceApi", () {
1168 unittest.test("method--list", () { 1161 unittest.test("method--list", () {
1169
1170 var mock = new HttpServerMock(); 1162 var mock = new HttpServerMock();
1171 api.ThreatListsResourceApi res = new api.SafebrowsingApi(mock).threatLists ; 1163 api.ThreatListsResourceApi res =
1164 new api.SafebrowsingApi(mock).threatLists;
1172 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1165 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1173 var path = (req.url).path; 1166 var path = (req.url).path;
1174 var pathOffset = 0; 1167 var pathOffset = 0;
1175 var index; 1168 var index;
1176 var subPart; 1169 var subPart;
1177 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1170 unittest.expect(
1171 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1178 pathOffset += 1; 1172 pathOffset += 1;
1179 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq uals("v4/threatLists")); 1173 unittest.expect(path.substring(pathOffset, pathOffset + 14),
1174 unittest.equals("v4/threatLists"));
1180 pathOffset += 14; 1175 pathOffset += 14;
1181 1176
1182 var query = (req.url).query; 1177 var query = (req.url).query;
1183 var queryOffset = 0; 1178 var queryOffset = 0;
1184 var queryMap = {}; 1179 var queryMap = {};
1185 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1180 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1186 parseBool(n) { 1181 parseBool(n) {
1187 if (n == "true") return true; 1182 if (n == "true") return true;
1188 if (n == "false") return false; 1183 if (n == "false") return false;
1189 if (n == null) return null; 1184 if (n == null) return null;
1190 throw new core.ArgumentError("Invalid boolean: $n"); 1185 throw new core.ArgumentError("Invalid boolean: $n");
1191 } 1186 }
1187
1192 if (query.length > 0) { 1188 if (query.length > 0) {
1193 for (var part in query.split("&")) { 1189 for (var part in query.split("&")) {
1194 var keyvalue = part.split("="); 1190 var keyvalue = part.split("=");
1195 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1191 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1192 core.Uri.decodeQueryComponent(keyvalue[1]));
1196 } 1193 }
1197 } 1194 }
1198 1195
1199
1200 var h = { 1196 var h = {
1201 "content-type" : "application/json; charset=utf-8", 1197 "content-type": "application/json; charset=utf-8",
1202 }; 1198 };
1203 var resp = convert.JSON.encode(buildListThreatListsResponse()); 1199 var resp = convert.JSON.encode(buildListThreatListsResponse());
1204 return new async.Future.value(stringResponse(200, h, resp)); 1200 return new async.Future.value(stringResponse(200, h, resp));
1205 }), true); 1201 }), true);
1206 res.list().then(unittest.expectAsync1(((api.ListThreatListsResponse respon se) { 1202 res
1203 .list()
1204 .then(unittest.expectAsync1(((api.ListThreatListsResponse response) {
1207 checkListThreatListsResponse(response); 1205 checkListThreatListsResponse(response);
1208 }))); 1206 })));
1209 }); 1207 });
1210
1211 }); 1208 });
1212 1209
1213
1214 unittest.group("resource-ThreatMatchesResourceApi", () { 1210 unittest.group("resource-ThreatMatchesResourceApi", () {
1215 unittest.test("method--find", () { 1211 unittest.test("method--find", () {
1216
1217 var mock = new HttpServerMock(); 1212 var mock = new HttpServerMock();
1218 api.ThreatMatchesResourceApi res = new api.SafebrowsingApi(mock).threatMat ches; 1213 api.ThreatMatchesResourceApi res =
1214 new api.SafebrowsingApi(mock).threatMatches;
1219 var arg_request = buildFindThreatMatchesRequest(); 1215 var arg_request = buildFindThreatMatchesRequest();
1220 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1216 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1221 var obj = new api.FindThreatMatchesRequest.fromJson(json); 1217 var obj = new api.FindThreatMatchesRequest.fromJson(json);
1222 checkFindThreatMatchesRequest(obj); 1218 checkFindThreatMatchesRequest(obj);
1223 1219
1224 var path = (req.url).path; 1220 var path = (req.url).path;
1225 var pathOffset = 0; 1221 var pathOffset = 0;
1226 var index; 1222 var index;
1227 var subPart; 1223 var subPart;
1228 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1224 unittest.expect(
1225 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1229 pathOffset += 1; 1226 pathOffset += 1;
1230 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq uals("v4/threatMatches:find")); 1227 unittest.expect(path.substring(pathOffset, pathOffset + 21),
1228 unittest.equals("v4/threatMatches:find"));
1231 pathOffset += 21; 1229 pathOffset += 21;
1232 1230
1233 var query = (req.url).query; 1231 var query = (req.url).query;
1234 var queryOffset = 0; 1232 var queryOffset = 0;
1235 var queryMap = {}; 1233 var queryMap = {};
1236 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1234 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1237 parseBool(n) { 1235 parseBool(n) {
1238 if (n == "true") return true; 1236 if (n == "true") return true;
1239 if (n == "false") return false; 1237 if (n == "false") return false;
1240 if (n == null) return null; 1238 if (n == null) return null;
1241 throw new core.ArgumentError("Invalid boolean: $n"); 1239 throw new core.ArgumentError("Invalid boolean: $n");
1242 } 1240 }
1241
1243 if (query.length > 0) { 1242 if (query.length > 0) {
1244 for (var part in query.split("&")) { 1243 for (var part in query.split("&")) {
1245 var keyvalue = part.split("="); 1244 var keyvalue = part.split("=");
1246 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1245 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1246 core.Uri.decodeQueryComponent(keyvalue[1]));
1247 } 1247 }
1248 } 1248 }
1249 1249
1250
1251 var h = { 1250 var h = {
1252 "content-type" : "application/json; charset=utf-8", 1251 "content-type": "application/json; charset=utf-8",
1253 }; 1252 };
1254 var resp = convert.JSON.encode(buildFindThreatMatchesResponse()); 1253 var resp = convert.JSON.encode(buildFindThreatMatchesResponse());
1255 return new async.Future.value(stringResponse(200, h, resp)); 1254 return new async.Future.value(stringResponse(200, h, resp));
1256 }), true); 1255 }), true);
1257 res.find(arg_request).then(unittest.expectAsync1(((api.FindThreatMatchesRe sponse response) { 1256 res.find(arg_request).then(
1257 unittest.expectAsync1(((api.FindThreatMatchesResponse response) {
1258 checkFindThreatMatchesResponse(response); 1258 checkFindThreatMatchesResponse(response);
1259 }))); 1259 })));
1260 }); 1260 });
1261
1262 }); 1261 });
1263
1264
1265 } 1262 }
1266
OLDNEW
« no previous file with comments | « generated/googleapis/test/runtimeconfig/v1_test.dart ('k') | generated/googleapis/test/script/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698