| 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; | 5 library test.frontend.timeout; |
| 6 | 6 |
| 7 /// A class representing a modification to the default timeout for a test. | 7 /// A class representing a modification to the default timeout for a test. |
| 8 /// | 8 /// |
| 9 /// By default, a test will time out after 30 seconds. With [new Timeout], that | 9 /// 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 | 10 /// can be overridden entirely; with [new Timeout.factor], it can be scaled |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 return new Timeout.factor(scaleFactor * other.scaleFactor); | 52 return new Timeout.factor(scaleFactor * other.scaleFactor); |
| 53 } | 53 } |
| 54 | 54 |
| 55 /// Returns a new [Duration] from applying [this] to [base]. | 55 /// Returns a new [Duration] from applying [this] to [base]. |
| 56 /// | 56 /// |
| 57 /// If this is [none], returns `null`. | 57 /// If this is [none], returns `null`. |
| 58 Duration apply(Duration base) { | 58 Duration apply(Duration base) { |
| 59 if (this == none) return null; | 59 if (this == none) return null; |
| 60 return duration == null ? base * scaleFactor : duration; | 60 return duration == null ? base * scaleFactor : duration; |
| 61 } | 61 } |
| 62 |
| 63 String toString() { |
| 64 if (duration != null) return duration.toString(); |
| 65 if (scaleFactor != null) return "${scaleFactor}x"; |
| 66 return "none"; |
| 67 } |
| 62 } | 68 } |
| OLD | NEW |