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

Side by Side Diff: generated/googleapis_beta/test/speech/v1beta1_test.dart

Issue 2936613002: Api-Roll 50: 2017-06-12 (Closed)
Patch Set: Created 3 years, 6 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_beta.speech.v1beta1.test; 1 library googleapis_beta.speech.v1beta1.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_beta/speech/v1beta1.dart' as api; 12 import 'package:googleapis_beta/speech/v1beta1.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
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 buildCounterAsyncRecognizeRequest = 0; 54 core.int buildCounterAsyncRecognizeRequest = 0;
55 buildAsyncRecognizeRequest() { 55 buildAsyncRecognizeRequest() {
56 var o = new api.AsyncRecognizeRequest(); 56 var o = new api.AsyncRecognizeRequest();
57 buildCounterAsyncRecognizeRequest++; 57 buildCounterAsyncRecognizeRequest++;
58 if (buildCounterAsyncRecognizeRequest < 3) { 58 if (buildCounterAsyncRecognizeRequest < 3) {
59 o.audio = buildRecognitionAudio(); 59 o.audio = buildRecognitionAudio();
(...skipping 22 matching lines...) Expand all
82 return o; 82 return o;
83 } 83 }
84 84
85 checkEmpty(api.Empty o) { 85 checkEmpty(api.Empty o) {
86 buildCounterEmpty++; 86 buildCounterEmpty++;
87 if (buildCounterEmpty < 3) { 87 if (buildCounterEmpty < 3) {
88 } 88 }
89 buildCounterEmpty--; 89 buildCounterEmpty--;
90 } 90 }
91 91
92 buildUnnamed3787() { 92 buildUnnamed3261() {
93 var o = new core.List<api.Operation>(); 93 var o = new core.List<api.Operation>();
94 o.add(buildOperation()); 94 o.add(buildOperation());
95 o.add(buildOperation()); 95 o.add(buildOperation());
96 return o; 96 return o;
97 } 97 }
98 98
99 checkUnnamed3787(core.List<api.Operation> o) { 99 checkUnnamed3261(core.List<api.Operation> o) {
100 unittest.expect(o, unittest.hasLength(2)); 100 unittest.expect(o, unittest.hasLength(2));
101 checkOperation(o[0]); 101 checkOperation(o[0]);
102 checkOperation(o[1]); 102 checkOperation(o[1]);
103 } 103 }
104 104
105 core.int buildCounterListOperationsResponse = 0; 105 core.int buildCounterListOperationsResponse = 0;
106 buildListOperationsResponse() { 106 buildListOperationsResponse() {
107 var o = new api.ListOperationsResponse(); 107 var o = new api.ListOperationsResponse();
108 buildCounterListOperationsResponse++; 108 buildCounterListOperationsResponse++;
109 if (buildCounterListOperationsResponse < 3) { 109 if (buildCounterListOperationsResponse < 3) {
110 o.nextPageToken = "foo"; 110 o.nextPageToken = "foo";
111 o.operations = buildUnnamed3787(); 111 o.operations = buildUnnamed3261();
112 } 112 }
113 buildCounterListOperationsResponse--; 113 buildCounterListOperationsResponse--;
114 return o; 114 return o;
115 } 115 }
116 116
117 checkListOperationsResponse(api.ListOperationsResponse o) { 117 checkListOperationsResponse(api.ListOperationsResponse o) {
118 buildCounterListOperationsResponse++; 118 buildCounterListOperationsResponse++;
119 if (buildCounterListOperationsResponse < 3) { 119 if (buildCounterListOperationsResponse < 3) {
120 unittest.expect(o.nextPageToken, unittest.equals('foo')); 120 unittest.expect(o.nextPageToken, unittest.equals('foo'));
121 checkUnnamed3787(o.operations); 121 checkUnnamed3261(o.operations);
122 } 122 }
123 buildCounterListOperationsResponse--; 123 buildCounterListOperationsResponse--;
124 } 124 }
125 125
126 buildUnnamed3788() { 126 buildUnnamed3262() {
127 var o = new core.Map<core.String, core.Object>(); 127 var o = new core.Map<core.String, core.Object>();
128 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 128 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
129 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 129 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
130 return o; 130 return o;
131 } 131 }
132 132
133 checkUnnamed3788(core.Map<core.String, core.Object> o) { 133 checkUnnamed3262(core.Map<core.String, core.Object> o) {
134 unittest.expect(o, unittest.hasLength(2)); 134 unittest.expect(o, unittest.hasLength(2));
135 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], unittest.equals('foo')); 135 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], unittest.equals('foo'));
136 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], unittest.equals('foo')); 136 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], unittest.equals('foo'));
137 } 137 }
138 138
139 buildUnnamed3789() { 139 buildUnnamed3263() {
140 var o = new core.Map<core.String, core.Object>(); 140 var o = new core.Map<core.String, core.Object>();
141 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 141 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
142 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 142 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
143 return o; 143 return o;
144 } 144 }
145 145
146 checkUnnamed3789(core.Map<core.String, core.Object> o) { 146 checkUnnamed3263(core.Map<core.String, core.Object> o) {
147 unittest.expect(o, unittest.hasLength(2)); 147 unittest.expect(o, unittest.hasLength(2));
148 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"], unittest.equals('foo')); 148 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"], unittest.equals('foo'));
149 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"], unittest.equals('foo')); 149 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"], unittest.equals('foo'));
150 } 150 }
151 151
152 core.int buildCounterOperation = 0; 152 core.int buildCounterOperation = 0;
153 buildOperation() { 153 buildOperation() {
154 var o = new api.Operation(); 154 var o = new api.Operation();
155 buildCounterOperation++; 155 buildCounterOperation++;
156 if (buildCounterOperation < 3) { 156 if (buildCounterOperation < 3) {
157 o.done = true; 157 o.done = true;
158 o.error = buildStatus(); 158 o.error = buildStatus();
159 o.metadata = buildUnnamed3788(); 159 o.metadata = buildUnnamed3262();
160 o.name = "foo"; 160 o.name = "foo";
161 o.response = buildUnnamed3789(); 161 o.response = buildUnnamed3263();
162 } 162 }
163 buildCounterOperation--; 163 buildCounterOperation--;
164 return o; 164 return o;
165 } 165 }
166 166
167 checkOperation(api.Operation o) { 167 checkOperation(api.Operation o) {
168 buildCounterOperation++; 168 buildCounterOperation++;
169 if (buildCounterOperation < 3) { 169 if (buildCounterOperation < 3) {
170 unittest.expect(o.done, unittest.isTrue); 170 unittest.expect(o.done, unittest.isTrue);
171 checkStatus(o.error); 171 checkStatus(o.error);
172 checkUnnamed3788(o.metadata); 172 checkUnnamed3262(o.metadata);
173 unittest.expect(o.name, unittest.equals('foo')); 173 unittest.expect(o.name, unittest.equals('foo'));
174 checkUnnamed3789(o.response); 174 checkUnnamed3263(o.response);
175 } 175 }
176 buildCounterOperation--; 176 buildCounterOperation--;
177 } 177 }
178 178
179 core.int buildCounterRecognitionAudio = 0; 179 core.int buildCounterRecognitionAudio = 0;
180 buildRecognitionAudio() { 180 buildRecognitionAudio() {
181 var o = new api.RecognitionAudio(); 181 var o = new api.RecognitionAudio();
182 buildCounterRecognitionAudio++; 182 buildCounterRecognitionAudio++;
183 if (buildCounterRecognitionAudio < 3) { 183 if (buildCounterRecognitionAudio < 3) {
184 o.content = "foo"; 184 o.content = "foo";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 unittest.expect(o.encoding, unittest.equals('foo')); 219 unittest.expect(o.encoding, unittest.equals('foo'));
220 unittest.expect(o.languageCode, unittest.equals('foo')); 220 unittest.expect(o.languageCode, unittest.equals('foo'));
221 unittest.expect(o.maxAlternatives, unittest.equals(42)); 221 unittest.expect(o.maxAlternatives, unittest.equals(42));
222 unittest.expect(o.profanityFilter, unittest.isTrue); 222 unittest.expect(o.profanityFilter, unittest.isTrue);
223 unittest.expect(o.sampleRate, unittest.equals(42)); 223 unittest.expect(o.sampleRate, unittest.equals(42));
224 checkSpeechContext(o.speechContext); 224 checkSpeechContext(o.speechContext);
225 } 225 }
226 buildCounterRecognitionConfig--; 226 buildCounterRecognitionConfig--;
227 } 227 }
228 228
229 buildUnnamed3790() { 229 buildUnnamed3264() {
230 var o = new core.List<core.String>(); 230 var o = new core.List<core.String>();
231 o.add("foo"); 231 o.add("foo");
232 o.add("foo"); 232 o.add("foo");
233 return o; 233 return o;
234 } 234 }
235 235
236 checkUnnamed3790(core.List<core.String> o) { 236 checkUnnamed3264(core.List<core.String> o) {
237 unittest.expect(o, unittest.hasLength(2)); 237 unittest.expect(o, unittest.hasLength(2));
238 unittest.expect(o[0], unittest.equals('foo')); 238 unittest.expect(o[0], unittest.equals('foo'));
239 unittest.expect(o[1], unittest.equals('foo')); 239 unittest.expect(o[1], unittest.equals('foo'));
240 } 240 }
241 241
242 core.int buildCounterSpeechContext = 0; 242 core.int buildCounterSpeechContext = 0;
243 buildSpeechContext() { 243 buildSpeechContext() {
244 var o = new api.SpeechContext(); 244 var o = new api.SpeechContext();
245 buildCounterSpeechContext++; 245 buildCounterSpeechContext++;
246 if (buildCounterSpeechContext < 3) { 246 if (buildCounterSpeechContext < 3) {
247 o.phrases = buildUnnamed3790(); 247 o.phrases = buildUnnamed3264();
248 } 248 }
249 buildCounterSpeechContext--; 249 buildCounterSpeechContext--;
250 return o; 250 return o;
251 } 251 }
252 252
253 checkSpeechContext(api.SpeechContext o) { 253 checkSpeechContext(api.SpeechContext o) {
254 buildCounterSpeechContext++; 254 buildCounterSpeechContext++;
255 if (buildCounterSpeechContext < 3) { 255 if (buildCounterSpeechContext < 3) {
256 checkUnnamed3790(o.phrases); 256 checkUnnamed3264(o.phrases);
257 } 257 }
258 buildCounterSpeechContext--; 258 buildCounterSpeechContext--;
259 } 259 }
260 260
261 core.int buildCounterSpeechRecognitionAlternative = 0; 261 core.int buildCounterSpeechRecognitionAlternative = 0;
262 buildSpeechRecognitionAlternative() { 262 buildSpeechRecognitionAlternative() {
263 var o = new api.SpeechRecognitionAlternative(); 263 var o = new api.SpeechRecognitionAlternative();
264 buildCounterSpeechRecognitionAlternative++; 264 buildCounterSpeechRecognitionAlternative++;
265 if (buildCounterSpeechRecognitionAlternative < 3) { 265 if (buildCounterSpeechRecognitionAlternative < 3) {
266 o.confidence = 42.0; 266 o.confidence = 42.0;
267 o.transcript = "foo"; 267 o.transcript = "foo";
268 } 268 }
269 buildCounterSpeechRecognitionAlternative--; 269 buildCounterSpeechRecognitionAlternative--;
270 return o; 270 return o;
271 } 271 }
272 272
273 checkSpeechRecognitionAlternative(api.SpeechRecognitionAlternative o) { 273 checkSpeechRecognitionAlternative(api.SpeechRecognitionAlternative o) {
274 buildCounterSpeechRecognitionAlternative++; 274 buildCounterSpeechRecognitionAlternative++;
275 if (buildCounterSpeechRecognitionAlternative < 3) { 275 if (buildCounterSpeechRecognitionAlternative < 3) {
276 unittest.expect(o.confidence, unittest.equals(42.0)); 276 unittest.expect(o.confidence, unittest.equals(42.0));
277 unittest.expect(o.transcript, unittest.equals('foo')); 277 unittest.expect(o.transcript, unittest.equals('foo'));
278 } 278 }
279 buildCounterSpeechRecognitionAlternative--; 279 buildCounterSpeechRecognitionAlternative--;
280 } 280 }
281 281
282 buildUnnamed3791() { 282 buildUnnamed3265() {
283 var o = new core.List<api.SpeechRecognitionAlternative>(); 283 var o = new core.List<api.SpeechRecognitionAlternative>();
284 o.add(buildSpeechRecognitionAlternative()); 284 o.add(buildSpeechRecognitionAlternative());
285 o.add(buildSpeechRecognitionAlternative()); 285 o.add(buildSpeechRecognitionAlternative());
286 return o; 286 return o;
287 } 287 }
288 288
289 checkUnnamed3791(core.List<api.SpeechRecognitionAlternative> o) { 289 checkUnnamed3265(core.List<api.SpeechRecognitionAlternative> o) {
290 unittest.expect(o, unittest.hasLength(2)); 290 unittest.expect(o, unittest.hasLength(2));
291 checkSpeechRecognitionAlternative(o[0]); 291 checkSpeechRecognitionAlternative(o[0]);
292 checkSpeechRecognitionAlternative(o[1]); 292 checkSpeechRecognitionAlternative(o[1]);
293 } 293 }
294 294
295 core.int buildCounterSpeechRecognitionResult = 0; 295 core.int buildCounterSpeechRecognitionResult = 0;
296 buildSpeechRecognitionResult() { 296 buildSpeechRecognitionResult() {
297 var o = new api.SpeechRecognitionResult(); 297 var o = new api.SpeechRecognitionResult();
298 buildCounterSpeechRecognitionResult++; 298 buildCounterSpeechRecognitionResult++;
299 if (buildCounterSpeechRecognitionResult < 3) { 299 if (buildCounterSpeechRecognitionResult < 3) {
300 o.alternatives = buildUnnamed3791(); 300 o.alternatives = buildUnnamed3265();
301 } 301 }
302 buildCounterSpeechRecognitionResult--; 302 buildCounterSpeechRecognitionResult--;
303 return o; 303 return o;
304 } 304 }
305 305
306 checkSpeechRecognitionResult(api.SpeechRecognitionResult o) { 306 checkSpeechRecognitionResult(api.SpeechRecognitionResult o) {
307 buildCounterSpeechRecognitionResult++; 307 buildCounterSpeechRecognitionResult++;
308 if (buildCounterSpeechRecognitionResult < 3) { 308 if (buildCounterSpeechRecognitionResult < 3) {
309 checkUnnamed3791(o.alternatives); 309 checkUnnamed3265(o.alternatives);
310 } 310 }
311 buildCounterSpeechRecognitionResult--; 311 buildCounterSpeechRecognitionResult--;
312 } 312 }
313 313
314 buildUnnamed3792() { 314 buildUnnamed3266() {
315 var o = new core.Map<core.String, core.Object>(); 315 var o = new core.Map<core.String, core.Object>();
316 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 316 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
317 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 317 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
318 return o; 318 return o;
319 } 319 }
320 320
321 checkUnnamed3792(core.Map<core.String, core.Object> o) { 321 checkUnnamed3266(core.Map<core.String, core.Object> o) {
322 unittest.expect(o, unittest.hasLength(2)); 322 unittest.expect(o, unittest.hasLength(2));
323 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"], unittest.equals('foo')); 323 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"], unittest.equals('foo'));
324 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"], unittest.equals('foo')); 324 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"], unittest.equals('foo'));
325 } 325 }
326 326
327 buildUnnamed3793() { 327 buildUnnamed3267() {
328 var o = new core.List<core.Map<core.String, core.Object>>(); 328 var o = new core.List<core.Map<core.String, core.Object>>();
329 o.add(buildUnnamed3792()); 329 o.add(buildUnnamed3266());
330 o.add(buildUnnamed3792()); 330 o.add(buildUnnamed3266());
331 return o; 331 return o;
332 } 332 }
333 333
334 checkUnnamed3793(core.List<core.Map<core.String, core.Object>> o) { 334 checkUnnamed3267(core.List<core.Map<core.String, core.Object>> o) {
335 unittest.expect(o, unittest.hasLength(2)); 335 unittest.expect(o, unittest.hasLength(2));
336 checkUnnamed3792(o[0]); 336 checkUnnamed3266(o[0]);
337 checkUnnamed3792(o[1]); 337 checkUnnamed3266(o[1]);
338 } 338 }
339 339
340 core.int buildCounterStatus = 0; 340 core.int buildCounterStatus = 0;
341 buildStatus() { 341 buildStatus() {
342 var o = new api.Status(); 342 var o = new api.Status();
343 buildCounterStatus++; 343 buildCounterStatus++;
344 if (buildCounterStatus < 3) { 344 if (buildCounterStatus < 3) {
345 o.code = 42; 345 o.code = 42;
346 o.details = buildUnnamed3793(); 346 o.details = buildUnnamed3267();
347 o.message = "foo"; 347 o.message = "foo";
348 } 348 }
349 buildCounterStatus--; 349 buildCounterStatus--;
350 return o; 350 return o;
351 } 351 }
352 352
353 checkStatus(api.Status o) { 353 checkStatus(api.Status o) {
354 buildCounterStatus++; 354 buildCounterStatus++;
355 if (buildCounterStatus < 3) { 355 if (buildCounterStatus < 3) {
356 unittest.expect(o.code, unittest.equals(42)); 356 unittest.expect(o.code, unittest.equals(42));
357 checkUnnamed3793(o.details); 357 checkUnnamed3267(o.details);
358 unittest.expect(o.message, unittest.equals('foo')); 358 unittest.expect(o.message, unittest.equals('foo'));
359 } 359 }
360 buildCounterStatus--; 360 buildCounterStatus--;
361 } 361 }
362 362
363 core.int buildCounterSyncRecognizeRequest = 0; 363 core.int buildCounterSyncRecognizeRequest = 0;
364 buildSyncRecognizeRequest() { 364 buildSyncRecognizeRequest() {
365 var o = new api.SyncRecognizeRequest(); 365 var o = new api.SyncRecognizeRequest();
366 buildCounterSyncRecognizeRequest++; 366 buildCounterSyncRecognizeRequest++;
367 if (buildCounterSyncRecognizeRequest < 3) { 367 if (buildCounterSyncRecognizeRequest < 3) {
368 o.audio = buildRecognitionAudio(); 368 o.audio = buildRecognitionAudio();
369 o.config = buildRecognitionConfig(); 369 o.config = buildRecognitionConfig();
370 } 370 }
371 buildCounterSyncRecognizeRequest--; 371 buildCounterSyncRecognizeRequest--;
372 return o; 372 return o;
373 } 373 }
374 374
375 checkSyncRecognizeRequest(api.SyncRecognizeRequest o) { 375 checkSyncRecognizeRequest(api.SyncRecognizeRequest o) {
376 buildCounterSyncRecognizeRequest++; 376 buildCounterSyncRecognizeRequest++;
377 if (buildCounterSyncRecognizeRequest < 3) { 377 if (buildCounterSyncRecognizeRequest < 3) {
378 checkRecognitionAudio(o.audio); 378 checkRecognitionAudio(o.audio);
379 checkRecognitionConfig(o.config); 379 checkRecognitionConfig(o.config);
380 } 380 }
381 buildCounterSyncRecognizeRequest--; 381 buildCounterSyncRecognizeRequest--;
382 } 382 }
383 383
384 buildUnnamed3794() { 384 buildUnnamed3268() {
385 var o = new core.List<api.SpeechRecognitionResult>(); 385 var o = new core.List<api.SpeechRecognitionResult>();
386 o.add(buildSpeechRecognitionResult()); 386 o.add(buildSpeechRecognitionResult());
387 o.add(buildSpeechRecognitionResult()); 387 o.add(buildSpeechRecognitionResult());
388 return o; 388 return o;
389 } 389 }
390 390
391 checkUnnamed3794(core.List<api.SpeechRecognitionResult> o) { 391 checkUnnamed3268(core.List<api.SpeechRecognitionResult> o) {
392 unittest.expect(o, unittest.hasLength(2)); 392 unittest.expect(o, unittest.hasLength(2));
393 checkSpeechRecognitionResult(o[0]); 393 checkSpeechRecognitionResult(o[0]);
394 checkSpeechRecognitionResult(o[1]); 394 checkSpeechRecognitionResult(o[1]);
395 } 395 }
396 396
397 core.int buildCounterSyncRecognizeResponse = 0; 397 core.int buildCounterSyncRecognizeResponse = 0;
398 buildSyncRecognizeResponse() { 398 buildSyncRecognizeResponse() {
399 var o = new api.SyncRecognizeResponse(); 399 var o = new api.SyncRecognizeResponse();
400 buildCounterSyncRecognizeResponse++; 400 buildCounterSyncRecognizeResponse++;
401 if (buildCounterSyncRecognizeResponse < 3) { 401 if (buildCounterSyncRecognizeResponse < 3) {
402 o.results = buildUnnamed3794(); 402 o.results = buildUnnamed3268();
403 } 403 }
404 buildCounterSyncRecognizeResponse--; 404 buildCounterSyncRecognizeResponse--;
405 return o; 405 return o;
406 } 406 }
407 407
408 checkSyncRecognizeResponse(api.SyncRecognizeResponse o) { 408 checkSyncRecognizeResponse(api.SyncRecognizeResponse o) {
409 buildCounterSyncRecognizeResponse++; 409 buildCounterSyncRecognizeResponse++;
410 if (buildCounterSyncRecognizeResponse < 3) { 410 if (buildCounterSyncRecognizeResponse < 3) {
411 checkUnnamed3794(o.results); 411 checkUnnamed3268(o.results);
412 } 412 }
413 buildCounterSyncRecognizeResponse--; 413 buildCounterSyncRecognizeResponse--;
414 } 414 }
415 415
416 416
417 main() { 417 main() {
418 unittest.group("obj-schema-AsyncRecognizeRequest", () { 418 unittest.group("obj-schema-AsyncRecognizeRequest", () {
419 unittest.test("to-json--from-json", () { 419 unittest.test("to-json--from-json", () {
420 var o = buildAsyncRecognizeRequest(); 420 var o = buildAsyncRecognizeRequest();
421 var od = new api.AsyncRecognizeRequest.fromJson(o.toJson()); 421 var od = new api.AsyncRecognizeRequest.fromJson(o.toJson());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 }); 522 });
523 }); 523 });
524 524
525 525
526 unittest.group("resource-OperationsResourceApi", () { 526 unittest.group("resource-OperationsResourceApi", () {
527 unittest.test("method--cancel", () { 527 unittest.test("method--cancel", () {
528 528
529 var mock = new HttpServerMock(); 529 var mock = new HttpServerMock();
530 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; 530 api.OperationsResourceApi res = new api.SpeechApi(mock).operations;
531 var arg_name = "foo"; 531 var arg_name = "foo";
532 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 532 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
533 var path = (req.url).path; 533 var path = (req.url).path;
534 var pathOffset = 0; 534 var pathOffset = 0;
535 var index; 535 var index;
536 var subPart; 536 var subPart;
537 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 537 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
538 pathOffset += 1; 538 pathOffset += 1;
539 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq uals("v1beta1/operations/")); 539 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq uals("v1beta1/operations/"));
540 pathOffset += 19; 540 pathOffset += 19;
541 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 541 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
542 542
(...skipping 14 matching lines...) Expand all
557 } 557 }
558 } 558 }
559 559
560 560
561 var h = { 561 var h = {
562 "content-type" : "application/json; charset=utf-8", 562 "content-type" : "application/json; charset=utf-8",
563 }; 563 };
564 var resp = convert.JSON.encode(buildEmpty()); 564 var resp = convert.JSON.encode(buildEmpty());
565 return new async.Future.value(stringResponse(200, h, resp)); 565 return new async.Future.value(stringResponse(200, h, resp));
566 }), true); 566 }), true);
567 res.cancel(arg_name).then(unittest.expectAsync(((api.Empty response) { 567 res.cancel(arg_name).then(unittest.expectAsync1(((api.Empty response) {
568 checkEmpty(response); 568 checkEmpty(response);
569 }))); 569 })));
570 }); 570 });
571 571
572 unittest.test("method--delete", () { 572 unittest.test("method--delete", () {
573 573
574 var mock = new HttpServerMock(); 574 var mock = new HttpServerMock();
575 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; 575 api.OperationsResourceApi res = new api.SpeechApi(mock).operations;
576 var arg_name = "foo"; 576 var arg_name = "foo";
577 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 577 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
578 var path = (req.url).path; 578 var path = (req.url).path;
579 var pathOffset = 0; 579 var pathOffset = 0;
580 var index; 580 var index;
581 var subPart; 581 var subPart;
582 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 582 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
583 pathOffset += 1; 583 pathOffset += 1;
584 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq uals("v1beta1/operations/")); 584 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq uals("v1beta1/operations/"));
585 pathOffset += 19; 585 pathOffset += 19;
586 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 586 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
587 587
(...skipping 14 matching lines...) Expand all
602 } 602 }
603 } 603 }
604 604
605 605
606 var h = { 606 var h = {
607 "content-type" : "application/json; charset=utf-8", 607 "content-type" : "application/json; charset=utf-8",
608 }; 608 };
609 var resp = convert.JSON.encode(buildEmpty()); 609 var resp = convert.JSON.encode(buildEmpty());
610 return new async.Future.value(stringResponse(200, h, resp)); 610 return new async.Future.value(stringResponse(200, h, resp));
611 }), true); 611 }), true);
612 res.delete(arg_name).then(unittest.expectAsync(((api.Empty response) { 612 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) {
613 checkEmpty(response); 613 checkEmpty(response);
614 }))); 614 })));
615 }); 615 });
616 616
617 unittest.test("method--get", () { 617 unittest.test("method--get", () {
618 618
619 var mock = new HttpServerMock(); 619 var mock = new HttpServerMock();
620 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; 620 api.OperationsResourceApi res = new api.SpeechApi(mock).operations;
621 var arg_name = "foo"; 621 var arg_name = "foo";
622 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 622 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
623 var path = (req.url).path; 623 var path = (req.url).path;
624 var pathOffset = 0; 624 var pathOffset = 0;
625 var index; 625 var index;
626 var subPart; 626 var subPart;
627 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 627 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
628 pathOffset += 1; 628 pathOffset += 1;
629 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq uals("v1beta1/operations/")); 629 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq uals("v1beta1/operations/"));
630 pathOffset += 19; 630 pathOffset += 19;
631 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 631 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
632 632
(...skipping 14 matching lines...) Expand all
647 } 647 }
648 } 648 }
649 649
650 650
651 var h = { 651 var h = {
652 "content-type" : "application/json; charset=utf-8", 652 "content-type" : "application/json; charset=utf-8",
653 }; 653 };
654 var resp = convert.JSON.encode(buildOperation()); 654 var resp = convert.JSON.encode(buildOperation());
655 return new async.Future.value(stringResponse(200, h, resp)); 655 return new async.Future.value(stringResponse(200, h, resp));
656 }), true); 656 }), true);
657 res.get(arg_name).then(unittest.expectAsync(((api.Operation response) { 657 res.get(arg_name).then(unittest.expectAsync1(((api.Operation response) {
658 checkOperation(response); 658 checkOperation(response);
659 }))); 659 })));
660 }); 660 });
661 661
662 unittest.test("method--list", () { 662 unittest.test("method--list", () {
663 663
664 var mock = new HttpServerMock(); 664 var mock = new HttpServerMock();
665 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; 665 api.OperationsResourceApi res = new api.SpeechApi(mock).operations;
666 var arg_filter = "foo";
666 var arg_name = "foo"; 667 var arg_name = "foo";
667 var arg_pageToken = "foo"; 668 var arg_pageToken = "foo";
668 var arg_pageSize = 42; 669 var arg_pageSize = 42;
669 var arg_filter = "foo"; 670 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
670 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
671 var path = (req.url).path; 671 var path = (req.url).path;
672 var pathOffset = 0; 672 var pathOffset = 0;
673 var index; 673 var index;
674 var subPart; 674 var subPart;
675 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 675 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
676 pathOffset += 1; 676 pathOffset += 1;
677 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq uals("v1beta1/operations")); 677 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq uals("v1beta1/operations"));
678 pathOffset += 18; 678 pathOffset += 18;
679 679
680 var query = (req.url).query; 680 var query = (req.url).query;
681 var queryOffset = 0; 681 var queryOffset = 0;
682 var queryMap = {}; 682 var queryMap = {};
683 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 683 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
684 parseBool(n) { 684 parseBool(n) {
685 if (n == "true") return true; 685 if (n == "true") return true;
686 if (n == "false") return false; 686 if (n == "false") return false;
687 if (n == null) return null; 687 if (n == null) return null;
688 throw new core.ArgumentError("Invalid boolean: $n"); 688 throw new core.ArgumentError("Invalid boolean: $n");
689 } 689 }
690 if (query.length > 0) { 690 if (query.length > 0) {
691 for (var part in query.split("&")) { 691 for (var part in query.split("&")) {
692 var keyvalue = part.split("="); 692 var keyvalue = part.split("=");
693 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 693 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
694 } 694 }
695 } 695 }
696 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter));
696 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); 697 unittest.expect(queryMap["name"].first, unittest.equals(arg_name));
697 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 698 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en));
698 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize)); 699 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize));
699 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter));
700 700
701 701
702 var h = { 702 var h = {
703 "content-type" : "application/json; charset=utf-8", 703 "content-type" : "application/json; charset=utf-8",
704 }; 704 };
705 var resp = convert.JSON.encode(buildListOperationsResponse()); 705 var resp = convert.JSON.encode(buildListOperationsResponse());
706 return new async.Future.value(stringResponse(200, h, resp)); 706 return new async.Future.value(stringResponse(200, h, resp));
707 }), true); 707 }), true);
708 res.list(name: arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize, filter: arg_filter).then(unittest.expectAsync(((api.ListOperationsResponse resp onse) { 708 res.list(filter: arg_filter, name: arg_name, pageToken: arg_pageToken, pag eSize: arg_pageSize).then(unittest.expectAsync1(((api.ListOperationsResponse res ponse) {
709 checkListOperationsResponse(response); 709 checkListOperationsResponse(response);
710 }))); 710 })));
711 }); 711 });
712 712
713 }); 713 });
714 714
715 715
716 unittest.group("resource-SpeechResourceApi", () { 716 unittest.group("resource-SpeechResourceApi", () {
717 unittest.test("method--asyncrecognize", () { 717 unittest.test("method--asyncrecognize", () {
718 718
719 var mock = new HttpServerMock(); 719 var mock = new HttpServerMock();
720 api.SpeechResourceApi res = new api.SpeechApi(mock).speech; 720 api.SpeechResourceApi res = new api.SpeechApi(mock).speech;
721 var arg_request = buildAsyncRecognizeRequest(); 721 var arg_request = buildAsyncRecognizeRequest();
722 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 722 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
723 var obj = new api.AsyncRecognizeRequest.fromJson(json); 723 var obj = new api.AsyncRecognizeRequest.fromJson(json);
724 checkAsyncRecognizeRequest(obj); 724 checkAsyncRecognizeRequest(obj);
725 725
726 var path = (req.url).path; 726 var path = (req.url).path;
727 var pathOffset = 0; 727 var pathOffset = 0;
728 var index; 728 var index;
729 var subPart; 729 var subPart;
730 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 730 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
731 pathOffset += 1; 731 pathOffset += 1;
732 unittest.expect(path.substring(pathOffset, pathOffset + 29), unittest.eq uals("v1beta1/speech:asyncrecognize")); 732 unittest.expect(path.substring(pathOffset, pathOffset + 29), unittest.eq uals("v1beta1/speech:asyncrecognize"));
(...skipping 16 matching lines...) Expand all
749 } 749 }
750 } 750 }
751 751
752 752
753 var h = { 753 var h = {
754 "content-type" : "application/json; charset=utf-8", 754 "content-type" : "application/json; charset=utf-8",
755 }; 755 };
756 var resp = convert.JSON.encode(buildOperation()); 756 var resp = convert.JSON.encode(buildOperation());
757 return new async.Future.value(stringResponse(200, h, resp)); 757 return new async.Future.value(stringResponse(200, h, resp));
758 }), true); 758 }), true);
759 res.asyncrecognize(arg_request).then(unittest.expectAsync(((api.Operation response) { 759 res.asyncrecognize(arg_request).then(unittest.expectAsync1(((api.Operation response) {
760 checkOperation(response); 760 checkOperation(response);
761 }))); 761 })));
762 }); 762 });
763 763
764 unittest.test("method--syncrecognize", () { 764 unittest.test("method--syncrecognize", () {
765 765
766 var mock = new HttpServerMock(); 766 var mock = new HttpServerMock();
767 api.SpeechResourceApi res = new api.SpeechApi(mock).speech; 767 api.SpeechResourceApi res = new api.SpeechApi(mock).speech;
768 var arg_request = buildSyncRecognizeRequest(); 768 var arg_request = buildSyncRecognizeRequest();
769 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 769 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
770 var obj = new api.SyncRecognizeRequest.fromJson(json); 770 var obj = new api.SyncRecognizeRequest.fromJson(json);
771 checkSyncRecognizeRequest(obj); 771 checkSyncRecognizeRequest(obj);
772 772
773 var path = (req.url).path; 773 var path = (req.url).path;
774 var pathOffset = 0; 774 var pathOffset = 0;
775 var index; 775 var index;
776 var subPart; 776 var subPart;
777 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 777 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
778 pathOffset += 1; 778 pathOffset += 1;
779 unittest.expect(path.substring(pathOffset, pathOffset + 28), unittest.eq uals("v1beta1/speech:syncrecognize")); 779 unittest.expect(path.substring(pathOffset, pathOffset + 28), unittest.eq uals("v1beta1/speech:syncrecognize"));
(...skipping 16 matching lines...) Expand all
796 } 796 }
797 } 797 }
798 798
799 799
800 var h = { 800 var h = {
801 "content-type" : "application/json; charset=utf-8", 801 "content-type" : "application/json; charset=utf-8",
802 }; 802 };
803 var resp = convert.JSON.encode(buildSyncRecognizeResponse()); 803 var resp = convert.JSON.encode(buildSyncRecognizeResponse());
804 return new async.Future.value(stringResponse(200, h, resp)); 804 return new async.Future.value(stringResponse(200, h, resp));
805 }), true); 805 }), true);
806 res.syncrecognize(arg_request).then(unittest.expectAsync(((api.SyncRecogni zeResponse response) { 806 res.syncrecognize(arg_request).then(unittest.expectAsync1(((api.SyncRecogn izeResponse response) {
807 checkSyncRecognizeResponse(response); 807 checkSyncRecognizeResponse(response);
808 }))); 808 })));
809 }); 809 });
810 810
811 }); 811 });
812 812
813 813
814 } 814 }
815 815
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698