| 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 library test.frontend.timeout; | |
| 6 | |
| 7 /// A class representing a modification to the default timeout for a test. | 5 /// A class representing a modification to the default timeout for a test. |
| 8 /// | 6 /// |
| 9 /// By default, a test will time out after 30 seconds. With [new Timeout], that | 7 /// By default, a test will time out after 30 seconds. With [new Timeout], that |
| 10 /// can be overridden entirely; with [new Timeout.factor], it can be scaled | 8 /// can be overridden entirely; with [new Timeout.factor], it can be scaled |
| 11 /// relative to the default. | 9 /// relative to the default. |
| 12 class Timeout { | 10 class Timeout { |
| 13 /// A constant indicating that a test should never time out. | 11 /// A constant indicating that a test should never time out. |
| 14 static const none = const Timeout._none(); | 12 static const none = const Timeout._none(); |
| 15 | 13 |
| 16 /// The timeout duration. | 14 /// The timeout duration. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 51 } |
| 54 | 52 |
| 55 /// Returns a new [Duration] from applying [this] to [base]. | 53 /// Returns a new [Duration] from applying [this] to [base]. |
| 56 /// | 54 /// |
| 57 /// If this is [none], returns `null`. | 55 /// If this is [none], returns `null`. |
| 58 Duration apply(Duration base) { | 56 Duration apply(Duration base) { |
| 59 if (this == none) return null; | 57 if (this == none) return null; |
| 60 return duration == null ? base * scaleFactor : duration; | 58 return duration == null ? base * scaleFactor : duration; |
| 61 } | 59 } |
| 62 } | 60 } |
| OLD | NEW |