OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Code generation for the file "integration_test_methods.dart". | 6 * Code generation for the file "integration_test_methods.dart". |
7 */ | 7 */ |
8 library codegenInttestMethods; | 8 library codegenInttestMethods; |
9 | 9 |
10 import 'dart:convert'; | 10 import 'dart:convert'; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 writeln('StreamController<$className> _$streamName;'); | 172 writeln('StreamController<$className> _$streamName;'); |
173 fieldInitializationCode.add(collectCode(() { | 173 fieldInitializationCode.add(collectCode(() { |
174 writeln('_$streamName = new StreamController<$className>(sync: true);'); | 174 writeln('_$streamName = new StreamController<$className>(sync: true);'); |
175 writeln('$streamName = _$streamName.stream.asBroadcastStream();'); | 175 writeln('$streamName = _$streamName.stream.asBroadcastStream();'); |
176 })); | 176 })); |
177 notificationSwitchContents.add(collectCode(() { | 177 notificationSwitchContents.add(collectCode(() { |
178 writeln('case ${JSON.encode(notification.longEvent)}:'); | 178 writeln('case ${JSON.encode(notification.longEvent)}:'); |
179 indent(() { | 179 indent(() { |
180 String paramsValidator = camelJoin( | 180 String paramsValidator = camelJoin( |
181 ['is', notification.domainName, notification.event, 'params']); | 181 ['is', notification.domainName, notification.event, 'params']); |
182 writeln('expect(params, $paramsValidator);'); | 182 writeln('outOfTestExpect(params, $paramsValidator);'); |
183 String constructorCall; | 183 String constructorCall; |
184 if (notification.params == null) { | 184 if (notification.params == null) { |
185 constructorCall = 'new $className()'; | 185 constructorCall = 'new $className()'; |
186 } else { | 186 } else { |
187 constructorCall = | 187 constructorCall = |
188 "new $className.fromJson(decoder, 'params', params)"; | 188 "new $className.fromJson(decoder, 'params', params)"; |
189 } | 189 } |
190 writeln('_$streamName.add($constructorCall);'); | 190 writeln('_$streamName.add($constructorCall);'); |
191 writeln('break;'); | 191 writeln('break;'); |
192 }); | 192 }); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 String methodJson = JSON.encode(request.longMethod); | 248 String methodJson = JSON.encode(request.longMethod); |
249 writeln('var result = await server.send($methodJson, $paramsVar);'); | 249 writeln('var result = await server.send($methodJson, $paramsVar);'); |
250 if (request.result != null) { | 250 if (request.result != null) { |
251 String kind = 'null'; | 251 String kind = 'null'; |
252 if (requestClass == 'EditGetRefactoringParams') { | 252 if (requestClass == 'EditGetRefactoringParams') { |
253 kind = 'kind'; | 253 kind = 'kind'; |
254 } | 254 } |
255 writeln('ResponseDecoder decoder = new ResponseDecoder($kind);'); | 255 writeln('ResponseDecoder decoder = new ResponseDecoder($kind);'); |
256 writeln("return new $resultClass.fromJson(decoder, 'result', result);"); | 256 writeln("return new $resultClass.fromJson(decoder, 'result', result);"); |
257 } else { | 257 } else { |
258 writeln('expect(result, isNull);'); | 258 writeln('outOfTestExpect(result, isNull);'); |
259 writeln('return null;'); | 259 writeln('return null;'); |
260 } | 260 } |
261 }); | 261 }); |
262 writeln('}'); | 262 writeln('}'); |
263 } | 263 } |
264 } | 264 } |
OLD | NEW |