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 TestPlatform vm = | 14 static const TestPlatform vm = |
15 const TestPlatform._("VM", "vm", isDartVm: true); | 15 const TestPlatform._("VM", "vm", isDartVm: true); |
16 | 16 |
17 /// Dartium. | 17 /// Dartium. |
18 static const TestPlatform dartium = const TestPlatform._("Dartium", "dartium", | 18 static const TestPlatform dartium = const TestPlatform._("Dartium", "dartium", |
19 isBrowser: true, isBlink: true); | 19 isBrowser: true, isBlink: true); |
20 | 20 |
21 /// Dartium content shell. | 21 /// Dartium content shell. |
22 static const TestPlatform contentShell = const TestPlatform._( | 22 static const TestPlatform contentShell = const TestPlatform._( |
23 "Dartium Content Shell", "content-shell", | 23 "Dartium Content Shell", "content-shell", |
24 isBrowser: true, isBlink: true); | 24 isBrowser: true, isBlink: true); |
25 | 25 |
26 /// Google Chrome. | 26 /// Google Chrome. |
27 static const TestPlatform chrome = const TestPlatform._("Chrome", "chrome", | 27 static const TestPlatform chrome = const TestPlatform._("Chrome", "chrome", |
28 isBrowser: true, isJS: true, isBlink: true); | 28 isBrowser: true, isJS: true, isBlink: true); |
29 | 29 |
| 30 /// PhantomJS. |
| 31 static const TestPlatform phantomJS = const TestPlatform._( |
| 32 "PhantomJS", "phantomjs", |
| 33 isBrowser: true, isJS: true, isBlink: true); |
| 34 |
30 /// Mozilla Firefox. | 35 /// Mozilla Firefox. |
31 static const TestPlatform firefox = const TestPlatform._("Firefox", "firefox", | 36 static const TestPlatform firefox = const TestPlatform._("Firefox", "firefox", |
32 isBrowser: true, isJS: true); | 37 isBrowser: true, isJS: true); |
33 | 38 |
34 /// A list of all instances of [TestPlatform]. | 39 /// A list of all instances of [TestPlatform]. |
35 static const List<TestPlatform> all = | 40 static const List<TestPlatform> all = |
36 const [vm, dartium, contentShell, chrome, firefox]; | 41 const [vm, dartium, contentShell, chrome, phantomJS, firefox]; |
37 | 42 |
38 /// Finds a platform by its identifier string. | 43 /// Finds a platform by its identifier string. |
39 /// | 44 /// |
40 /// If no platform is found, returns `null`. | 45 /// If no platform is found, returns `null`. |
41 static TestPlatform find(String identifier) => | 46 static TestPlatform find(String identifier) => |
42 all.firstWhere((platform) => platform.identifier == identifier, | 47 all.firstWhere((platform) => platform.identifier == identifier, |
43 orElse: () => null); | 48 orElse: () => null); |
44 | 49 |
45 /// The human-friendly name of the platform. | 50 /// The human-friendly name of the platform. |
46 final String name; | 51 final String name; |
(...skipping 11 matching lines...) Expand all Loading... |
58 final bool isJS; | 63 final bool isJS; |
59 | 64 |
60 /// Whether this platform uses the Blink rendering engine. | 65 /// Whether this platform uses the Blink rendering engine. |
61 final bool isBlink; | 66 final bool isBlink; |
62 | 67 |
63 const TestPlatform._(this.name, this.identifier, {this.isDartVm: false, | 68 const TestPlatform._(this.name, this.identifier, {this.isDartVm: false, |
64 this.isBrowser: false, this.isJS: false, this.isBlink: false}); | 69 this.isBrowser: false, this.isJS: false, this.isBlink: false}); |
65 | 70 |
66 String toString() => name; | 71 String toString() => name; |
67 } | 72 } |
OLD | NEW |