| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library watcher.test.utils; | 5 library watcher.test.utils; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 currentSchedule.onComplete.schedule(() { | 130 currentSchedule.onComplete.schedule(() { |
| 131 var numEvents = _nextEvent; | 131 var numEvents = _nextEvent; |
| 132 subscription.cancel(); | 132 subscription.cancel(); |
| 133 _nextEvent = 0; | 133 _nextEvent = 0; |
| 134 _watcher = null; | 134 _watcher = null; |
| 135 | 135 |
| 136 // If there are already errors, don't add this to the output and make | 136 // If there are already errors, don't add this to the output and make |
| 137 // people think it might be the root cause. | 137 // people think it might be the root cause. |
| 138 if (currentSchedule.errors.isEmpty) { | 138 if (currentSchedule.errors.isEmpty) { |
| 139 expect(allEvents, hasLength(numEvents)); | 139 expect(allEvents, hasLength(numEvents)); |
| 140 } else { |
| 141 currentSchedule.addDebugInfo("Events fired:\n${allEvents.join('\n')}"); |
| 140 } | 142 } |
| 141 }, "reset watcher"); | 143 }, "reset watcher"); |
| 142 | 144 |
| 143 return _watcher.events; | 145 return _watcher.events; |
| 144 }, "create watcher")).asBroadcastStream(); | 146 }, "create watcher")).asBroadcastStream(); |
| 145 | 147 |
| 146 schedule(() => _watcher.ready, "wait for watcher to be ready"); | 148 schedule(() => _watcher.ready, "wait for watcher to be ready"); |
| 147 } | 149 } |
| 148 | 150 |
| 149 /// A future set by [inAnyOrder] that will complete to the set of events that | 151 /// A future set by [inAnyOrder] that will complete to the set of events that |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 void withPermutations(callback(int i, int j, int k), {int limit}) { | 287 void withPermutations(callback(int i, int j, int k), {int limit}) { |
| 286 if (limit == null) limit = 3; | 288 if (limit == null) limit = 3; |
| 287 for (var i = 0; i < limit; i++) { | 289 for (var i = 0; i < limit; i++) { |
| 288 for (var j = 0; j < limit; j++) { | 290 for (var j = 0; j < limit; j++) { |
| 289 for (var k = 0; k < limit; k++) { | 291 for (var k = 0; k < limit; k++) { |
| 290 callback(i, j, k); | 292 callback(i, j, k); |
| 291 } | 293 } |
| 292 } | 294 } |
| 293 } | 295 } |
| 294 } | 296 } |
| OLD | NEW |