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.backend.test_platform; | 5 library test.backend.test_platform; |
6 | 6 |
7 // TODO(nweiz): support pluggable platforms. | 7 // TODO(nweiz): support pluggable platforms. |
8 /// An enum of all platforms on which tests can run. | 8 /// An enum of all platforms on which tests can run. |
9 class TestPlatform { | 9 class TestPlatform { |
10 // When adding new platforms, be sure to update the baseline and derived | 10 // When adding new platforms, be sure to update the baseline and derived |
11 // variable tests in test/backend/platform_selector/evaluate_test. | 11 // variable tests in test/backend/platform_selector/evaluate_test. |
12 | 12 |
13 /// The command-line Dart VM. | 13 /// The command-line Dart VM. |
14 static const vm = const TestPlatform._("VM", "vm", isDartVm: true); | 14 static const vm = const TestPlatform._("VM", "vm", isDartVm: true); |
15 | 15 |
16 /// Google Chrome. | 16 /// Google Chrome. |
17 static const chrome = const TestPlatform._("Chrome", "chrome", | 17 static const chrome = const TestPlatform._("Chrome", "chrome", |
18 isBrowser: true, isJS: true, isBlink: true); | 18 isBrowser: true, isJS: true, isBlink: true); |
19 | 19 |
20 /// Mozilla Firefox. | |
21 static const firefox = const TestPlatform._("Firefox", "firefox", | |
kevmoo
2015/04/09 22:10:01
Per the discussion on pkg/path: add types to this
nweiz
2015/04/09 22:24:55
Done.
| |
22 isBrowser: true, isJS: true); | |
23 | |
20 /// A list of all instances of [TestPlatform]. | 24 /// A list of all instances of [TestPlatform]. |
21 static const all = const [vm, chrome]; | 25 static const all = const [vm, chrome, firefox]; |
22 | 26 |
23 /// Finds a platform by its identifier string. | 27 /// Finds a platform by its identifier string. |
24 /// | 28 /// |
25 /// If no platform is found, returns `null`. | 29 /// If no platform is found, returns `null`. |
26 static TestPlatform find(String identifier) => | 30 static TestPlatform find(String identifier) => |
27 all.firstWhere((platform) => platform.identifier == identifier, | 31 all.firstWhere((platform) => platform.identifier == identifier, |
28 orElse: () => null); | 32 orElse: () => null); |
29 | 33 |
30 /// The human-friendly name of the platform. | 34 /// The human-friendly name of the platform. |
31 final String name; | 35 final String name; |
(...skipping 11 matching lines...) Expand all Loading... | |
43 final bool isJS; | 47 final bool isJS; |
44 | 48 |
45 /// Whether this platform uses the Blink rendering engine. | 49 /// Whether this platform uses the Blink rendering engine. |
46 final bool isBlink; | 50 final bool isBlink; |
47 | 51 |
48 const TestPlatform._(this.name, this.identifier, {this.isDartVm: false, | 52 const TestPlatform._(this.name, this.identifier, {this.isDartVm: false, |
49 this.isBrowser: false, this.isJS: false, this.isBlink: false}); | 53 this.isBrowser: false, this.isJS: false, this.isBlink: false}); |
50 | 54 |
51 String toString() => name; | 55 String toString() => name; |
52 } | 56 } |
OLD | NEW |