| OLD | NEW |
| 1 library googleapis.speech.v1.test; | 1 library googleapis.speech.v1.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/speech/v1.dart' as api; | 12 import 'package:googleapis/speech/v1.dart' as api; |
| 13 | 13 |
| 14 class HttpServerMock extends http.BaseClient { | 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 15 core.Function _callback; |
| 16 core.bool _expectJson; | 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { | 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 19 _callback = callback; |
| 20 _expectJson = expectJson; | 20 _expectJson = expectJson; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 } else { | 39 } else { |
| 40 return stream.toBytes().then((data) { | 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 41 return _callback(request, data); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 52 } |
| 53 | 53 |
| 54 core.int buildCounterCancelOperationRequest = 0; | 54 core.int buildCounterCancelOperationRequest = 0; |
| 55 buildCancelOperationRequest() { | 55 buildCancelOperationRequest() { |
| 56 var o = new api.CancelOperationRequest(); | 56 var o = new api.CancelOperationRequest(); |
| 57 buildCounterCancelOperationRequest++; | 57 buildCounterCancelOperationRequest++; |
| 58 if (buildCounterCancelOperationRequest < 3) { | 58 if (buildCounterCancelOperationRequest < 3) { |
| 59 } | 59 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 78 return o; | 78 return o; |
| 79 } | 79 } |
| 80 | 80 |
| 81 checkEmpty(api.Empty o) { | 81 checkEmpty(api.Empty o) { |
| 82 buildCounterEmpty++; | 82 buildCounterEmpty++; |
| 83 if (buildCounterEmpty < 3) { | 83 if (buildCounterEmpty < 3) { |
| 84 } | 84 } |
| 85 buildCounterEmpty--; | 85 buildCounterEmpty--; |
| 86 } | 86 } |
| 87 | 87 |
| 88 buildUnnamed3079() { | 88 buildUnnamed2550() { |
| 89 var o = new core.List<api.Operation>(); | 89 var o = new core.List<api.Operation>(); |
| 90 o.add(buildOperation()); | 90 o.add(buildOperation()); |
| 91 o.add(buildOperation()); | 91 o.add(buildOperation()); |
| 92 return o; | 92 return o; |
| 93 } | 93 } |
| 94 | 94 |
| 95 checkUnnamed3079(core.List<api.Operation> o) { | 95 checkUnnamed2550(core.List<api.Operation> o) { |
| 96 unittest.expect(o, unittest.hasLength(2)); | 96 unittest.expect(o, unittest.hasLength(2)); |
| 97 checkOperation(o[0]); | 97 checkOperation(o[0]); |
| 98 checkOperation(o[1]); | 98 checkOperation(o[1]); |
| 99 } | 99 } |
| 100 | 100 |
| 101 core.int buildCounterListOperationsResponse = 0; | 101 core.int buildCounterListOperationsResponse = 0; |
| 102 buildListOperationsResponse() { | 102 buildListOperationsResponse() { |
| 103 var o = new api.ListOperationsResponse(); | 103 var o = new api.ListOperationsResponse(); |
| 104 buildCounterListOperationsResponse++; | 104 buildCounterListOperationsResponse++; |
| 105 if (buildCounterListOperationsResponse < 3) { | 105 if (buildCounterListOperationsResponse < 3) { |
| 106 o.nextPageToken = "foo"; | 106 o.nextPageToken = "foo"; |
| 107 o.operations = buildUnnamed3079(); | 107 o.operations = buildUnnamed2550(); |
| 108 } | 108 } |
| 109 buildCounterListOperationsResponse--; | 109 buildCounterListOperationsResponse--; |
| 110 return o; | 110 return o; |
| 111 } | 111 } |
| 112 | 112 |
| 113 checkListOperationsResponse(api.ListOperationsResponse o) { | 113 checkListOperationsResponse(api.ListOperationsResponse o) { |
| 114 buildCounterListOperationsResponse++; | 114 buildCounterListOperationsResponse++; |
| 115 if (buildCounterListOperationsResponse < 3) { | 115 if (buildCounterListOperationsResponse < 3) { |
| 116 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 116 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 117 checkUnnamed3079(o.operations); | 117 checkUnnamed2550(o.operations); |
| 118 } | 118 } |
| 119 buildCounterListOperationsResponse--; | 119 buildCounterListOperationsResponse--; |
| 120 } | 120 } |
| 121 | 121 |
| 122 core.int buildCounterLongRunningRecognizeRequest = 0; | 122 core.int buildCounterLongRunningRecognizeRequest = 0; |
| 123 buildLongRunningRecognizeRequest() { | 123 buildLongRunningRecognizeRequest() { |
| 124 var o = new api.LongRunningRecognizeRequest(); | 124 var o = new api.LongRunningRecognizeRequest(); |
| 125 buildCounterLongRunningRecognizeRequest++; | 125 buildCounterLongRunningRecognizeRequest++; |
| 126 if (buildCounterLongRunningRecognizeRequest < 3) { | 126 if (buildCounterLongRunningRecognizeRequest < 3) { |
| 127 o.audio = buildRecognitionAudio(); | 127 o.audio = buildRecognitionAudio(); |
| 128 o.config = buildRecognitionConfig(); | 128 o.config = buildRecognitionConfig(); |
| 129 } | 129 } |
| 130 buildCounterLongRunningRecognizeRequest--; | 130 buildCounterLongRunningRecognizeRequest--; |
| 131 return o; | 131 return o; |
| 132 } | 132 } |
| 133 | 133 |
| 134 checkLongRunningRecognizeRequest(api.LongRunningRecognizeRequest o) { | 134 checkLongRunningRecognizeRequest(api.LongRunningRecognizeRequest o) { |
| 135 buildCounterLongRunningRecognizeRequest++; | 135 buildCounterLongRunningRecognizeRequest++; |
| 136 if (buildCounterLongRunningRecognizeRequest < 3) { | 136 if (buildCounterLongRunningRecognizeRequest < 3) { |
| 137 checkRecognitionAudio(o.audio); | 137 checkRecognitionAudio(o.audio); |
| 138 checkRecognitionConfig(o.config); | 138 checkRecognitionConfig(o.config); |
| 139 } | 139 } |
| 140 buildCounterLongRunningRecognizeRequest--; | 140 buildCounterLongRunningRecognizeRequest--; |
| 141 } | 141 } |
| 142 | 142 |
| 143 buildUnnamed3080() { | 143 buildUnnamed2551() { |
| 144 var o = new core.Map<core.String, core.Object>(); | 144 var o = new core.Map<core.String, core.Object>(); |
| 145 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 145 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 146 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 146 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 147 return o; | 147 return o; |
| 148 } | 148 } |
| 149 | 149 |
| 150 checkUnnamed3080(core.Map<core.String, core.Object> o) { | 150 checkUnnamed2551(core.Map<core.String, core.Object> o) { |
| 151 unittest.expect(o, unittest.hasLength(2)); | 151 unittest.expect(o, unittest.hasLength(2)); |
| 152 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')); | 152 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')); |
| 153 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')); | 153 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')); |
| 154 } | 154 } |
| 155 | 155 |
| 156 buildUnnamed3081() { | 156 buildUnnamed2552() { |
| 157 var o = new core.Map<core.String, core.Object>(); | 157 var o = new core.Map<core.String, core.Object>(); |
| 158 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 158 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 159 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 159 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 160 return o; | 160 return o; |
| 161 } | 161 } |
| 162 | 162 |
| 163 checkUnnamed3081(core.Map<core.String, core.Object> o) { | 163 checkUnnamed2552(core.Map<core.String, core.Object> o) { |
| 164 unittest.expect(o, unittest.hasLength(2)); | 164 unittest.expect(o, unittest.hasLength(2)); |
| 165 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')); | 165 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')); |
| 166 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')); | 166 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')); |
| 167 } | 167 } |
| 168 | 168 |
| 169 core.int buildCounterOperation = 0; | 169 core.int buildCounterOperation = 0; |
| 170 buildOperation() { | 170 buildOperation() { |
| 171 var o = new api.Operation(); | 171 var o = new api.Operation(); |
| 172 buildCounterOperation++; | 172 buildCounterOperation++; |
| 173 if (buildCounterOperation < 3) { | 173 if (buildCounterOperation < 3) { |
| 174 o.done = true; | 174 o.done = true; |
| 175 o.error = buildStatus(); | 175 o.error = buildStatus(); |
| 176 o.metadata = buildUnnamed3080(); | 176 o.metadata = buildUnnamed2551(); |
| 177 o.name = "foo"; | 177 o.name = "foo"; |
| 178 o.response = buildUnnamed3081(); | 178 o.response = buildUnnamed2552(); |
| 179 } | 179 } |
| 180 buildCounterOperation--; | 180 buildCounterOperation--; |
| 181 return o; | 181 return o; |
| 182 } | 182 } |
| 183 | 183 |
| 184 checkOperation(api.Operation o) { | 184 checkOperation(api.Operation o) { |
| 185 buildCounterOperation++; | 185 buildCounterOperation++; |
| 186 if (buildCounterOperation < 3) { | 186 if (buildCounterOperation < 3) { |
| 187 unittest.expect(o.done, unittest.isTrue); | 187 unittest.expect(o.done, unittest.isTrue); |
| 188 checkStatus(o.error); | 188 checkStatus(o.error); |
| 189 checkUnnamed3080(o.metadata); | 189 checkUnnamed2551(o.metadata); |
| 190 unittest.expect(o.name, unittest.equals('foo')); | 190 unittest.expect(o.name, unittest.equals('foo')); |
| 191 checkUnnamed3081(o.response); | 191 checkUnnamed2552(o.response); |
| 192 } | 192 } |
| 193 buildCounterOperation--; | 193 buildCounterOperation--; |
| 194 } | 194 } |
| 195 | 195 |
| 196 core.int buildCounterRecognitionAudio = 0; | 196 core.int buildCounterRecognitionAudio = 0; |
| 197 buildRecognitionAudio() { | 197 buildRecognitionAudio() { |
| 198 var o = new api.RecognitionAudio(); | 198 var o = new api.RecognitionAudio(); |
| 199 buildCounterRecognitionAudio++; | 199 buildCounterRecognitionAudio++; |
| 200 if (buildCounterRecognitionAudio < 3) { | 200 if (buildCounterRecognitionAudio < 3) { |
| 201 o.content = "foo"; | 201 o.content = "foo"; |
| 202 o.uri = "foo"; | 202 o.uri = "foo"; |
| 203 } | 203 } |
| 204 buildCounterRecognitionAudio--; | 204 buildCounterRecognitionAudio--; |
| 205 return o; | 205 return o; |
| 206 } | 206 } |
| 207 | 207 |
| 208 checkRecognitionAudio(api.RecognitionAudio o) { | 208 checkRecognitionAudio(api.RecognitionAudio o) { |
| 209 buildCounterRecognitionAudio++; | 209 buildCounterRecognitionAudio++; |
| 210 if (buildCounterRecognitionAudio < 3) { | 210 if (buildCounterRecognitionAudio < 3) { |
| 211 unittest.expect(o.content, unittest.equals('foo')); | 211 unittest.expect(o.content, unittest.equals('foo')); |
| 212 unittest.expect(o.uri, unittest.equals('foo')); | 212 unittest.expect(o.uri, unittest.equals('foo')); |
| 213 } | 213 } |
| 214 buildCounterRecognitionAudio--; | 214 buildCounterRecognitionAudio--; |
| 215 } | 215 } |
| 216 | 216 |
| 217 buildUnnamed3082() { | 217 buildUnnamed2553() { |
| 218 var o = new core.List<api.SpeechContext>(); | 218 var o = new core.List<api.SpeechContext>(); |
| 219 o.add(buildSpeechContext()); | 219 o.add(buildSpeechContext()); |
| 220 o.add(buildSpeechContext()); | 220 o.add(buildSpeechContext()); |
| 221 return o; | 221 return o; |
| 222 } | 222 } |
| 223 | 223 |
| 224 checkUnnamed3082(core.List<api.SpeechContext> o) { | 224 checkUnnamed2553(core.List<api.SpeechContext> o) { |
| 225 unittest.expect(o, unittest.hasLength(2)); | 225 unittest.expect(o, unittest.hasLength(2)); |
| 226 checkSpeechContext(o[0]); | 226 checkSpeechContext(o[0]); |
| 227 checkSpeechContext(o[1]); | 227 checkSpeechContext(o[1]); |
| 228 } | 228 } |
| 229 | 229 |
| 230 core.int buildCounterRecognitionConfig = 0; | 230 core.int buildCounterRecognitionConfig = 0; |
| 231 buildRecognitionConfig() { | 231 buildRecognitionConfig() { |
| 232 var o = new api.RecognitionConfig(); | 232 var o = new api.RecognitionConfig(); |
| 233 buildCounterRecognitionConfig++; | 233 buildCounterRecognitionConfig++; |
| 234 if (buildCounterRecognitionConfig < 3) { | 234 if (buildCounterRecognitionConfig < 3) { |
| 235 o.encoding = "foo"; | 235 o.encoding = "foo"; |
| 236 o.languageCode = "foo"; | 236 o.languageCode = "foo"; |
| 237 o.maxAlternatives = 42; | 237 o.maxAlternatives = 42; |
| 238 o.profanityFilter = true; | 238 o.profanityFilter = true; |
| 239 o.sampleRateHertz = 42; | 239 o.sampleRateHertz = 42; |
| 240 o.speechContexts = buildUnnamed3082(); | 240 o.speechContexts = buildUnnamed2553(); |
| 241 } | 241 } |
| 242 buildCounterRecognitionConfig--; | 242 buildCounterRecognitionConfig--; |
| 243 return o; | 243 return o; |
| 244 } | 244 } |
| 245 | 245 |
| 246 checkRecognitionConfig(api.RecognitionConfig o) { | 246 checkRecognitionConfig(api.RecognitionConfig o) { |
| 247 buildCounterRecognitionConfig++; | 247 buildCounterRecognitionConfig++; |
| 248 if (buildCounterRecognitionConfig < 3) { | 248 if (buildCounterRecognitionConfig < 3) { |
| 249 unittest.expect(o.encoding, unittest.equals('foo')); | 249 unittest.expect(o.encoding, unittest.equals('foo')); |
| 250 unittest.expect(o.languageCode, unittest.equals('foo')); | 250 unittest.expect(o.languageCode, unittest.equals('foo')); |
| 251 unittest.expect(o.maxAlternatives, unittest.equals(42)); | 251 unittest.expect(o.maxAlternatives, unittest.equals(42)); |
| 252 unittest.expect(o.profanityFilter, unittest.isTrue); | 252 unittest.expect(o.profanityFilter, unittest.isTrue); |
| 253 unittest.expect(o.sampleRateHertz, unittest.equals(42)); | 253 unittest.expect(o.sampleRateHertz, unittest.equals(42)); |
| 254 checkUnnamed3082(o.speechContexts); | 254 checkUnnamed2553(o.speechContexts); |
| 255 } | 255 } |
| 256 buildCounterRecognitionConfig--; | 256 buildCounterRecognitionConfig--; |
| 257 } | 257 } |
| 258 | 258 |
| 259 core.int buildCounterRecognizeRequest = 0; | 259 core.int buildCounterRecognizeRequest = 0; |
| 260 buildRecognizeRequest() { | 260 buildRecognizeRequest() { |
| 261 var o = new api.RecognizeRequest(); | 261 var o = new api.RecognizeRequest(); |
| 262 buildCounterRecognizeRequest++; | 262 buildCounterRecognizeRequest++; |
| 263 if (buildCounterRecognizeRequest < 3) { | 263 if (buildCounterRecognizeRequest < 3) { |
| 264 o.audio = buildRecognitionAudio(); | 264 o.audio = buildRecognitionAudio(); |
| 265 o.config = buildRecognitionConfig(); | 265 o.config = buildRecognitionConfig(); |
| 266 } | 266 } |
| 267 buildCounterRecognizeRequest--; | 267 buildCounterRecognizeRequest--; |
| 268 return o; | 268 return o; |
| 269 } | 269 } |
| 270 | 270 |
| 271 checkRecognizeRequest(api.RecognizeRequest o) { | 271 checkRecognizeRequest(api.RecognizeRequest o) { |
| 272 buildCounterRecognizeRequest++; | 272 buildCounterRecognizeRequest++; |
| 273 if (buildCounterRecognizeRequest < 3) { | 273 if (buildCounterRecognizeRequest < 3) { |
| 274 checkRecognitionAudio(o.audio); | 274 checkRecognitionAudio(o.audio); |
| 275 checkRecognitionConfig(o.config); | 275 checkRecognitionConfig(o.config); |
| 276 } | 276 } |
| 277 buildCounterRecognizeRequest--; | 277 buildCounterRecognizeRequest--; |
| 278 } | 278 } |
| 279 | 279 |
| 280 buildUnnamed3083() { | 280 buildUnnamed2554() { |
| 281 var o = new core.List<api.SpeechRecognitionResult>(); | 281 var o = new core.List<api.SpeechRecognitionResult>(); |
| 282 o.add(buildSpeechRecognitionResult()); | 282 o.add(buildSpeechRecognitionResult()); |
| 283 o.add(buildSpeechRecognitionResult()); | 283 o.add(buildSpeechRecognitionResult()); |
| 284 return o; | 284 return o; |
| 285 } | 285 } |
| 286 | 286 |
| 287 checkUnnamed3083(core.List<api.SpeechRecognitionResult> o) { | 287 checkUnnamed2554(core.List<api.SpeechRecognitionResult> o) { |
| 288 unittest.expect(o, unittest.hasLength(2)); | 288 unittest.expect(o, unittest.hasLength(2)); |
| 289 checkSpeechRecognitionResult(o[0]); | 289 checkSpeechRecognitionResult(o[0]); |
| 290 checkSpeechRecognitionResult(o[1]); | 290 checkSpeechRecognitionResult(o[1]); |
| 291 } | 291 } |
| 292 | 292 |
| 293 core.int buildCounterRecognizeResponse = 0; | 293 core.int buildCounterRecognizeResponse = 0; |
| 294 buildRecognizeResponse() { | 294 buildRecognizeResponse() { |
| 295 var o = new api.RecognizeResponse(); | 295 var o = new api.RecognizeResponse(); |
| 296 buildCounterRecognizeResponse++; | 296 buildCounterRecognizeResponse++; |
| 297 if (buildCounterRecognizeResponse < 3) { | 297 if (buildCounterRecognizeResponse < 3) { |
| 298 o.results = buildUnnamed3083(); | 298 o.results = buildUnnamed2554(); |
| 299 } | 299 } |
| 300 buildCounterRecognizeResponse--; | 300 buildCounterRecognizeResponse--; |
| 301 return o; | 301 return o; |
| 302 } | 302 } |
| 303 | 303 |
| 304 checkRecognizeResponse(api.RecognizeResponse o) { | 304 checkRecognizeResponse(api.RecognizeResponse o) { |
| 305 buildCounterRecognizeResponse++; | 305 buildCounterRecognizeResponse++; |
| 306 if (buildCounterRecognizeResponse < 3) { | 306 if (buildCounterRecognizeResponse < 3) { |
| 307 checkUnnamed3083(o.results); | 307 checkUnnamed2554(o.results); |
| 308 } | 308 } |
| 309 buildCounterRecognizeResponse--; | 309 buildCounterRecognizeResponse--; |
| 310 } | 310 } |
| 311 | 311 |
| 312 buildUnnamed3084() { | 312 buildUnnamed2555() { |
| 313 var o = new core.List<core.String>(); | 313 var o = new core.List<core.String>(); |
| 314 o.add("foo"); | 314 o.add("foo"); |
| 315 o.add("foo"); | 315 o.add("foo"); |
| 316 return o; | 316 return o; |
| 317 } | 317 } |
| 318 | 318 |
| 319 checkUnnamed3084(core.List<core.String> o) { | 319 checkUnnamed2555(core.List<core.String> o) { |
| 320 unittest.expect(o, unittest.hasLength(2)); | 320 unittest.expect(o, unittest.hasLength(2)); |
| 321 unittest.expect(o[0], unittest.equals('foo')); | 321 unittest.expect(o[0], unittest.equals('foo')); |
| 322 unittest.expect(o[1], unittest.equals('foo')); | 322 unittest.expect(o[1], unittest.equals('foo')); |
| 323 } | 323 } |
| 324 | 324 |
| 325 core.int buildCounterSpeechContext = 0; | 325 core.int buildCounterSpeechContext = 0; |
| 326 buildSpeechContext() { | 326 buildSpeechContext() { |
| 327 var o = new api.SpeechContext(); | 327 var o = new api.SpeechContext(); |
| 328 buildCounterSpeechContext++; | 328 buildCounterSpeechContext++; |
| 329 if (buildCounterSpeechContext < 3) { | 329 if (buildCounterSpeechContext < 3) { |
| 330 o.phrases = buildUnnamed3084(); | 330 o.phrases = buildUnnamed2555(); |
| 331 } | 331 } |
| 332 buildCounterSpeechContext--; | 332 buildCounterSpeechContext--; |
| 333 return o; | 333 return o; |
| 334 } | 334 } |
| 335 | 335 |
| 336 checkSpeechContext(api.SpeechContext o) { | 336 checkSpeechContext(api.SpeechContext o) { |
| 337 buildCounterSpeechContext++; | 337 buildCounterSpeechContext++; |
| 338 if (buildCounterSpeechContext < 3) { | 338 if (buildCounterSpeechContext < 3) { |
| 339 checkUnnamed3084(o.phrases); | 339 checkUnnamed2555(o.phrases); |
| 340 } | 340 } |
| 341 buildCounterSpeechContext--; | 341 buildCounterSpeechContext--; |
| 342 } | 342 } |
| 343 | 343 |
| 344 core.int buildCounterSpeechRecognitionAlternative = 0; | 344 core.int buildCounterSpeechRecognitionAlternative = 0; |
| 345 buildSpeechRecognitionAlternative() { | 345 buildSpeechRecognitionAlternative() { |
| 346 var o = new api.SpeechRecognitionAlternative(); | 346 var o = new api.SpeechRecognitionAlternative(); |
| 347 buildCounterSpeechRecognitionAlternative++; | 347 buildCounterSpeechRecognitionAlternative++; |
| 348 if (buildCounterSpeechRecognitionAlternative < 3) { | 348 if (buildCounterSpeechRecognitionAlternative < 3) { |
| 349 o.confidence = 42.0; | 349 o.confidence = 42.0; |
| 350 o.transcript = "foo"; | 350 o.transcript = "foo"; |
| 351 } | 351 } |
| 352 buildCounterSpeechRecognitionAlternative--; | 352 buildCounterSpeechRecognitionAlternative--; |
| 353 return o; | 353 return o; |
| 354 } | 354 } |
| 355 | 355 |
| 356 checkSpeechRecognitionAlternative(api.SpeechRecognitionAlternative o) { | 356 checkSpeechRecognitionAlternative(api.SpeechRecognitionAlternative o) { |
| 357 buildCounterSpeechRecognitionAlternative++; | 357 buildCounterSpeechRecognitionAlternative++; |
| 358 if (buildCounterSpeechRecognitionAlternative < 3) { | 358 if (buildCounterSpeechRecognitionAlternative < 3) { |
| 359 unittest.expect(o.confidence, unittest.equals(42.0)); | 359 unittest.expect(o.confidence, unittest.equals(42.0)); |
| 360 unittest.expect(o.transcript, unittest.equals('foo')); | 360 unittest.expect(o.transcript, unittest.equals('foo')); |
| 361 } | 361 } |
| 362 buildCounterSpeechRecognitionAlternative--; | 362 buildCounterSpeechRecognitionAlternative--; |
| 363 } | 363 } |
| 364 | 364 |
| 365 buildUnnamed3085() { | 365 buildUnnamed2556() { |
| 366 var o = new core.List<api.SpeechRecognitionAlternative>(); | 366 var o = new core.List<api.SpeechRecognitionAlternative>(); |
| 367 o.add(buildSpeechRecognitionAlternative()); | 367 o.add(buildSpeechRecognitionAlternative()); |
| 368 o.add(buildSpeechRecognitionAlternative()); | 368 o.add(buildSpeechRecognitionAlternative()); |
| 369 return o; | 369 return o; |
| 370 } | 370 } |
| 371 | 371 |
| 372 checkUnnamed3085(core.List<api.SpeechRecognitionAlternative> o) { | 372 checkUnnamed2556(core.List<api.SpeechRecognitionAlternative> o) { |
| 373 unittest.expect(o, unittest.hasLength(2)); | 373 unittest.expect(o, unittest.hasLength(2)); |
| 374 checkSpeechRecognitionAlternative(o[0]); | 374 checkSpeechRecognitionAlternative(o[0]); |
| 375 checkSpeechRecognitionAlternative(o[1]); | 375 checkSpeechRecognitionAlternative(o[1]); |
| 376 } | 376 } |
| 377 | 377 |
| 378 core.int buildCounterSpeechRecognitionResult = 0; | 378 core.int buildCounterSpeechRecognitionResult = 0; |
| 379 buildSpeechRecognitionResult() { | 379 buildSpeechRecognitionResult() { |
| 380 var o = new api.SpeechRecognitionResult(); | 380 var o = new api.SpeechRecognitionResult(); |
| 381 buildCounterSpeechRecognitionResult++; | 381 buildCounterSpeechRecognitionResult++; |
| 382 if (buildCounterSpeechRecognitionResult < 3) { | 382 if (buildCounterSpeechRecognitionResult < 3) { |
| 383 o.alternatives = buildUnnamed3085(); | 383 o.alternatives = buildUnnamed2556(); |
| 384 } | 384 } |
| 385 buildCounterSpeechRecognitionResult--; | 385 buildCounterSpeechRecognitionResult--; |
| 386 return o; | 386 return o; |
| 387 } | 387 } |
| 388 | 388 |
| 389 checkSpeechRecognitionResult(api.SpeechRecognitionResult o) { | 389 checkSpeechRecognitionResult(api.SpeechRecognitionResult o) { |
| 390 buildCounterSpeechRecognitionResult++; | 390 buildCounterSpeechRecognitionResult++; |
| 391 if (buildCounterSpeechRecognitionResult < 3) { | 391 if (buildCounterSpeechRecognitionResult < 3) { |
| 392 checkUnnamed3085(o.alternatives); | 392 checkUnnamed2556(o.alternatives); |
| 393 } | 393 } |
| 394 buildCounterSpeechRecognitionResult--; | 394 buildCounterSpeechRecognitionResult--; |
| 395 } | 395 } |
| 396 | 396 |
| 397 buildUnnamed3086() { | 397 buildUnnamed2557() { |
| 398 var o = new core.Map<core.String, core.Object>(); | 398 var o = new core.Map<core.String, core.Object>(); |
| 399 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 399 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 400 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 400 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 401 return o; | 401 return o; |
| 402 } | 402 } |
| 403 | 403 |
| 404 checkUnnamed3086(core.Map<core.String, core.Object> o) { | 404 checkUnnamed2557(core.Map<core.String, core.Object> o) { |
| 405 unittest.expect(o, unittest.hasLength(2)); | 405 unittest.expect(o, unittest.hasLength(2)); |
| 406 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')); | 406 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')); |
| 407 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')); | 407 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')); |
| 408 } | 408 } |
| 409 | 409 |
| 410 buildUnnamed3087() { | 410 buildUnnamed2558() { |
| 411 var o = new core.List<core.Map<core.String, core.Object>>(); | 411 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 412 o.add(buildUnnamed3086()); | 412 o.add(buildUnnamed2557()); |
| 413 o.add(buildUnnamed3086()); | 413 o.add(buildUnnamed2557()); |
| 414 return o; | 414 return o; |
| 415 } | 415 } |
| 416 | 416 |
| 417 checkUnnamed3087(core.List<core.Map<core.String, core.Object>> o) { | 417 checkUnnamed2558(core.List<core.Map<core.String, core.Object>> o) { |
| 418 unittest.expect(o, unittest.hasLength(2)); | 418 unittest.expect(o, unittest.hasLength(2)); |
| 419 checkUnnamed3086(o[0]); | 419 checkUnnamed2557(o[0]); |
| 420 checkUnnamed3086(o[1]); | 420 checkUnnamed2557(o[1]); |
| 421 } | 421 } |
| 422 | 422 |
| 423 core.int buildCounterStatus = 0; | 423 core.int buildCounterStatus = 0; |
| 424 buildStatus() { | 424 buildStatus() { |
| 425 var o = new api.Status(); | 425 var o = new api.Status(); |
| 426 buildCounterStatus++; | 426 buildCounterStatus++; |
| 427 if (buildCounterStatus < 3) { | 427 if (buildCounterStatus < 3) { |
| 428 o.code = 42; | 428 o.code = 42; |
| 429 o.details = buildUnnamed3087(); | 429 o.details = buildUnnamed2558(); |
| 430 o.message = "foo"; | 430 o.message = "foo"; |
| 431 } | 431 } |
| 432 buildCounterStatus--; | 432 buildCounterStatus--; |
| 433 return o; | 433 return o; |
| 434 } | 434 } |
| 435 | 435 |
| 436 checkStatus(api.Status o) { | 436 checkStatus(api.Status o) { |
| 437 buildCounterStatus++; | 437 buildCounterStatus++; |
| 438 if (buildCounterStatus < 3) { | 438 if (buildCounterStatus < 3) { |
| 439 unittest.expect(o.code, unittest.equals(42)); | 439 unittest.expect(o.code, unittest.equals(42)); |
| 440 checkUnnamed3087(o.details); | 440 checkUnnamed2558(o.details); |
| 441 unittest.expect(o.message, unittest.equals('foo')); | 441 unittest.expect(o.message, unittest.equals('foo')); |
| 442 } | 442 } |
| 443 buildCounterStatus--; | 443 buildCounterStatus--; |
| 444 } | 444 } |
| 445 | 445 |
| 446 | 446 |
| 447 main() { | 447 main() { |
| 448 unittest.group("obj-schema-CancelOperationRequest", () { | 448 unittest.group("obj-schema-CancelOperationRequest", () { |
| 449 unittest.test("to-json--from-json", () { | 449 unittest.test("to-json--from-json", () { |
| 450 var o = buildCancelOperationRequest(); | 450 var o = buildCancelOperationRequest(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 }); | 562 }); |
| 563 | 563 |
| 564 | 564 |
| 565 unittest.group("resource-OperationsResourceApi", () { | 565 unittest.group("resource-OperationsResourceApi", () { |
| 566 unittest.test("method--cancel", () { | 566 unittest.test("method--cancel", () { |
| 567 | 567 |
| 568 var mock = new HttpServerMock(); | 568 var mock = new HttpServerMock(); |
| 569 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; | 569 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; |
| 570 var arg_request = buildCancelOperationRequest(); | 570 var arg_request = buildCancelOperationRequest(); |
| 571 var arg_name = "foo"; | 571 var arg_name = "foo"; |
| 572 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 572 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 573 var obj = new api.CancelOperationRequest.fromJson(json); | 573 var obj = new api.CancelOperationRequest.fromJson(json); |
| 574 checkCancelOperationRequest(obj); | 574 checkCancelOperationRequest(obj); |
| 575 | 575 |
| 576 var path = (req.url).path; | 576 var path = (req.url).path; |
| 577 var pathOffset = 0; | 577 var pathOffset = 0; |
| 578 var index; | 578 var index; |
| 579 var subPart; | 579 var subPart; |
| 580 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 580 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 581 pathOffset += 1; | 581 pathOffset += 1; |
| 582 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v1/operations/")); | 582 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v1/operations/")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 600 } | 600 } |
| 601 } | 601 } |
| 602 | 602 |
| 603 | 603 |
| 604 var h = { | 604 var h = { |
| 605 "content-type" : "application/json; charset=utf-8", | 605 "content-type" : "application/json; charset=utf-8", |
| 606 }; | 606 }; |
| 607 var resp = convert.JSON.encode(buildEmpty()); | 607 var resp = convert.JSON.encode(buildEmpty()); |
| 608 return new async.Future.value(stringResponse(200, h, resp)); | 608 return new async.Future.value(stringResponse(200, h, resp)); |
| 609 }), true); | 609 }), true); |
| 610 res.cancel(arg_request, arg_name).then(unittest.expectAsync(((api.Empty re
sponse) { | 610 res.cancel(arg_request, arg_name).then(unittest.expectAsync1(((api.Empty r
esponse) { |
| 611 checkEmpty(response); | 611 checkEmpty(response); |
| 612 }))); | 612 }))); |
| 613 }); | 613 }); |
| 614 | 614 |
| 615 unittest.test("method--delete", () { | 615 unittest.test("method--delete", () { |
| 616 | 616 |
| 617 var mock = new HttpServerMock(); | 617 var mock = new HttpServerMock(); |
| 618 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; | 618 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; |
| 619 var arg_name = "foo"; | 619 var arg_name = "foo"; |
| 620 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 620 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 621 var path = (req.url).path; | 621 var path = (req.url).path; |
| 622 var pathOffset = 0; | 622 var pathOffset = 0; |
| 623 var index; | 623 var index; |
| 624 var subPart; | 624 var subPart; |
| 625 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 625 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 626 pathOffset += 1; | 626 pathOffset += 1; |
| 627 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v1/operations/")); | 627 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v1/operations/")); |
| 628 pathOffset += 14; | 628 pathOffset += 14; |
| 629 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 629 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 630 | 630 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 | 647 |
| 648 | 648 |
| 649 var h = { | 649 var h = { |
| 650 "content-type" : "application/json; charset=utf-8", | 650 "content-type" : "application/json; charset=utf-8", |
| 651 }; | 651 }; |
| 652 var resp = convert.JSON.encode(buildEmpty()); | 652 var resp = convert.JSON.encode(buildEmpty()); |
| 653 return new async.Future.value(stringResponse(200, h, resp)); | 653 return new async.Future.value(stringResponse(200, h, resp)); |
| 654 }), true); | 654 }), true); |
| 655 res.delete(arg_name).then(unittest.expectAsync(((api.Empty response) { | 655 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { |
| 656 checkEmpty(response); | 656 checkEmpty(response); |
| 657 }))); | 657 }))); |
| 658 }); | 658 }); |
| 659 | 659 |
| 660 unittest.test("method--get", () { | 660 unittest.test("method--get", () { |
| 661 | 661 |
| 662 var mock = new HttpServerMock(); | 662 var mock = new HttpServerMock(); |
| 663 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; | 663 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; |
| 664 var arg_name = "foo"; | 664 var arg_name = "foo"; |
| 665 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 665 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 666 var path = (req.url).path; | 666 var path = (req.url).path; |
| 667 var pathOffset = 0; | 667 var pathOffset = 0; |
| 668 var index; | 668 var index; |
| 669 var subPart; | 669 var subPart; |
| 670 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 670 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 671 pathOffset += 1; | 671 pathOffset += 1; |
| 672 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v1/operations/")); | 672 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("v1/operations/")); |
| 673 pathOffset += 14; | 673 pathOffset += 14; |
| 674 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 674 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 675 | 675 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 690 } | 690 } |
| 691 } | 691 } |
| 692 | 692 |
| 693 | 693 |
| 694 var h = { | 694 var h = { |
| 695 "content-type" : "application/json; charset=utf-8", | 695 "content-type" : "application/json; charset=utf-8", |
| 696 }; | 696 }; |
| 697 var resp = convert.JSON.encode(buildOperation()); | 697 var resp = convert.JSON.encode(buildOperation()); |
| 698 return new async.Future.value(stringResponse(200, h, resp)); | 698 return new async.Future.value(stringResponse(200, h, resp)); |
| 699 }), true); | 699 }), true); |
| 700 res.get(arg_name).then(unittest.expectAsync(((api.Operation response) { | 700 res.get(arg_name).then(unittest.expectAsync1(((api.Operation response) { |
| 701 checkOperation(response); | 701 checkOperation(response); |
| 702 }))); | 702 }))); |
| 703 }); | 703 }); |
| 704 | 704 |
| 705 unittest.test("method--list", () { | 705 unittest.test("method--list", () { |
| 706 | 706 |
| 707 var mock = new HttpServerMock(); | 707 var mock = new HttpServerMock(); |
| 708 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; | 708 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; |
| 709 var arg_name = "foo"; |
| 710 var arg_pageToken = "foo"; |
| 709 var arg_pageSize = 42; | 711 var arg_pageSize = 42; |
| 710 var arg_filter = "foo"; | 712 var arg_filter = "foo"; |
| 711 var arg_name = "foo"; | 713 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 712 var arg_pageToken = "foo"; | |
| 713 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 714 var path = (req.url).path; | 714 var path = (req.url).path; |
| 715 var pathOffset = 0; | 715 var pathOffset = 0; |
| 716 var index; | 716 var index; |
| 717 var subPart; | 717 var subPart; |
| 718 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 718 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 719 pathOffset += 1; | 719 pathOffset += 1; |
| 720 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1/operations")); | 720 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1/operations")); |
| 721 pathOffset += 13; | 721 pathOffset += 13; |
| 722 | 722 |
| 723 var query = (req.url).query; | 723 var query = (req.url).query; |
| 724 var queryOffset = 0; | 724 var queryOffset = 0; |
| 725 var queryMap = {}; | 725 var queryMap = {}; |
| 726 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 726 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 727 parseBool(n) { | 727 parseBool(n) { |
| 728 if (n == "true") return true; | 728 if (n == "true") return true; |
| 729 if (n == "false") return false; | 729 if (n == "false") return false; |
| 730 if (n == null) return null; | 730 if (n == null) return null; |
| 731 throw new core.ArgumentError("Invalid boolean: $n"); | 731 throw new core.ArgumentError("Invalid boolean: $n"); |
| 732 } | 732 } |
| 733 if (query.length > 0) { | 733 if (query.length > 0) { |
| 734 for (var part in query.split("&")) { | 734 for (var part in query.split("&")) { |
| 735 var keyvalue = part.split("="); | 735 var keyvalue = part.split("="); |
| 736 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 736 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); |
| 740 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 739 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 741 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 740 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 742 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| 741 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); | |
| 742 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 743 | 743 |
| 744 | 744 |
| 745 var h = { | 745 var h = { |
| 746 "content-type" : "application/json; charset=utf-8", | 746 "content-type" : "application/json; charset=utf-8", |
| 747 }; | 747 }; |
| 748 var resp = convert.JSON.encode(buildListOperationsResponse()); | 748 var resp = convert.JSON.encode(buildListOperationsResponse()); |
| 749 return new async.Future.value(stringResponse(200, h, resp)); | 749 return new async.Future.value(stringResponse(200, h, resp)); |
| 750 }), true); | 750 }), true); |
| 751 res.list(pageSize: arg_pageSize, filter: arg_filter, name: arg_name, pageT
oken: arg_pageToken).then(unittest.expectAsync(((api.ListOperationsResponse resp
onse) { | 751 res.list(name: arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize,
filter: arg_filter).then(unittest.expectAsync1(((api.ListOperationsResponse res
ponse) { |
| 752 checkListOperationsResponse(response); | 752 checkListOperationsResponse(response); |
| 753 }))); | 753 }))); |
| 754 }); | 754 }); |
| 755 | 755 |
| 756 }); | 756 }); |
| 757 | 757 |
| 758 | 758 |
| 759 unittest.group("resource-SpeechResourceApi", () { | 759 unittest.group("resource-SpeechResourceApi", () { |
| 760 unittest.test("method--longrunningrecognize", () { | 760 unittest.test("method--longrunningrecognize", () { |
| 761 | 761 |
| 762 var mock = new HttpServerMock(); | 762 var mock = new HttpServerMock(); |
| 763 api.SpeechResourceApi res = new api.SpeechApi(mock).speech; | 763 api.SpeechResourceApi res = new api.SpeechApi(mock).speech; |
| 764 var arg_request = buildLongRunningRecognizeRequest(); | 764 var arg_request = buildLongRunningRecognizeRequest(); |
| 765 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 765 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 766 var obj = new api.LongRunningRecognizeRequest.fromJson(json); | 766 var obj = new api.LongRunningRecognizeRequest.fromJson(json); |
| 767 checkLongRunningRecognizeRequest(obj); | 767 checkLongRunningRecognizeRequest(obj); |
| 768 | 768 |
| 769 var path = (req.url).path; | 769 var path = (req.url).path; |
| 770 var pathOffset = 0; | 770 var pathOffset = 0; |
| 771 var index; | 771 var index; |
| 772 var subPart; | 772 var subPart; |
| 773 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 773 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 774 pathOffset += 1; | 774 pathOffset += 1; |
| 775 unittest.expect(path.substring(pathOffset, pathOffset + 30), unittest.eq
uals("v1/speech:longrunningrecognize")); | 775 unittest.expect(path.substring(pathOffset, pathOffset + 30), unittest.eq
uals("v1/speech:longrunningrecognize")); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 792 } | 792 } |
| 793 } | 793 } |
| 794 | 794 |
| 795 | 795 |
| 796 var h = { | 796 var h = { |
| 797 "content-type" : "application/json; charset=utf-8", | 797 "content-type" : "application/json; charset=utf-8", |
| 798 }; | 798 }; |
| 799 var resp = convert.JSON.encode(buildOperation()); | 799 var resp = convert.JSON.encode(buildOperation()); |
| 800 return new async.Future.value(stringResponse(200, h, resp)); | 800 return new async.Future.value(stringResponse(200, h, resp)); |
| 801 }), true); | 801 }), true); |
| 802 res.longrunningrecognize(arg_request).then(unittest.expectAsync(((api.Oper
ation response) { | 802 res.longrunningrecognize(arg_request).then(unittest.expectAsync1(((api.Ope
ration response) { |
| 803 checkOperation(response); | 803 checkOperation(response); |
| 804 }))); | 804 }))); |
| 805 }); | 805 }); |
| 806 | 806 |
| 807 unittest.test("method--recognize", () { | 807 unittest.test("method--recognize", () { |
| 808 | 808 |
| 809 var mock = new HttpServerMock(); | 809 var mock = new HttpServerMock(); |
| 810 api.SpeechResourceApi res = new api.SpeechApi(mock).speech; | 810 api.SpeechResourceApi res = new api.SpeechApi(mock).speech; |
| 811 var arg_request = buildRecognizeRequest(); | 811 var arg_request = buildRecognizeRequest(); |
| 812 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 812 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 813 var obj = new api.RecognizeRequest.fromJson(json); | 813 var obj = new api.RecognizeRequest.fromJson(json); |
| 814 checkRecognizeRequest(obj); | 814 checkRecognizeRequest(obj); |
| 815 | 815 |
| 816 var path = (req.url).path; | 816 var path = (req.url).path; |
| 817 var pathOffset = 0; | 817 var pathOffset = 0; |
| 818 var index; | 818 var index; |
| 819 var subPart; | 819 var subPart; |
| 820 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 820 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 821 pathOffset += 1; | 821 pathOffset += 1; |
| 822 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("v1/speech:recognize")); | 822 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("v1/speech:recognize")); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 839 } | 839 } |
| 840 } | 840 } |
| 841 | 841 |
| 842 | 842 |
| 843 var h = { | 843 var h = { |
| 844 "content-type" : "application/json; charset=utf-8", | 844 "content-type" : "application/json; charset=utf-8", |
| 845 }; | 845 }; |
| 846 var resp = convert.JSON.encode(buildRecognizeResponse()); | 846 var resp = convert.JSON.encode(buildRecognizeResponse()); |
| 847 return new async.Future.value(stringResponse(200, h, resp)); | 847 return new async.Future.value(stringResponse(200, h, resp)); |
| 848 }), true); | 848 }), true); |
| 849 res.recognize(arg_request).then(unittest.expectAsync(((api.RecognizeRespon
se response) { | 849 res.recognize(arg_request).then(unittest.expectAsync1(((api.RecognizeRespo
nse response) { |
| 850 checkRecognizeResponse(response); | 850 checkRecognizeResponse(response); |
| 851 }))); | 851 }))); |
| 852 }); | 852 }); |
| 853 | 853 |
| 854 }); | 854 }); |
| 855 | 855 |
| 856 | 856 |
| 857 } | 857 } |
| 858 | 858 |
| OLD | NEW |