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