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

Unified Diff: lib/src/runner/vm/isolate_listener.dart

Issue 1390883002: Make Suite contain a single Group. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 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
Index: lib/src/runner/vm/isolate_listener.dart
diff --git a/lib/src/runner/vm/isolate_listener.dart b/lib/src/runner/vm/isolate_listener.dart
index 7b6aa5393b85d7d8c123eba5100229ca4f12a473..9d5d1c5775fb9456d9d108baa3016a44a7d2fc45 100644
--- a/lib/src/runner/vm/isolate_listener.dart
+++ b/lib/src/runner/vm/isolate_listener.dart
@@ -13,7 +13,7 @@ import '../../backend/declarer.dart';
import '../../backend/group.dart';
import '../../backend/metadata.dart';
import '../../backend/suite.dart';
-import '../../backend/suite_entry.dart';
+import '../../backend/group_entry.dart';
import '../../backend/test.dart';
import '../../backend/test_platform.dart';
import '../../util/io.dart';
@@ -90,7 +90,7 @@ class IsolateListener {
}
var suite = new Suite(declarer.build(),
- platform: TestPlatform.vm, os: currentOS, metadata: metadata);
+ platform: TestPlatform.vm, os: currentOS);
new IsolateListener._(suite)._listen(sendPort);
}
@@ -108,36 +108,34 @@ class IsolateListener {
void _listen(SendPort sendPort) {
sendPort.send({
"type": "success",
- "entries": _serializeEntries(_suite.entries)
+ "root": _serializeGroup(_suite.group)
});
}
- /// Serializes [entries] into an Isolate-safe map.
- List<Map> _serializeEntries(List<SuiteEntry> entries) {
- return entries.map((entry) {
- if (entry is Group) {
+ /// Serializes [group] into an Isolate-safe map.
+ Map _serializeGroup(Group group) {
+ return {
+ "type": "group",
+ "name": group.name,
+ "metadata": group.metadata.serialize(),
+ "entries": group.entries.map((entry) {
+ if (entry is Group) return _serializeGroup(entry);
+
+ var test = entry as Test;
+ var receivePort = new ReceivePort();
+ receivePort.listen((message) {
+ assert(message['command'] == 'run');
+ _runTest(test, message['reply']);
+ });
+
return {
- "type": "group",
- "name": entry.name,
- "metadata": entry.metadata.serialize(),
- "entries": _serializeEntries(entry.entries)
+ "type": "test",
+ "name": test.name,
+ "metadata": test.metadata.serialize(),
+ "sendPort": receivePort.sendPort
};
- }
-
- var test = entry as Test;
- var receivePort = new ReceivePort();
- receivePort.listen((message) {
- assert(message['command'] == 'run');
- _runTest(test, message['reply']);
- });
-
- return {
- "type": "test",
- "name": test.name,
- "metadata": test.metadata.serialize(),
- "sendPort": receivePort.sendPort
- };
- }).toList();
+ }).toList()
+ };
}
/// Runs [test] and sends the results across [sendPort].

Powered by Google App Engine
This is Rietveld 408576698