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 task; | 5 library task; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:stack_trace/stack_trace.dart'; | 10 import 'package:stack_trace/stack_trace.dart'; |
11 | 11 |
12 import '../scheduled_test.dart' show currentSchedule; | |
13 import 'future_group.dart'; | 12 import 'future_group.dart'; |
14 import 'schedule.dart'; | 13 import 'schedule.dart'; |
15 import 'utils.dart'; | 14 import 'utils.dart'; |
16 | 15 |
17 typedef Future TaskBody(); | 16 typedef Future TaskBody(); |
18 | 17 |
19 /// A single task to be run as part of a [TaskQueue]. | 18 /// A single task to be run as part of a [TaskQueue]. |
20 /// | 19 /// |
21 /// There are two levels of tasks. **Top-level tasks** are created by calling | 20 /// There are two levels of tasks. **Top-level tasks** are created by calling |
22 /// [TaskQueue.schedule] before the queue in question is running. They're run in | 21 /// [TaskQueue.schedule] before the queue in question is running. They're run in |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 final String name; | 153 final String name; |
155 | 154 |
156 /// Whether the state indicates that the task has finished running. This is | 155 /// Whether the state indicates that the task has finished running. This is |
157 /// true for both the [SUCCESS] and [ERROR] states. | 156 /// true for both the [SUCCESS] and [ERROR] states. |
158 bool get isDone => this == SUCCESS || this == ERROR; | 157 bool get isDone => this == SUCCESS || this == ERROR; |
159 | 158 |
160 const TaskState._(this.name); | 159 const TaskState._(this.name); |
161 | 160 |
162 String toString() => name; | 161 String toString() => name; |
163 } | 162 } |
OLD | NEW |