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

Unified Diff: pkg/analysis_server/tool/spec/codegen_inttest_methods.dart

Issue 631553002: Change integration test notifications to use structured objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/integration/server/status_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
diff --git a/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart b/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
index cebe8bc74e8381705302885bd69e3908f9a5de67..720c856d3520b2d9e14b5ad9950de5346ee004b4 100644
--- a/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
+++ b/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
@@ -83,6 +83,7 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor with CodeGenerator
}));
writeln('void dispatchNotification(String event, params) {');
indent(() {
+ writeln('ResponseDecoder decoder = new ResponseDecoder(null);');
writeln('switch (event) {');
indent(() {
write(notificationSwitchContents.join());
@@ -103,19 +104,20 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor with CodeGenerator
visitNotification(Notification notification) {
String streamName =
camelJoin(['on', notification.domainName, notification.event]);
+ String className = camelJoin([notification.domainName, notification.event, 'params'], doCapitalize: true);
writeln();
docComment(toHtmlVisitor.collectHtml(() {
toHtmlVisitor.translateHtml(notification.html);
toHtmlVisitor.describePayload(notification.params, 'Parameters');
}));
- writeln('Stream $streamName;');
+ writeln('Stream<$className> $streamName;');
writeln();
docComment(toHtmlVisitor.collectHtml(() {
toHtmlVisitor.write('Stream controller for [$streamName].');
}));
- writeln('StreamController _$streamName;');
+ writeln('StreamController<$className> _$streamName;');
fieldInitializationCode.add(collectCode(() {
- writeln('_$streamName = new StreamController(sync: true);');
+ writeln('_$streamName = new StreamController<$className>(sync: true);');
writeln('$streamName = _$streamName.stream.asBroadcastStream();');
}));
notificationSwitchContents.add(collectCode(() {
@@ -124,7 +126,13 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor with CodeGenerator
String paramsValidator =
camelJoin(['is', notification.domainName, notification.event, 'params']);
writeln('expect(params, $paramsValidator);');
- writeln('_$streamName.add(params);');
+ String constructorCall;
+ if (notification.params == null) {
+ constructorCall = 'new $className()';
+ } else {
+ constructorCall = "new $className.fromJson(decoder, 'params', params)";
+ }
+ writeln('_$streamName.add($constructorCall);');
writeln('break;');
});
}));
« no previous file with comments | « pkg/analysis_server/test/integration/server/status_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698