OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // TODO(nweiz): support pluggable platforms. |
| 6 /// An enum of all platforms on which tests can run. |
| 7 class TestPlatform { |
| 8 /// The command-line Dart VM. |
| 9 static const vm = const TestPlatform._("VM", "vm"); |
| 10 |
| 11 /// Google Chrome. |
| 12 static const chrome = const TestPlatform._("Chrome", "chrome"); |
| 13 |
| 14 /// A list of all instances of [TestPlatform]. |
| 15 static const all = const [vm, chrome]; |
| 16 |
| 17 /// Finds a platform by its identifier string. |
| 18 /// |
| 19 /// If no platform is found, returns `null`. |
| 20 static TestPlatform find(String identifier) => |
| 21 all.firstWhere((platform) => platform.identifier == identifier, |
| 22 orElse: () => null); |
| 23 |
| 24 /// The human-friendly name of the platform. |
| 25 final String name; |
| 26 |
| 27 /// The identifier used to look up the platform. |
| 28 final String identifier; |
| 29 |
| 30 const TestPlatform._(this.name, this.identifier); |
| 31 |
| 32 String toString() => name; |
| 33 } |
OLD | NEW |