OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 | 7 |
8 import '../../backend/group.dart'; | 8 import '../../backend/group.dart'; |
9 import '../../backend/live_test.dart'; | 9 import '../../backend/live_test.dart'; |
10 import '../../backend/metadata.dart'; | 10 import '../../backend/metadata.dart'; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 }); | 177 }); |
178 return id; | 178 return id; |
179 } | 179 } |
180 | 180 |
181 /// Returns a list of the IDs for all the groups in [groups], which are | 181 /// Returns a list of the IDs for all the groups in [groups], which are |
182 /// contained in the suite identified by [suiteID]. | 182 /// contained in the suite identified by [suiteID]. |
183 /// | 183 /// |
184 /// If a group doesn't have an ID yet, this assigns one and emits a new event | 184 /// If a group doesn't have an ID yet, this assigns one and emits a new event |
185 /// for that group. | 185 /// for that group. |
186 List<int> _idsForGroups(Iterable<Group> groups, int suiteID) { | 186 List<int> _idsForGroups(Iterable<Group> groups, int suiteID) { |
187 var parentID; | 187 int parentID; |
188 return groups.map((group) { | 188 return groups.map((group) { |
189 if (_groupIDs.containsKey(group)) { | 189 if (_groupIDs.containsKey(group)) { |
190 parentID = _groupIDs[group]; | 190 parentID = _groupIDs[group]; |
191 return parentID; | 191 return parentID; |
192 } | 192 } |
193 | 193 |
194 var id = _nextID++; | 194 var id = _nextID++; |
195 _groupIDs[group] = id; | 195 _groupIDs[group] = id; |
196 | 196 |
197 _emit("group", { | 197 _emit("group", { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 _emit("done", {"success": success}); | 243 _emit("done", {"success": success}); |
244 } | 244 } |
245 | 245 |
246 /// Emits an event with the given type and attributes. | 246 /// Emits an event with the given type and attributes. |
247 void _emit(String type, Map attributes) { | 247 void _emit(String type, Map attributes) { |
248 attributes["type"] = type; | 248 attributes["type"] = type; |
249 attributes["time"] = _stopwatch.elapsed.inMilliseconds; | 249 attributes["time"] = _stopwatch.elapsed.inMilliseconds; |
250 print(JSON.encode(attributes)); | 250 print(JSON.encode(attributes)); |
251 } | 251 } |
252 } | 252 } |
OLD | NEW |