OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 schedule; | 5 library schedule; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (_timeoutTimer != null) _timeoutTimer.cancel(); | 285 if (_timeoutTimer != null) _timeoutTimer.cancel(); |
286 if (_timeout == null) { | 286 if (_timeout == null) { |
287 _timeoutTimer = null; | 287 _timeoutTimer = null; |
288 } else { | 288 } else { |
289 _timeoutTimer = mock_clock.newTimer(_timeout, _signalTimeout); | 289 _timeoutTimer = mock_clock.newTimer(_timeout, _signalTimeout); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 /// The callback to run when the timeout timer fires. Notifies the current | 293 /// The callback to run when the timeout timer fires. Notifies the current |
294 /// queue that a timeout has occurred. | 294 /// queue that a timeout has occurred. |
295 void _signalTimeout(_) { | 295 void _signalTimeout() { |
296 // Reset the timer so that we can detect timeouts in the onException and | 296 // Reset the timer so that we can detect timeouts in the onException and |
297 // onComplete queues. | 297 // onComplete queues. |
298 _timeoutTimer = null; | 298 _timeoutTimer = null; |
299 | 299 |
300 var error = new ScheduleError.from(this, "The schedule timed out after " | 300 var error = new ScheduleError.from(this, "The schedule timed out after " |
301 "$_timeout of inactivity."); | 301 "$_timeout of inactivity."); |
302 | 302 |
303 _pendingCallbacks = 0; | 303 _pendingCallbacks = 0; |
304 if (_noPendingCallbacks != null) { | 304 if (_noPendingCallbacks != null) { |
305 var noPendingCallbacks = _noPendingCallbacks; | 305 var noPendingCallbacks = _noPendingCallbacks; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return _contents.map((task) { | 470 return _contents.map((task) { |
471 var lines = task.toString().split("\n"); | 471 var lines = task.toString().split("\n"); |
472 var firstLine = task == highlight ? | 472 var firstLine = task == highlight ? |
473 "> ${lines.first}" : "* ${lines.first}"; | 473 "> ${lines.first}" : "* ${lines.first}"; |
474 lines = new List.from(lines.skip(1).map((line) => "| $line")); | 474 lines = new List.from(lines.skip(1).map((line) => "| $line")); |
475 lines.insertRange(0, 1, firstLine); | 475 lines.insertRange(0, 1, firstLine); |
476 return lines.join("\n"); | 476 return lines.join("\n"); |
477 }).join("\n"); | 477 }).join("\n"); |
478 } | 478 } |
479 } | 479 } |
OLD | NEW |