Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: lib/src/backend/test_platform.dart

Issue 1004013002: Add support for evaluating platform selectors. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Code review changes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/backend/platform_selector/visitor.dart ('k') | lib/src/runner/loader.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 unittest.backend.test_platform;
6
5 // TODO(nweiz): support pluggable platforms. 7 // TODO(nweiz): support pluggable platforms.
6 /// An enum of all platforms on which tests can run. 8 /// An enum of all platforms on which tests can run.
7 class TestPlatform { 9 class TestPlatform {
10 // When adding new platforms, be sure to update the baseline and derived
11 // variable tests in test/backend/platform_selector/evaluate_test.
12
8 /// The command-line Dart VM. 13 /// The command-line Dart VM.
9 static const vm = const TestPlatform._("VM", "vm"); 14 static const vm = const TestPlatform._("VM", "vm", isDartVm: true);
10 15
11 /// Google Chrome. 16 /// Google Chrome.
12 static const chrome = const TestPlatform._("Chrome", "chrome"); 17 static const chrome = const TestPlatform._("Chrome", "chrome",
18 isBrowser: true, isJS: true, isBlink: true);
13 19
14 /// A list of all instances of [TestPlatform]. 20 /// A list of all instances of [TestPlatform].
15 static const all = const [vm, chrome]; 21 static const all = const [vm, chrome];
16 22
17 /// Finds a platform by its identifier string. 23 /// Finds a platform by its identifier string.
18 /// 24 ///
19 /// If no platform is found, returns `null`. 25 /// If no platform is found, returns `null`.
20 static TestPlatform find(String identifier) => 26 static TestPlatform find(String identifier) =>
21 all.firstWhere((platform) => platform.identifier == identifier, 27 all.firstWhere((platform) => platform.identifier == identifier,
22 orElse: () => null); 28 orElse: () => null);
23 29
24 /// The human-friendly name of the platform. 30 /// The human-friendly name of the platform.
25 final String name; 31 final String name;
26 32
27 /// The identifier used to look up the platform. 33 /// The identifier used to look up the platform.
28 final String identifier; 34 final String identifier;
29 35
30 const TestPlatform._(this.name, this.identifier); 36 /// Whether this platform runs the Dart VM in any capacity.
37 final bool isDartVm;
38
39 /// Whether this platform is a browser.
40 final bool isBrowser;
41
42 /// Whether this platform runs Dart compiled to JavaScript.
43 final bool isJS;
44
45 /// Whether this platform uses the Blink rendering engine.
46 final bool isBlink;
47
48 const TestPlatform._(this.name, this.identifier, {this.isDartVm: false,
49 this.isBrowser: false, this.isJS: false, this.isBlink: false});
31 50
32 String toString() => name; 51 String toString() => name;
33 } 52 }
OLDNEW
« no previous file with comments | « lib/src/backend/platform_selector/visitor.dart ('k') | lib/src/runner/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698