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 TestPlatform vm = |
| 15 const TestPlatform._("VM", "vm", isDartVm: true); |
15 | 16 |
16 /// Google Chrome. | 17 /// Google Chrome. |
17 static const chrome = const TestPlatform._("Chrome", "chrome", | 18 static const TestPlatform chrome = const TestPlatform._("Chrome", "chrome", |
18 isBrowser: true, isJS: true, isBlink: true); | 19 isBrowser: true, isJS: true, isBlink: true); |
19 | 20 |
| 21 /// Mozilla Firefox. |
| 22 static const TestPlatform firefox = const TestPlatform._("Firefox", "firefox", |
| 23 isBrowser: true, isJS: true); |
| 24 |
20 /// A list of all instances of [TestPlatform]. | 25 /// A list of all instances of [TestPlatform]. |
21 static const all = const [vm, chrome]; | 26 static const List<TestPlatform> all = const [vm, chrome, firefox]; |
22 | 27 |
23 /// Finds a platform by its identifier string. | 28 /// Finds a platform by its identifier string. |
24 /// | 29 /// |
25 /// If no platform is found, returns `null`. | 30 /// If no platform is found, returns `null`. |
26 static TestPlatform find(String identifier) => | 31 static TestPlatform find(String identifier) => |
27 all.firstWhere((platform) => platform.identifier == identifier, | 32 all.firstWhere((platform) => platform.identifier == identifier, |
28 orElse: () => null); | 33 orElse: () => null); |
29 | 34 |
30 /// The human-friendly name of the platform. | 35 /// The human-friendly name of the platform. |
31 final String name; | 36 final String name; |
(...skipping 11 matching lines...) Expand all Loading... |
43 final bool isJS; | 48 final bool isJS; |
44 | 49 |
45 /// Whether this platform uses the Blink rendering engine. | 50 /// Whether this platform uses the Blink rendering engine. |
46 final bool isBlink; | 51 final bool isBlink; |
47 | 52 |
48 const TestPlatform._(this.name, this.identifier, {this.isDartVm: false, | 53 const TestPlatform._(this.name, this.identifier, {this.isDartVm: false, |
49 this.isBrowser: false, this.isJS: false, this.isBlink: false}); | 54 this.isBrowser: false, this.isJS: false, this.isBlink: false}); |
50 | 55 |
51 String toString() => name; | 56 String toString() => name; |
52 } | 57 } |
OLD | NEW |